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

    https://github.com/apache/spark/pull/12040#discussion_r57887488
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/Window.scala ---
    @@ -885,9 +886,15 @@ private[execution] object AggregateProcessor {
         val evaluateExpressions = 
mutable.Buffer.fill[Expression](ordinal)(NoOp)
         val imperatives = mutable.Buffer.empty[ImperativeAggregate]
     
    +    // SPARK-14244: `SizeBasedWindowFunction`s created on driver side and 
serialized to executor
    +    // side contains global window partition size attribute reference 
(`SizeBasedWindowFunction.n`),
    +    // and must be rewritten using the one instantiated on executor side. 
Otherwise, attribute
    +    // binding fails because of different expression ID.
    +    val rewrittenFunctions = functions.map(rewriteWindowPartitionSize)
    +
         // Check if there are any SizeBasedWindowFunctions. If there are, we 
add the partition size to
         // the aggregation buffer. Note that the ordinal of the partition size 
value will always be 0.
    -    val trackPartitionSize = 
functions.exists(_.isInstanceOf[SizeBasedWindowFunction])
    +    val trackPartitionSize = 
rewrittenFunctions.exists(_.isInstanceOf[SizeBasedWindowFunction])
    --- End diff --
    
    Minor: We could alo integrate this with rewriting if you don't mind side 
effects.


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

Reply via email to