cloud-fan commented on code in PR #42778:
URL: https://github.com/apache/spark/pull/42778#discussion_r1317021295


##########
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:
   After reading the code more, the window query plan does support a project 
list, although we only use window expressions as the project list in `Window`.
   
   The only exception is `DecorrelateInnerQuery`. The newly added code for 
window decorrelation will add attributes to `Window#windowExpressions`. Shall 
we fix it instead of making general projectList work properly in Window?



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

Reply via email to