Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/12040#discussion_r58125114
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/Window.scala ---
@@ -920,7 +931,7 @@ private[execution] object AggregateProcessor {
// Create the projections.
val initialProjection = newMutableProjection(
initialValues,
- Seq(SizeBasedWindowFunction.n))()
+ Seq(partitionSize))()
--- End diff --
OK. Thanks! How about we add comment to explain this. This logic is not
very easy to understand. Because in most of cases (when
`trackPartitionSize=false`), we do not need to bind when we set initial values
(because most of them will be constant values), we just put partitionSize at
here.
So, the logical is actually the following, right?
```
val initialProjection =
if (trackPartitionSize) {
newMutableProjection(initialValues, Seq(partitionSize))()
} else {
newMutableProjection(initialValues, Seq())()
}
```
---
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]