From aec4b3f29a694cece296a4bd978ed55d13c54427 Mon Sep 17 00:00:00 2001 From: weixiuli Date: Wed, 6 Nov 2024 13:17:17 +0000 Subject: [PATCH] Address comments --- .../parquet/GlutenParquetFieldIdIOSuite.scala | 23 ++++++++++++++++- .../parquet/GlutenParquetFieldIdIOSuite.scala | 25 +++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala b/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala index 9e4d94e1c298..8044ddd536ea 100644 --- a/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala +++ b/gluten-ut/spark33/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala @@ -18,4 +18,25 @@ package org.apache.spark.sql.execution.datasources.parquet import org.apache.spark.sql.GlutenSQLTestsBaseTrait -class GlutenParquetFieldIdIOSuite extends ParquetFieldIdIOSuite with GlutenSQLTestsBaseTrait {} +class GlutenParquetFieldIdIOSuite extends ParquetFieldIdIOSuite with GlutenSQLTestsBaseTrait { + testGluten("Parquet writer with ARRAY and MAP") { + spark.sql(""" + |CREATE TABLE T1 ( + | a INT, + | b ARRAY, + | c MAP + |) + |USING PARQUET + |""".stripMargin) + + spark.sql(""" + | INSERT OVERWRITE T1 VALUES + | (1, ARRAY(1, 2, 3), MAP("key1","value1")) + |""".stripMargin) + + checkAnswer( + spark.sql("SELECT * FROM T1"), + Row(1, Array("1", "2", "3"), Map("key1" -> "value1")) :: Nil + ) + } +} diff --git a/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala b/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala index 9e4d94e1c298..bd1c269843fb 100644 --- a/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala +++ b/gluten-ut/spark34/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/GlutenParquetFieldIdIOSuite.scala @@ -16,6 +16,27 @@ */ package org.apache.spark.sql.execution.datasources.parquet -import org.apache.spark.sql.GlutenSQLTestsBaseTrait +import org.apache.spark.sql.{GlutenSQLTestsBaseTrait, Row} -class GlutenParquetFieldIdIOSuite extends ParquetFieldIdIOSuite with GlutenSQLTestsBaseTrait {} +class GlutenParquetFieldIdIOSuite extends ParquetFieldIdIOSuite with GlutenSQLTestsBaseTrait { + testGluten("Parquet writer with ARRAY and MAP") { + spark.sql(""" + |CREATE TABLE T1 ( + | a INT, + | b ARRAY, + | c MAP + |) + |USING PARQUET + |""".stripMargin) + + spark.sql(""" + | INSERT OVERWRITE T1 VALUES + | (1, ARRAY(1, 2, 3), MAP("key1","value1")) + |""".stripMargin) + + checkAnswer( + spark.sql("SELECT * FROM T1"), + Row(1, Array("1", "2", "3"), Map("key1" -> "value1")) :: Nil + ) + } +}