Skip to content

Commit cb536a4

Browse files
committed
Address comment
1 parent 996e292 commit cb536a4

File tree

1 file changed

+6
-10
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis

1 file changed

+6
-10
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)