spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viirya <...@git.apache.org>
Subject [GitHub] spark pull request #18779: [SPARK-21580][SQL]Integers in aggregation express...
Date Mon, 31 Jul 2017 08:49:00 GMT
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18779#discussion_r130300193
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
    @@ -1010,7 +1014,16 @@ class Analyzer(
                     s"(valid range is [1, ${aggs.size}])")
               case o => o
             }
    -        Aggregate(newGroups, aggs, child)
    +        // If an aggregateExpression is integer, after replaced with this aggregateExpression,
the
    +        // groupExpression will be considered as an ordinal still, so we should filter
it.
    +        var filterGroups: Seq[Expression] = Nil
    +        newGroups.foreach { ng =>
    +          ng match {
    +            case a: Alias => if (!isIntLiteral (a.child)) filterGroups :+= ng
    +            case _ => filterGroups :+= ng
    +          }
    +        }
    +        Aggregate(filterGroups, aggs, child)
    --- End diff --
    
    Similar to `RemoveLiteralFromGroupExpressions`, we shouldn't drop all grouping expressions
if they are all int literals after resolved from `UnresolvedOrdinal`.


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

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


Mime
View raw message