spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-12720] [SQL] SQL Generation Support for...
Date Wed, 02 Mar 2016 09:06:54 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11283#discussion_r54695920
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -211,6 +215,71 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: SQLContext)
extends Loggi
         )
       }
     
    +  private def groupingSetToSQL(
    +      plan: Aggregate,
    +      expand: Expand,
    +      project: Project): String = {
    +    // In cube/rollup/groupingsets, Analyzer creates new aliases for all group by expressions.
    +    // Since conversion from attribute back SQL ignore expression IDs, the alias of attribute
    +    // references are ignored in aliasMap
    +    val aliasMap = AttributeMap(project.projectList.collect {
    +      case a @ Alias(child, name) if !child.isInstanceOf[AttributeReference] => (a.toAttribute,
a)
    +    })
    +
    +    val groupingExprs = plan.groupingExpressions.filterNot {
    +      // VirtualColumn.groupingIdName is added by Analyzer, and thus remove it.
    +      case a: NamedExpression => a.name == VirtualColumn.groupingIdName
    --- End diff --
    
    we can be more strict here, use `AttributeReference`


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