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

    https://github.com/apache/spark/pull/5080#discussion_r26934440
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SqlParser.scala ---
    @@ -198,6 +203,44 @@ class SqlParser extends AbstractSparkSQLParser with 
DataTypeParser {
         | FULL  ~ OUTER.? ^^^ FullOuter
         )
     
    +  protected lazy val groupType: Parser[(LogicalPlan, Seq[NamedExpression]) 
=> LogicalPlan] =
    +    GROUP ~ BY ~> (
    +      rep1sep(expression, ",") <~ WITH ~ ROLLUP ^^ { case r =>
    +        (child: LogicalPlan, aggregations: Seq[NamedExpression]) =>
    +          Rollup(r, child, aggregations)
    +      }
    +      | rep1sep(expression, ",") <~ WITH ~ CUBE ^^ { case c =>
    +          (child: LogicalPlan, aggregations: Seq[NamedExpression]) =>
    +            Cube(c, child, aggregations)
    +      }
    +      | rep1sep(expression, ",") ~ (GROUPING ~ SETS ~ "(" ~> 
rep1sep(groupingsets, ",") <~ ")")
    +          ^^ { case e ~ g =>
    +          (child: LogicalPlan, aggregations: Seq[NamedExpression]) =>
    +            calGroupingSets(child, aggregations, g, Some(e))
    +      }
    +      | rep1sep(expression, ",") ^^ { case g =>
    +          (child: LogicalPlan, aggregations: Seq[NamedExpression]) =>
    +            Aggregate(g, aggregations, child)
    +      }
    +    )
    +
    +  protected lazy val groupingsets: Parser[Seq[Expression]] =
    +    ( "(" ~> repsep(expression, ",") <~ ")"
    +    | rep1sep(expression, ",")
    +    )
    +
    +  private def calGroupingSets(child: LogicalPlan, aggregations: 
Seq[NamedExpression],
    --- End diff --
    
    Each argument per line.


---
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