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

    https://github.com/apache/spark/pull/11555#discussion_r55444644
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -297,22 +299,34 @@ class SQLBuilder(logicalPlan: LogicalPlan, 
sqlContext: SQLContext) extends Loggi
         )
       }
     
    +  private def windowToSQL(w: Window): String = {
    +    build(
    +      "SELECT",
    +      (w.child.output ++ w.windowExpressions).map(_.sql).mkString(", "),
    +      if (w.child == OneRowRelation) "" else "FROM",
    +      toSQL(w.child)
    +    )
    +  }
    +
       object Canonicalizer extends RuleExecutor[LogicalPlan] {
         override protected def batches: Seq[Batch] = Seq(
    -      Batch("Canonicalizer", FixedPoint(100),
    +      Batch("Collapse Project", FixedPoint(100),
             // The `WidenSetOperationTypes` analysis rule may introduce extra 
`Project`s over
             // `Aggregate`s to perform type casting.  This rule merges these 
`Project`s into
             // `Aggregate`s.
    -        CollapseProject,
    -
    +        CollapseProject),
    +      Batch("Recover Scoping Info", Once,
             // Used to handle other auxiliary `Project`s added by analyzer 
(e.g.
             // `ResolveAggregateFunctions` rule)
    -        RecoverScopingInfo
    +        AddSubquery,
    +        // Previous rule will add extra sub-queries, this rule is used to 
re-propagate and update
    +        // the qualifiers bottom up.
    +        UpdateQualifiers
    --- End diff --
    
    Thanks!
    
    @cloud-fan Maybe it is good to add an example at here?


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