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


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/NormalizePlanSuite.scala:
##########
@@ -117,6 +119,176 @@ class NormalizePlanSuite extends SparkFunSuite with 
SQLConfHelper {
     assert(NormalizePlan(baselinePlan) == NormalizePlan(testPlan))
   }
 
+  test("Normalize ordering in a project list of an inner Project under Project 
and Filter") {
+    val baselinePlan =
+      LocalRelation($"col1".int, $"col2".string)
+        .select($"col1", $"col2")
+        .where($"col1" === 1)
+        .select($"col1")
+    val testPlan =
+      LocalRelation($"col1".int, $"col2".string)
+        .select($"col2", $"col1")
+        .where($"col1" === 1)
+        .select($"col1")
+
+    assert(baselinePlan != testPlan)
+    assert(NormalizePlan(baselinePlan) == NormalizePlan(testPlan))
+  }
+
+  test("SubqueryAlias resets normalizeProjectList flag for inner Project") {
+    // Project under SubqueryAlias should NOT be normalized even when above a 
Project.

Review Comment:
   Phrasing is inverted — the inner Project is *under* the SubqueryAlias (and 
under the outer Project), not above one.
   
   ```suggestion
       // Project under SubqueryAlias should NOT be normalized even when there 
is a Project above the SubqueryAlias.
   ```



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