Github user eyalfa commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14444#discussion_r77589555
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
 ---
    @@ -174,59 +174,34 @@ case class CreateMap(children: Seq[Expression]) 
extends Expression {
     /**
      * Returns a Row containing the evaluation of all children expressions.
      */
    -@ExpressionDescription(
    -  usage = "_FUNC_(col1, col2, col3, ...) - Creates a struct with the given 
field values.")
    -case class CreateStruct(children: Seq[Expression]) extends Expression {
    -
    -  override def foldable: Boolean = children.forall(_.foldable)
    -
    -  override lazy val dataType: StructType = {
    -    val fields = children.zipWithIndex.map { case (child, idx) =>
    -      child match {
    -        case ne: NamedExpression =>
    -          StructField(ne.name, ne.dataType, ne.nullable, ne.metadata)
    -        case _ =>
    -          StructField(s"col${idx + 1}", child.dataType, child.nullable, 
Metadata.empty)
    +object CreateStruct extends (Seq[Expression] => CreateNamedStruct) {
    +  @ExpressionDescription(
    --- End diff --
    
    It's either that or a lambda in the registration code.
    
    On Sep 6, 2016 10:51 AM, "Wenchen Fan" <notificati...@github.com> wrote:
    
    > In sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/
    > complexTypeCreator.scala
    > <https://github.com/apache/spark/pull/14444#discussion_r77587010>:
    >
    > > @@ -174,59 +174,34 @@ case class CreateMap(children: Seq[Expression]) 
extends Expression {
    > >  /**
    > >   * Returns a Row containing the evaluation of all children expressions.
    > >   */
    > > -@ExpressionDescription(
    > > -  usage = "_FUNC_(col1, col2, col3, ...) - Creates a struct with the 
given field values.")
    > > -case class CreateStruct(children: Seq[Expression]) extends Expression {
    > > -
    > > -  override def foldable: Boolean = children.forall(_.foldable)
    > > -
    > > -  override lazy val dataType: StructType = {
    > > -    val fields = children.zipWithIndex.map { case (child, idx) =>
    > > -      child match {
    > > -        case ne: NamedExpression =>
    > > -          StructField(ne.name, ne.dataType, ne.nullable, ne.metadata)
    > > -        case _ =>
    > > -          StructField(s"col${idx + 1}", child.dataType, 
child.nullable, Metadata.empty)
    > > +object CreateStruct extends (Seq[Expression] => CreateNamedStruct) {
    > > +  @ExpressionDescription(
    >
    > can ExpressionDescription work here?
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > 
<https://github.com/apache/spark/pull/14444/files/3f7b63f6fb087f04b9d0c9fd0c7861d65a5ef3b2#r77587010>,
    > or mute the thread
    > 
<https://github.com/notifications/unsubscribe-auth/ABFFOchjD14TYHfxmFgvm52lPbhhvUfIks5qnRtrgaJpZM4JaDJr>
    > .
    >



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to