HyukjinKwon commented on a change in pull request #28633:
URL: https://github.com/apache/spark/pull/28633#discussion_r429756482



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
##########
@@ -320,12 +324,23 @@ object CreateStruct extends FunctionBuilder {
     })
   }
 

Review comment:
       Here, I took more conservative approach just by whitelisting. There are 
some cases that `named_struct` makes arguably more pretty when they are 
internally used. For example:
   
   ```diff
   -| org.apache.spark.sql.catalyst.expressions.ZipWith | zip_with | SELECT 
zip_with(array(1, 2, 3), array('a', 'b', 'c'), (x, y) -> (y, x)) | 
struct<zip_with(array(1, 2, 3), array(a, b, c), lambdafunction(named_struct(y, 
namedlambdavariable(), x, namedlambdavariable()), namedlambdavariable(), 
namedlambdavariable())):array<struct<y:string,x:int>>> |
   +| org.apache.spark.sql.catalyst.expressions.ZipWith | zip_with | SELECT 
zip_with(array(1, 2, 3), array('a', 'b', 'c'), (x, y) -> (y, x)) | 
struct<zip_with(array(1, 2, 3), array(a, b, c), 
lambdafunction(struct(namedlambdavariable(), namedlambdavariable()), 
namedlambdavariable(), namedlambdavariable())):array<struct<y:string,x:int>>> |
   
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to