-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32163][SQL] Nested pruning should work even with cosmetic variations #28988
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -497,6 +497,26 @@ abstract class SchemaPruningSuite | |||||||||||||
| Row(Row("Janet", null, "Jones"), "Jones") ::Nil) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| testSchemaPruning("SPARK-32163: nested pruning should work even with cosmetic variations") { | ||||||||||||||
| withTempView("contact_alias") { | ||||||||||||||
| sql("select * from contacts") | ||||||||||||||
| .repartition(100, col("name.first"), col("name.last")) | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue cannot happen in branch-3.0? spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasing.scala Lines 80 to 85 in fc2660c
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case is only for master branch. However this issue can happen in branch-3.0 too. I added another new test here, which is for branch-3.0. But when we backport this to branch-3.0, we need to remove first test case as it will fail on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, thanks for adding the test. |
||||||||||||||
| .selectExpr("name").createOrReplaceTempView("contact_alias") | ||||||||||||||
|
|
||||||||||||||
| val query1 = sql("select name.first from contact_alias") | ||||||||||||||
| checkScan(query1, "struct<name:struct<first:string,last:string>>") | ||||||||||||||
| checkAnswer(query1, Row("Jane") :: Row("John") :: Row("Jim") :: Row("Janet") ::Nil) | ||||||||||||||
|
|
||||||||||||||
| sql("select * from contacts") | ||||||||||||||
| .select(explode(col("friends.first")), col("friends")) | ||||||||||||||
| .createOrReplaceTempView("contact_alias") | ||||||||||||||
|
|
||||||||||||||
| val query2 = sql("select friends.middle, col from contact_alias") | ||||||||||||||
| checkScan(query2, "struct<friends:array<struct<first:string,middle:string>>>") | ||||||||||||||
| checkAnswer(query2, Row(Array("Z."), "Susan") :: Nil) | ||||||||||||||
|
Comment on lines
+514
to
+516
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @maropu This test is for branch-3.0.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the test case. |
||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| protected def testSchemaPruning(testName: String)(testThunk: => Unit): Unit = { | ||||||||||||||
| test(s"Spark vectorized reader - without partition data column - $testName") { | ||||||||||||||
| withSQLConf(vectorizedReaderEnabledKey -> "true") { | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, @viirya @frankyin-factual !