You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/08/05 09:15:45 UTC

[GitHub] [spark] ulysses-you opened a new pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

ulysses-you opened a new pull request #33651:
URL: https://github.com/apache/spark/pull/33651


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   * override the maxRows method in `LogicalQueryStage`
   * unify the `EliminateLimits` with normal and AQE Optimizer
   * add a new rule `AQEEliminateLimits` in `AQEOptimizer`
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   In Ad-hoc scenario, we always add limit for the query if user have no special limit value, but not all limit is nesessary.
   
   With the power of AQE, we can eliminate limits using running statistics.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   no
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   add test


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893325734


   **[Test build #142084 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142084/testReport)** for PR 33651 at commit [`c076d76`](https://github.com/apache/spark/commit/c076d764e927c1821f740ccbc0f326fefbb40cf5).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894259433


   **[Test build #142162 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142162/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894120494


   **[Test build #142152 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142152/testReport)** for PR 33651 at commit [`e8f17a4`](https://github.com/apache/spark/commit/e8f17a4c1887a1489ffb1e62971ede6bffb3df26).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894116480


   **[Test build #142152 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142152/testReport)** for PR 33651 at commit [`e8f17a4`](https://github.com/apache/spark/commit/e8f17a4c1887a1489ffb1e62971ede6bffb3df26).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893965053


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46632/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894423724


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46675/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683919296



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2008,6 +2014,32 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-36424: Support eliminate limits in AQE Optimizer") {
+    withTempView("v") {
+      spark.sparkContext.parallelize(
+        (1 to 10).map(i => TestData(i, if (i > 2) "2" else i.toString)), 2)

Review comment:
       Actually I don't like use range here since it has output partitionging. If you don't mind I prefer use `parallelize`.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683369797



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEEliminateLimits.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.adaptive
+
+import org.apache.spark.sql.catalyst.optimizer.EliminateLimitsBase
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+
+/**
+ * This rule runs in the AQE optimizer:
+ * [[LogicalQueryStage]] override the maxRows, so we can use the maxRows of logic plan to decide
+ * if we can eliminate limits. And we check if [[LogicalQueryStage]] is materialized at stats,
+ * if it is not materialized the maxRows is none.
+ */
+object AQEEliminateLimits extends EliminateLimitsBase {

Review comment:
       what's the difference between this and `EliminateLimits`?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683912356



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/LogicalQueryStage.scala
##########
@@ -54,4 +54,6 @@ case class LogicalQueryStage(
     }
     physicalStats.getOrElse(logicalPlan.stats)
   }
+
+  override def maxRows: Option[Long] = stats.rowCount.map(_.min(Long.MaxValue).toLong)

Review comment:
       If there is other physical nodes above `QueryStageExec` the stats is not accurate. Seems the only node can exist here is aggregate, so the maxRows is still accurate.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893755678


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142101/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683812176



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEEliminateLimits.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.adaptive
+
+import org.apache.spark.sql.catalyst.optimizer.EliminateLimitsBase
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+
+/**
+ * This rule runs in the AQE optimizer:
+ * [[LogicalQueryStage]] override the maxRows, so we can use the maxRows of logic plan to decide
+ * if we can eliminate limits. And we check if [[LogicalQueryStage]] is materialized at stats,
+ * if it is not materialized the maxRows is none.
+ */
+object AQEEliminateLimits extends EliminateLimitsBase {

Review comment:
       yea, seems can reuse `EliminateLimits`?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683947320



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2008,6 +2014,32 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-36424: Support eliminate limits in AQE Optimizer") {
+    withTempView("v") {
+      spark.sparkContext.parallelize(
+        (1 to 10).map(i => TestData(i, if (i > 2) "2" else i.toString)), 2)
+        .toDF("c1", "c2").createOrReplaceTempView("v")
+
+      withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+        SQLConf.SHUFFLE_PARTITIONS.key -> "3") {
+        val (origin1, adaptive1) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin1).size == 1)
+        assert(findTopLevelLimit(adaptive1).isEmpty)
+
+        // eliminate limit through filter
+        val (origin2, adaptive2) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 HAVING sum(c1) > 1 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin2).size == 1)
+        assert(findTopLevelLimit(adaptive2).isEmpty)

Review comment:
       Hm? What this test wants to tell? Both queries have no top level limit after AQE?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893375642






-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894000249


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142117/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894162600


   **[Test build #142119 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142119/testReport)** for PR 33651 at commit [`180ef97`](https://github.com/apache/spark/commit/180ef97c038ccb0768f3dea162b45632b17ffdaf).
    * This patch **fails from timeout after a configured wait of `500m`**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683948307



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2008,6 +2014,32 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-36424: Support eliminate limits in AQE Optimizer") {
+    withTempView("v") {
+      spark.sparkContext.parallelize(
+        (1 to 10).map(i => TestData(i, if (i > 2) "2" else i.toString)), 2)
+        .toDF("c1", "c2").createOrReplaceTempView("v")
+
+      withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+        SQLConf.SHUFFLE_PARTITIONS.key -> "3") {
+        val (origin1, adaptive1) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin1).size == 1)
+        assert(findTopLevelLimit(adaptive1).isEmpty)
+
+        // eliminate limit through filter
+        val (origin2, adaptive2) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 HAVING sum(c1) > 1 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin2).size == 1)
+        assert(findTopLevelLimit(adaptive2).isEmpty)

Review comment:
       Oh, I see.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893375642






-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893940503


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46629/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894421442


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46675/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894611001


   **[Test build #142187 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142187/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893612713


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46614/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893323420


   cc @maropu  @cloud-fan @viirya @HyukjinKwon 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893547122


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46613/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893367100


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46595/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894279030


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46664/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894510112


   retest this please


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894621626


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46699/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893455314


   **[Test build #142084 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142084/testReport)** for PR 33651 at commit [`c076d76`](https://github.com/apache/spark/commit/c076d764e927c1821f740ccbc0f326fefbb40cf5).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `trait EliminateLimitsBase extends Rule[LogicalPlan] `


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894515049


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142178/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683548974



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -1639,24 +1639,30 @@ object PushPredicateThroughJoin extends Rule[LogicalPlan] with PredicateHelper {
  * 2. Combines two adjacent [[Limit]] operators into one, merging the
  *    expressions into one single expression.
  */
-object EliminateLimits extends Rule[LogicalPlan] {
+trait EliminateLimitsBase extends Rule[LogicalPlan] {
   private def canEliminate(limitExpr: Expression, child: LogicalPlan): Boolean = {
     limitExpr.foldable && child.maxRows.exists { _ <= limitExpr.eval().asInstanceOf[Int] }
   }
 
-  def apply(plan: LogicalPlan): LogicalPlan = plan.transformDownWithPruning(
-    _.containsPattern(LIMIT), ruleId) {
+  def commonApplyFunc: PartialFunction[LogicalPlan, LogicalPlan] = {
     case Limit(l, child) if canEliminate(l, child) =>
       child
     case GlobalLimit(l, child) if canEliminate(l, child) =>
       child
 
     case GlobalLimit(le, GlobalLimit(ne, grandChild)) =>
-      GlobalLimit(Least(Seq(ne, le)), grandChild)
+      GlobalLimit(Literal(Least(Seq(ne, le)).eval().asInstanceOf[Int]), grandChild)

Review comment:
       It's flaky that this expression highly depend on `ConstantFolding`.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894209489


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142130/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893547096


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46613/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894609902


   retest this please


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894243067


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46664/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893537562


   **[Test build #142101 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142101/testReport)** for PR 33651 at commit [`8aae958`](https://github.com/apache/spark/commit/8aae9580bc58511538a2d93d4f3edae935cb6ea4).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894639483


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142187/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683612927



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEEliminateLimits.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.adaptive
+
+import org.apache.spark.sql.catalyst.optimizer.EliminateLimitsBase
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+
+/**
+ * This rule runs in the AQE optimizer:
+ * [[LogicalQueryStage]] override the maxRows, so we can use the maxRows of logic plan to decide
+ * if we can eliminate limits. And we check if [[LogicalQueryStage]] is materialized at stats,
+ * if it is not materialized the maxRows is none.
+ */
+object AQEEliminateLimits extends EliminateLimitsBase {

Review comment:
       that's too minor to justify creating a new class




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893612713


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46614/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683919431



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/LogicalQueryStage.scala
##########
@@ -54,4 +54,6 @@ case class LogicalQueryStage(
     }
     physicalStats.getOrElse(logicalPlan.stats)
   }
+
+  override def maxRows: Option[Long] = stats.rowCount.map(_.min(Long.MaxValue).toLong)

Review comment:
       OK, cleaned the comment of `EliminateLimits `




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893977873


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46632/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893762785


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142102/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893325734


   **[Test build #142084 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142084/testReport)** for PR 33651 at commit [`c076d76`](https://github.com/apache/spark/commit/c076d764e927c1821f740ccbc0f326fefbb40cf5).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893755678


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142101/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893946704


   **[Test build #142119 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142119/testReport)** for PR 33651 at commit [`180ef97`](https://github.com/apache/spark/commit/180ef97c038ccb0768f3dea162b45632b17ffdaf).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893999009


   **[Test build #142117 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142117/testReport)** for PR 33651 at commit [`ba7c42a`](https://github.com/apache/spark/commit/ba7c42a21ecab5428fee344ca61440ec8326e789).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893343557


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46592/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894639483


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142187/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893541984


   **[Test build #142102 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142102/testReport)** for PR 33651 at commit [`4510816`](https://github.com/apache/spark/commit/451081617277aef26aefd60e3aae014975562790).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894327623


   **[Test build #142162 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142162/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894012650


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46642/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894328410


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142162/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893920693


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46629/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894619835


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46699/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894020211


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46642/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893456102


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142084/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894266772


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46664/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894162891


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142119/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894020211


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46642/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894116480


   **[Test build #142152 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142152/testReport)** for PR 33651 at commit [`e8f17a4`](https://github.com/apache/spark/commit/e8f17a4c1887a1489ffb1e62971ede6bffb3df26).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894639278


   **[Test build #142187 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142187/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683916185



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/LogicalQueryStage.scala
##########
@@ -54,4 +54,6 @@ case class LogicalQueryStage(
     }
     physicalStats.getOrElse(logicalPlan.stats)
   }
+
+  override def maxRows: Option[Long] = stats.rowCount.map(_.min(Long.MaxValue).toLong)

Review comment:
       We should trust the existing framework. If the `maxRows` stats can be wrong, then `EliminateLimits` is also wrong even without AQE.
   
   I don't think we need to highlight `LogicalQueryStage` in the doc of `EliminateLimits`. We just need to follow the existing framework and make sure the `maxRows` is not under-estimated.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893762785


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142102/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894209489


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142130/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683850786



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEEliminateLimits.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.adaptive
+
+import org.apache.spark.sql.catalyst.optimizer.EliminateLimitsBase
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+
+/**
+ * This rule runs in the AQE optimizer:
+ * [[LogicalQueryStage]] override the maxRows, so we can use the maxRows of logic plan to decide
+ * if we can eliminate limits. And we check if [[LogicalQueryStage]] is materialized at stats,
+ * if it is not materialized the maxRows is none.
+ */
+object AQEEliminateLimits extends EliminateLimitsBase {

Review comment:
       OK, I'm fine to reuse the `EliminateLimits `




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683947320



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2008,6 +2014,32 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-36424: Support eliminate limits in AQE Optimizer") {
+    withTempView("v") {
+      spark.sparkContext.parallelize(
+        (1 to 10).map(i => TestData(i, if (i > 2) "2" else i.toString)), 2)
+        .toDF("c1", "c2").createOrReplaceTempView("v")
+
+      withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+        SQLConf.SHUFFLE_PARTITIONS.key -> "3") {
+        val (origin1, adaptive1) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin1).size == 1)
+        assert(findTopLevelLimit(adaptive1).isEmpty)
+
+        // eliminate limit through filter
+        val (origin2, adaptive2) = runAdaptiveAndVerifyResult(
+          """
+            |SELECT c2, sum(c1) FROM v GROUP BY c2 HAVING sum(c1) > 1 LIMIT 5
+          """.stripMargin)
+        assert(findTopLevelLimit(origin2).size == 1)
+        assert(findTopLevelLimit(adaptive2).isEmpty)

Review comment:
       Hm? What this test wants to tell? Both queries have no top level limit after AQE.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894259433


   **[Test build #142162 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142162/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683518146



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEEliminateLimits.scala
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.adaptive
+
+import org.apache.spark.sql.catalyst.optimizer.EliminateLimitsBase
+import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
+
+/**
+ * This rule runs in the AQE optimizer:
+ * [[LogicalQueryStage]] override the maxRows, so we can use the maxRows of logic plan to decide
+ * if we can eliminate limits. And we check if [[LogicalQueryStage]] is materialized at stats,
+ * if it is not materialized the maxRows is none.
+ */
+object AQEEliminateLimits extends EliminateLimitsBase {

Review comment:
       They are same. Just consider we don't need transformDownWithPruning in AQE Optimizer since it's batch only run once.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893537562


   **[Test build #142101 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142101/testReport)** for PR 33651 at commit [`8aae958`](https://github.com/apache/spark/commit/8aae9580bc58511538a2d93d4f3edae935cb6ea4).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894621626


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46699/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894162891


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142119/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893303558


   **[Test build #142082 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142082/testReport)** for PR 33651 at commit [`4299af5`](https://github.com/apache/spark/commit/4299af50eb6e0a015a068feea3f99e0bf509cfa0).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893999199


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46642/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #33651:
URL: https://github.com/apache/spark/pull/33651


   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893323420


   cc @maropu  @cloud-fan @viirya @HyukjinKwon 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893945066


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46629/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894516249


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46690/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894279030


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46664/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894328410


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142162/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893603513


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46614/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893741515


   **[Test build #142101 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142101/testReport)** for PR 33651 at commit [`8aae958`](https://github.com/apache/spark/commit/8aae9580bc58511538a2d93d4f3edae935cb6ea4).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893945066


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46629/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893981750


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46632/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-895054497


   thanks, merging to master!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893303558






-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893901647


   **[Test build #142117 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142117/testReport)** for PR 33651 at commit [`ba7c42a`](https://github.com/apache/spark/commit/ba7c42a21ecab5428fee344ca61440ec8326e789).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893972893


   **[Test build #142130 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142130/testReport)** for PR 33651 at commit [`e8f17a4`](https://github.com/apache/spark/commit/e8f17a4c1887a1489ffb1e62971ede6bffb3df26).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893456102


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142084/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893981750


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46632/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] ulysses-you commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894103283


   retest this please


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894389859


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46675/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894614675


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46699/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893393617






-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894120535


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142152/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894516249


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46690/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #33651:
URL: https://github.com/apache/spark/pull/33651#discussion_r683916410



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2008,6 +2014,32 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-36424: Support eliminate limits in AQE Optimizer") {
+    withTempView("v") {
+      spark.sparkContext.parallelize(
+        (1 to 10).map(i => TestData(i, if (i > 2) "2" else i.toString)), 2)

Review comment:
       we can use `spark.range` if you just want to control the number of partitions.




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893761501


   **[Test build #142102 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142102/testReport)** for PR 33651 at commit [`4510816`](https://github.com/apache/spark/commit/451081617277aef26aefd60e3aae014975562790).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893303558


   **[Test build #142082 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142082/testReport)** for PR 33651 at commit [`4299af5`](https://github.com/apache/spark/commit/4299af50eb6e0a015a068feea3f99e0bf509cfa0).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893547122


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46613/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893946704


   **[Test build #142119 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142119/testReport)** for PR 33651 at commit [`180ef97`](https://github.com/apache/spark/commit/180ef97c038ccb0768f3dea162b45632b17ffdaf).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893901647


   **[Test build #142117 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142117/testReport)** for PR 33651 at commit [`ba7c42a`](https://github.com/apache/spark/commit/ba7c42a21ecab5428fee344ca61440ec8326e789).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894515049


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142178/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894000249


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142117/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894120535


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/142152/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893575335


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46614/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894611001


   **[Test build #142187 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142187/testReport)** for PR 33651 at commit [`6f28a37`](https://github.com/apache/spark/commit/6f28a37f420f781486c3e8c102156e02d9f830d7).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-894423724


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46675/
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #33651: [SPARK-36424][SQL] Support eliminate limits in AQE Optimizer

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33651:
URL: https://github.com/apache/spark/pull/33651#issuecomment-893541984


   **[Test build #142102 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/142102/testReport)** for PR 33651 at commit [`4510816`](https://github.com/apache/spark/commit/451081617277aef26aefd60e3aae014975562790).


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org