cloud-fan commented on code in PR #42778:
URL: https://github.com/apache/spark/pull/42778#discussion_r1316894335
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/TransposeWindowSuite.scala:
##########
@@ -160,4 +160,38 @@ class TransposeWindowSuite extends PlanTest {
comparePlans(optimized, correctAnswer.analyze)
}
+ test("two windows with overlapping project/order by lists") {
+ // Parent orders by the window expression of the child, no reordering.
+ // Child plan is SELECT a, b, ROW_NUMBER() OVER (PARTITION BY a, b ORDER
BY a) as rn_child
+ val input = testRelation.analyze
+ val childPartitionFields = Seq(a, b)
+ val childOrderByFields = Seq(a.asc)
+ val windowFrame = SpecifiedWindowFrame(RowFrame, UnboundedPreceding,
CurrentRow)
+
+ val childRowNumber = WindowExpression(RowNumber(),
+ WindowSpecDefinition(childPartitionFields, childOrderByFields,
windowFrame))
+ val childRowNumberAlias = childRowNumber.as("rn_child")
+ val childRowNumberRef = childRowNumberAlias.toAttribute
+
+ val childWindow = Window(Seq(childRowNumberAlias) ++ childPartitionFields,
+ childPartitionFields, childOrderByFields, input)
Review Comment:
This is not a valid `Window` operator as `Window#windowExpressions` must be
`Alias(WindowExpression(...), ...)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]