wangyum commented on a change in pull request #33509:
URL: https://github.com/apache/spark/pull/33509#discussion_r680947369



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
##########
@@ -1876,4 +1877,29 @@ class SubquerySuite extends QueryTest with 
SharedSparkSession with AdaptiveSpark
         "ReusedSubqueryExec should reuse an existing subquery")
     }
   }
+
+  test("SPARK-36280: Remove redundant aliases after RewritePredicateSubquery") 
{
+    sql("CREATE TABLE t1 USING parquet AS SELECT id AS a, id AS b, id AS c 
FROM range(10)")
+    sql("CREATE TABLE t2 USING parquet AS SELECT id AS x, id AS y FROM 
range(8)")
+    val df = sql(
+      """
+        |SELECT *
+        |FROM   t1
+        |WHERE  a IN (SELECT x
+        |             FROM   (SELECT x                         AS x,
+        |                            Rank()
+        |                              OVER (
+        |                                PARTITION BY x
+        |                                ORDER BY Sum(y) DESC) AS ranking
+        |                     FROM   t2
+        |                     GROUP  BY x) tmp1
+        |             WHERE  ranking <= 5)

Review comment:
       I have used this tool for many years. or do you have a recommended tool?




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