Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-2584][CH] Add uts about native orc write/read mismatch #6836

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.apache.gluten.utils.UTSystemParameters

import org.apache.spark.SparkConf
import org.apache.spark.gluten.NativeWriteChecker
import org.apache.spark.sql.Row
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.delta.DeltaLog
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
Expand Down Expand Up @@ -919,4 +920,42 @@ class GlutenClickHouseNativeWriteTableSuite
_ => {})
)
}

test("GLUTEN-2584: fix native write and read mismatch about complex types") {
Seq("orc", "parquet").foreach {
format =>
val table_name = "test_2584_" + format
val create_sql =
s"""CREATE TABLE $table_name(
| id INT,
| info STRUCT<name:STRING, age:INT>,
| data MAP<STRING, INT>,
| values ARRAY<INT>
|) stored as $format;
""".stripMargin
val insert_sql =
s"""INSERT overwrite $table_name
| select id, null, null, null from range(10);
""".stripMargin
val select_sql = s"select * from $table_name"
val drop_sql = s"drop table $table_name"

var expected: Seq[Row] = null
withSQLConf(vanillaSparkConfs(): _*) {
spark.sql(create_sql)
spark.sql(insert_sql)

val edf = spark.sql(select_sql)
expected = edf.collect()

spark.sql(drop_sql)
}

spark.sql(create_sql)
spark.sql(insert_sql)
val df = spark.sql(select_sql)
checkAnswer(df, expected)
spark.sql(drop_sql)
}
}
}
Loading