peter-toth commented on a change in pull request #27675: [SPARK-30870][SQL] 
Don't alias a nested column if it means the whole attribute
URL: https://github.com/apache/spark/pull/27675#discussion_r383258900
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NestedColumnAliasingSuite.scala
 ##########
 @@ -215,12 +215,7 @@ class NestedColumnAliasingSuite extends SchemaPruningTest 
{
 
     val optimized = Optimize.execute(query)
 
-    val expected = nestedRelation
-      .select(GetStructField('a, 0, Some("b")))
-      .limit(5)
-      .analyze
-
-    comparePlans(optimized, expected)
+    comparePlans(optimized, query)
 
 Review comment:
   I could add something similar to the SQL test to here as well:
   ```
     test("SPARK-30870: Don't alias nested field if it means a whole 
attribute") {
       val valueStructType = StructType.fromDDL("field struct<a:int, b:int>")
       val r = LocalRelation('value.struct(valueStructType))
   
       val field = GetStructField('value, 0, Some("field"))
   
       val query = r
         .limit(5)
         .select(field)
         .analyze
   
       val optimized = Optimize.execute(query)
   
       comparePlans(optimized, query)
     }
   ```
   but it wouldn't be much different to this particular test (`Some nested 
column means the whole structure`). 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to