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

    https://github.com/apache/spark/pull/9556#discussion_r44269743
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/expressions/WindowSpec.scala ---
    @@ -141,40 +141,46 @@ class WindowSpec private[sql](
        */
       private[sql] def withAggregate(aggregate: Column): Column = {
         val windowExpr = aggregate.expr match {
    -      case Average(child) => WindowExpression(
    -        UnresolvedWindowFunction("avg", child :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case Sum(child) => WindowExpression(
    -        UnresolvedWindowFunction("sum", child :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case Count(child) => WindowExpression(
    -        UnresolvedWindowFunction("count", child :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case First(child, ignoreNulls) => WindowExpression(
    -        // TODO this is a hack for Hive UDAF first_value
    -        UnresolvedWindowFunction(
    -          "first_value",
    -          child :: ignoreNulls :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case Last(child, ignoreNulls) => WindowExpression(
    -        // TODO this is a hack for Hive UDAF last_value
    -        UnresolvedWindowFunction(
    -          "last_value",
    -          child :: ignoreNulls :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case Min(child) => WindowExpression(
    -        UnresolvedWindowFunction("min", child :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case Max(child) => WindowExpression(
    -        UnresolvedWindowFunction("max", child :: Nil),
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    -      case wf: WindowFunction => WindowExpression(
    -        wf,
    -        WindowSpecDefinition(partitionSpec, orderSpec, frame))
    +      case AggregateExpression(aggregateFunction, _, isDistinct) if 
!isDistinct =>
    +        aggregateFunction match {
    --- End diff --
    
    Window functions also need to be wrapped in an ```AggregateExpression``` in 
```functions.scala``` for this to work. It currently fails 
HiveDataFrameWindowSuite due to this.


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