-
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
Changes from 1 commit
43351df
a5998bb
4f21a36
5f1cc66
a22d13e
cd14e14
2a4ec20
5273c3c
81f5e5e
82fa2e1
1ce6487
f7a64cf
e1da199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| 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,31 @@ class CanonicalizeSuite extends SparkFunSuite { | |
| assert(range.where(arrays1).sameResult(range.where(arrays2))) | ||
| assert(!range.where(arrays1).sameResult(range.where(arrays3))) | ||
| } | ||
|
|
||
| test("SPARK-26402: GetStructField with different optional names are semantically equal") { | ||
| val structType = | ||
| StructType(StructField("a", StructType(StructField("b", IntegerType) :: Nil)) :: Nil) | ||
| val expId = NamedExpression.newExprId | ||
| val qualifier = Seq.empty[String] | ||
|
|
||
| val fieldB1 = GetStructField( | ||
| AttributeReference("data1", structType, true)(expId, qualifier), | ||
| 0, Some("b1")) | ||
|
||
| val fieldB2 = GetStructField( | ||
| AttributeReference("data2", structType, true)(expId, qualifier), | ||
| 0, Some("b2")) | ||
| assert(fieldB1.semanticEquals(fieldB2)) | ||
|
||
|
|
||
| val fieldA1 = GetStructField( | ||
| GetStructField( | ||
| AttributeReference("data1", structType, true)(expId, qualifier), | ||
| 0, Some("a1")), | ||
| 0, Some("b1")) | ||
| val fieldA2 = GetStructField( | ||
| GetStructField( | ||
| AttributeReference("data2", structType, true)(expId, qualifier), | ||
| 0, Some("a2")), | ||
| 0, Some("b2")) | ||
| assert(fieldA1.semanticEquals(fieldA2)) | ||
| } | ||
| } | ||
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.
+1 for this canonicalization.