Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6828#discussion_r32601130
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypes.scala
 ---
    @@ -62,9 +62,14 @@ case class CreateStruct(children: Seq[NamedExpression]) 
extends Expression {
       override lazy val dataType: StructType = {
         assert(resolved,
           s"CreateStruct contains unresolvable children: 
${children.filterNot(_.resolved)}.")
    -    val fields = children.map { child =>
    -      StructField(child.name, child.dataType, child.nullable, 
child.metadata)
    -    }
    +      val fields = children.zipWithIndex.map { case (child, idx) =>
    +        child match {
    +          case ne: NamedExpression =>
    --- End diff --
    
    I will not argue that they have some share logic, however, the difference 
between `GenericUDFStruct ` and `GenericUDFNamedStruct` is, the former gives 
names for output fields as (col1, col2 ...), but the later requires specifying 
the output fields names from its arguments. 
    Probably we'd better create another expression class in Spark SQL for 
`GenericUDFNamedStruct`, mixing the functionality in a single class probably 
makes people confusing.
    
    It will be great if you can create an issue under the expression umbrella 
task https://issues.apache.org/jira/browse/SPARK-8159 
    
    What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to