-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-26402][SQL] Accessing nested fields with different cases in case insensitive mode #23353
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
Closed
Closed
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
43351df
Canonicalization on GetStructField
dbtsai a5998bb
Added end-to-end test
dbtsai 4f21a36
Minor
dbtsai 5f1cc66
address feedback
dbtsai a22d13e
addressed feedback
dbtsai cd14e14
Added one end-to-end test
dbtsai 2a4ec20
Merge branch 'master' into nestedEqual
dbtsai 5273c3c
address feedback
dbtsai 81f5e5e
address feedback
dbtsai 82fa2e1
fix a bug
dbtsai 1ce6487
address feedback
dbtsai f7a64cf
address feedback
dbtsai e1da199
minor
dbtsai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ package org.apache.spark.sql.catalyst.expressions | |
| import org.apache.spark.SparkFunSuite | ||
| import org.apache.spark.sql.catalyst.dsl.plans._ | ||
| import org.apache.spark.sql.catalyst.plans.logical.Range | ||
| import org.apache.spark.sql.types.{IntegerType, StructField, StructType} | ||
|
|
||
| class CanonicalizeSuite extends SparkFunSuite { | ||
|
|
||
|
|
@@ -50,4 +51,32 @@ class CanonicalizeSuite extends SparkFunSuite { | |
| assert(range.where(arrays1).sameResult(range.where(arrays2))) | ||
| assert(!range.where(arrays1).sameResult(range.where(arrays3))) | ||
| } | ||
|
|
||
| test("SPARK-26402: accessing nested fields with different cases in case insensitive mode") { | ||
| val expId = NamedExpression.newExprId | ||
| val qualifier = Seq.empty[String] | ||
| val structType = StructType( | ||
| StructField("a", StructType(StructField("b", IntegerType, false) :: Nil), false) :: Nil) | ||
|
|
||
| // GetStructField with different names are semantically equal | ||
| val fieldA1 = GetStructField( | ||
| AttributeReference("data1", structType, false)(expId, qualifier), | ||
| 0, Some("a1")) | ||
| val fieldA2 = GetStructField( | ||
| AttributeReference("data2", structType, false)(expId, qualifier), | ||
| 0, Some("a2")) | ||
| assert(fieldB1.semanticEquals(fieldB2)) | ||
|
||
|
|
||
| val fieldB1 = GetStructField( | ||
| GetStructField( | ||
| AttributeReference("data1", structType, false)(expId, qualifier), | ||
| 0, Some("a1")), | ||
| 0, Some("b1")) | ||
| val fieldB2 = GetStructField( | ||
| GetStructField( | ||
| AttributeReference("data2", structType, false)(expId, qualifier), | ||
| 0, Some("a2")), | ||
| 0, Some("b2")) | ||
| assert(fieldA1.semanticEquals(fieldA2)) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks not precisely matched the comments of
ignoreNamesTypes. It's better to change it accordingly.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.
/** Remove names and nullability from types. */I can change it to
and / or.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.
The comment of
Canonicalizesays:It's also needed to be update.
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.
Actually after this change it is not only for types.
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.
Thanks. I re-wrote it a bit. Should look okay now.