Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/9819#discussion_r45658962
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -866,26 +874,37 @@ class Analyzer(
// Now, we extract regular expressions from
expressionsWithWindowFunctions
// by using extractExpr.
+ val seenWindowAggregates = new ArrayBuffer[AggregateExpression]
val newExpressionsWithWindowFunctions =
expressionsWithWindowFunctions.map {
_.transform {
// Extracts children expressions of a WindowFunction (input
parameters of
// a WindowFunction).
case wf : WindowFunction =>
- val newChildren = wf.children.map(extractExpr(_))
+ val newChildren = wf.children.map(extractExpr)
wf.withNewChildren(newChildren)
// Extracts expressions from the partition spec and order spec.
case wsc @ WindowSpecDefinition(partitionSpec, orderSpec, _) =>
- val newPartitionSpec = partitionSpec.map(extractExpr(_))
+ val newPartitionSpec = partitionSpec.map(extractExpr)
val newOrderSpec = orderSpec.map { so =>
val newChild = extractExpr(so.child)
so.copy(child = newChild)
}
wsc.copy(partitionSpec = newPartitionSpec, orderSpec =
newOrderSpec)
+ // Extract Windowed AggregateExpression
+ case we @ WindowExpression(
+ AggregateExpression(function, mode, isDistinct),
+ spec: WindowSpecDefinition) =>
+ val newChildren = function.children.map(extractExpr)
+ val newFunction =
function.withNewChildren(newChildren).asInstanceOf[AggregateFunction]
+ val newAgg = AggregateExpression(newFunction, mode, isDistinct)
--- End diff --
```withNewChildren``` does not work with ```AggregateExpression```; I am
working arround that 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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]