Skip to content

Commit ba3e271

Browse files
pan3793dongjoon-hyun
authored andcommitted
[SPARK-45891][SQL][FOLLOWUP] Disable spark.sql.variant.allowReadingShredded by default
### What changes were proposed in this pull request? Disable `spark.sql.variant.allowReadingShredded` by default ### Why are the changes needed? apache/parquet-format#461 made incompatible changes on the shredding spec, if Spark delivers the current shredding implementation as-is in Spark 4.0, additional migration/compatible efforts will be required in the future. ### Does this PR introduce _any_ user-facing change? No, variant is an unreleased feature. ### How was this patch tested? Pass GHA. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49874 from pan3793/SPARK-45891-followup. Authored-by: Cheng Pan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 533d9c3 commit ba3e271

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4755,7 +4755,7 @@ object SQLConf {
47554755
"When false, it only reads unshredded variant.")
47564756
.version("4.0.0")
47574757
.booleanConf
4758-
.createWithDefault(true)
4758+
.createWithDefault(false)
47594759

47604760
val PUSH_VARIANT_INTO_SCAN =
47614761
buildConf("spark.sql.variant.pushVariantIntoScan")

sql/core/src/test/scala/org/apache/spark/sql/VariantShreddingSuite.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ class VariantShreddingSuite extends QueryTest with SharedSparkSession with Parqu
7474
def isPushEnabled: Boolean = SQLConf.get.getConf(SQLConf.PUSH_VARIANT_INTO_SCAN)
7575

7676
def testWithTempPath(name: String)(block: File => Unit): Unit = test(name) {
77-
withPushConfigs() {
78-
withTempPath { path =>
79-
block(path)
77+
withSQLConf(SQLConf.VARIANT_ALLOW_READING_SHREDDED.key-> "true") {
78+
withPushConfigs() {
79+
withTempPath { path =>
80+
block(path)
81+
}
8082
}
8183
}
8284
}

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetVariantShreddingSuite.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ParquetVariantShreddingSuite extends QueryTest with ParquetTest with Share
4949
"a struct<value binary, typed_value int>, b struct<value binary, typed_value string>," +
5050
"c struct<value binary, typed_value decimal(15, 1)>>>"
5151
withSQLConf(SQLConf.VARIANT_WRITE_SHREDDING_ENABLED.key -> true.toString,
52+
SQLConf.VARIANT_ALLOW_READING_SHREDDED.key -> true.toString,
5253
SQLConf.VARIANT_FORCE_SHREDDING_SCHEMA_FOR_TEST.key -> schema) {
5354
df.write.mode("overwrite").parquet(dir.getAbsolutePath)
5455

@@ -122,6 +123,7 @@ class ParquetVariantShreddingSuite extends QueryTest with ParquetTest with Share
122123
val fullSchema = "v struct<metadata binary, value binary, typed_value array<" +
123124
"struct<value binary, typed_value int>>>"
124125
withSQLConf(SQLConf.VARIANT_WRITE_SHREDDING_ENABLED.key -> true.toString,
126+
SQLConf.VARIANT_ALLOW_READING_SHREDDED.key -> true.toString,
125127
SQLConf.VARIANT_FORCE_SHREDDING_SCHEMA_FOR_TEST.key -> schema) {
126128
df.write.mode("overwrite").parquet(dir.getAbsolutePath)
127129

@@ -186,6 +188,7 @@ class ParquetVariantShreddingSuite extends QueryTest with ParquetTest with Share
186188
"arr array<struct<metadata binary, value binary>>, " +
187189
"m map<string, struct<metadata binary, value binary>>"
188190
withSQLConf(SQLConf.VARIANT_WRITE_SHREDDING_ENABLED.key -> true.toString,
191+
SQLConf.VARIANT_ALLOW_READING_SHREDDED.key -> true.toString,
189192
SQLConf.VARIANT_FORCE_SHREDDING_SCHEMA_FOR_TEST.key -> schema) {
190193
df.write.mode("overwrite").parquet(dir.getAbsolutePath)
191194

0 commit comments

Comments
 (0)