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

    https://github.com/apache/spark/pull/11696#discussion_r56120577
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -274,17 +293,25 @@ class SQLBuilder(logicalPlan: LogicalPlan, 
sqlContext: SQLContext) extends Loggi
         val groupingSetSQL = "GROUPING SETS(" +
           groupingSet.map(e => s"(${e.map(_.sql).mkString(", 
")})").mkString(", ") + ")"
     
    -    val aggExprs = agg.aggregateExpressions.map { case expr =>
    -      expr.transformDown {
    +    val aggExprs = agg.aggregateExpressions.map { case aggExpr =>
    +      aggExpr.transformDown {
             // grouping_id() is converted to VirtualColumn.groupingIdName by 
Analyzer. Revert it back.
             case ar: AttributeReference if ar == gid => GroupingID(Nil)
    -        case ar: AttributeReference if groupByAttrMap.contains(ar) => 
groupByAttrMap(ar)
    +        case ar: AttributeReference if groupByAttrMap.contains(ar) =>
    +          groupByAttrMap(ar)
             case a @ Cast(BitwiseAnd(
                 ShiftRight(ar: AttributeReference, Literal(value: Any, 
IntegerType)),
                 Literal(1, IntegerType)), ByteType) if ar == gid =>
               // for converting an expression to its original SQL format 
grouping(col)
               val idx = groupByExprs.length - 1 - value.asInstanceOf[Int]
               groupByExprs.lift(idx).map(Grouping).getOrElse(a)
    +      } match {
    --- End diff --
    
    this match is weird - let's give it a named variable to break the flow


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