File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -1657,16 +1657,12 @@ class Analyzer(
16571657
16581658 // Third, for every Window Spec, we add a Window operator and set currentChild as the
16591659 // child of it.
1660- var currentChild = child
1661- groupedWindowExpressions.foreach { case ((partitionSpec, orderSpec), windowExpressions) =>
1662- // Set currentChild to the newly created Window operator.
1663- currentChild =
1664- Window (
1665- windowExpressions,
1666- partitionSpec,
1667- orderSpec,
1668- currentChild)
1669- }
1660+ val currentChild =
1661+ groupedWindowExpressions.foldLeft(child) {
1662+ case (last, ((partitionSpec, orderSpec), windowExpressions)) =>
1663+ // Set currentChild to the newly created Window operator.
1664+ Window (windowExpressions, partitionSpec, orderSpec, last)
1665+ }
16701666
16711667 // Finally, we create a Project to output currentChild's output
16721668 // newExpressionsWithWindowFunctions.
You can’t perform that action at this time.
0 commit comments