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/03/02 11:00:38 UTC

[GitHub] [spark] c21 opened a new pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

c21 opened a new pull request #31708:
URL: https://github.com/apache/spark/pull/31708


   <!--
   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'.
   -->
   
   ### 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.
   -->
   `BroadcastNestedLoopJoinExec` does not preserve `outputPartitioning` and `outputOrdering` right now. But it can preserve the streamed side partitioning and ordering when possible. This can help avoid shuffle and sort in later stage, if there's join and aggregation in the query. See example queries in added unit test in `JoinSuite.scala`.
   
   In addition, fix a bunch of minor places in `BroadcastNestedLoopJoinExec.scala` for better style and readability.
   
   ### 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.
   -->
   Avoid shuffle and sort for certain complicated query shape. Better query performance can be achieved.
   
   ### 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.
   -->
   Added unit test in `JoinSuite.scala`.


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

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] c21 commented on a change in pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastNestedLoopJoinExec.scala
##########
@@ -238,7 +250,6 @@ case class BroadcastNestedLoopJoinExec(
    *   ExistenceJoin with BuildLeft
    */
   private def defaultJoin(relation: Broadcast[Array[InternalRow]]): RDD[InternalRow] = {
-    /** All rows that either match both-way, or rows from streamed joined with nulls. */

Review comment:
       This comment is quite confusing for me, so delete here.
   I am not sure how this can make sense, given e.g. `FullOuter` join in this method, will contain rows match both-way, and rows from streamed AND build side with nulls. Not only streamed side.
   

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala
##########
@@ -1296,4 +1296,92 @@ class JoinSuite extends QueryTest with SharedSparkSession with AdaptiveSparkPlan
       }
     }
   }
+
+  test("SPARK-34593: Preserve broadcast nested loop join partitioning and ordering") {
+    withTable("t1", "t2", "t3", "t4", "t5") {
+      spark.range(15).toDF("k").write.bucketBy(4, "k").saveAsTable("t1")
+      spark.range(6).toDF("k").write.bucketBy(4, "k").saveAsTable("t2")
+      spark.range(8).toDF("k").write.saveAsTable("t3")
+      spark.range(9).toDF("k").write.saveAsTable("t4")
+      spark.range(11).toDF("k").write.saveAsTable("t5")
+
+      def getAggQuery(selectExpr: String, joinType: String): String = {
+        s"""
+           |SELECT k, COUNT(*)
+           |FROM (SELECT $selectExpr FROM t1 $joinType JOIN t2)
+           |GROUP BY k
+         """.stripMargin
+      }
+
+      // Test output partitioning is preserved
+      Seq("INNER", "LEFT OUTER", "RIGHT OUTER", "LEFT SEMI", "LEFT ANTI").foreach {
+        joinType =>
+          val selectExpr = if (joinType == "RIGHT OUTER") {
+            "/*+ BROADCAST(t1) */ t2.k AS k"
+          } else {
+            "/*+ BROADCAST(t2) */ t1.k as k"
+          }
+          val plan = sql(getAggQuery(selectExpr, joinType)).queryExecution.executedPlan
+          assert(collect(plan) { case _: BroadcastNestedLoopJoinExec => true }.size === 1)
+          // No extra shuffle before aggregation
+          assert(collect(plan) { case _: ShuffleExchangeExec => true }.size === 0)
+      }
+
+      // Test output partitioning is not preserved
+      Seq("LEFT OUTER", "RIGHT OUTER", "LEFT SEMI", "LEFT ANTI", "FULL OUTER").foreach {
+        joinType =>
+          val selectExpr = if (joinType == "RIGHT OUTER") {
+            "/*+ BROADCAST(t2) */ t1.k AS k"
+          } else {
+            "/*+ BROADCAST(t1) */ t1.k as k"
+          }
+          val plan = sql(getAggQuery(selectExpr, joinType)).queryExecution.executedPlan
+          assert(collect(plan) { case _: BroadcastNestedLoopJoinExec => true }.size === 1)
+          // Have shuffle before aggregation
+          assert(collect(plan) { case _: ShuffleExchangeExec => true }.size === 1)
+      }
+
+      def getJoinQuery(selectExpr: String, joinType: String): String = {
+        s"""
+           |SELECT /*+ MERGE(t3) */ t3.k
+           |FROM
+           |(
+           |  SELECT $selectExpr
+           |  FROM
+           |    (SELECT /*+ MERGE(t4) */ t1.k AS k1 FROM t1 JOIN t4 ON t1.k = t4.k) AS left_t
+           |  $joinType JOIN
+           |    (SELECT /*+ MERGE(t5) */ t2.k AS k2 FROM t2 JOIN t5 ON t2.k = t5.k) AS right_t
+           |)
+           |JOIN t3
+           |ON t3.k = k0
+         """.stripMargin
+      }
+
+      // Test output ordering is preserved
+      Seq("INNER", "LEFT OUTER", "RIGHT OUTER", "LEFT SEMI", "LEFT ANTI").foreach {
+        joinType =>
+          val selectExpr = if (joinType == "RIGHT OUTER") {
+            "/*+ BROADCAST(left_t) */ k2 AS k0"
+          } else {
+            "/*+ BROADCAST(right_t) */ k1 as k0"
+          }
+          val plan = sql(getJoinQuery(selectExpr, joinType)).queryExecution.executedPlan
+          assert(collect(plan) { case _: BroadcastNestedLoopJoinExec => true }.size === 1)
+          assert(collect(plan) { case _: SortMergeJoinExec => true }.size === 3)
+          // No extra sort on left side before last sort merge join
+          assert(collect(plan) { case _: SortExec => true }.size === 5)
+      }
+
+      // Test output ordering is not preserved
+      Seq("LEFT OUTER", "FULL OUTER").foreach {

Review comment:
       Test for `RIGHT OUTER`, `LEFT SEMI`, `LEFT ANTI` is omitted here, as I cannot reproduce a valid test case. The broadcast nested loop join always changes the join type to `INNER` join, or reorder somehow. I think there's some optimization rule are taking effect.




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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   **[Test build #135682 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135682/testReport)** for PR 31708 at commit [`9e6729c`](https://github.com/apache/spark/commit/9e6729cc89ac05f6842d335e7ac59fb765a827db).
    * 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.

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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] c21 commented on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   I am fine if we want to start with a subset of operators. Though I feel if the output is sorted on alphabetical order of operator name, it should be easy to pin-point the difference. Create SPARK-34602 for followup, thanks.


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   ALL physical operators may be too many and make the result hard to read. We can define some important ones. What in my mind is: (reused) shuffle, (reused) broadcast, (reused) subqueries, sort/hash/object aggregate, scans.


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   **[Test build #135649 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135649/testReport)** for PR 31708 at commit [`2cb7080`](https://github.com/apache/spark/commit/2cb7080915641fc807bd3ed19cfda94f5516b184).
    * 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.

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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] c21 commented on a change in pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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



##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q61.sf100/simplified.txt
##########
@@ -1,107 +1,104 @@
-WholeStageCodegen (17)
+WholeStageCodegen (16)
   Sort [promotions,total]
-    InputAdapter
-      Exchange [promotions,total] #1

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q61/explain.txt
##########
@@ -1,77 +1,76 @@
 == Physical Plan ==
-* Sort (73)
-+- Exchange (72)

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q90/simplified.txt
##########
@@ -1,79 +1,76 @@
-WholeStageCodegen (12)
+WholeStageCodegen (11)
   Sort [am_pm_ratio]
-    InputAdapter
-      Exchange [am_pm_ratio] #1

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q61/simplified.txt
##########
@@ -1,111 +1,108 @@
-WholeStageCodegen (17)
+WholeStageCodegen (16)
   Sort [promotions,total]
-    InputAdapter
-      Exchange [promotions,total] #1

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q61.sf100/explain.txt
##########
@@ -1,74 +1,73 @@
 == Physical Plan ==
-* Sort (70)
-+- Exchange (69)

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q90.sf100/explain.txt
##########
@@ -1,57 +1,56 @@
 == Physical Plan ==
-* Sort (53)
-+- Exchange (52)

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q90.sf100/simplified.txt
##########
@@ -1,79 +1,76 @@
-WholeStageCodegen (12)
+WholeStageCodegen (11)
   Sort [am_pm_ratio]
-    InputAdapter
-      Exchange [am_pm_ratio] #1

Review comment:
       This `Exchange` is the only difference.

##########
File path: sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q90/explain.txt
##########
@@ -1,57 +1,56 @@
 == Physical Plan ==
-* Sort (53)
-+- Exchange (52)

Review comment:
       This `Exchange` is the only difference.




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

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] c21 edited a comment on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

Posted by GitBox <gi...@apache.org>.
c21 edited a comment on pull request #31708:
URL: https://github.com/apache/spark/pull/31708#issuecomment-789474307


   @cloud-fan - thanks for review.
   
   > Can you help to improve the test framework to include the number of shuffles, reused shuffles, subqueries, and reused subqueries in the golden files?
   
   Sure. I agree this it, and I also found plan check during test failure is quite hard for complicated query. I am actually thinking to add information for ALL physical operators.
   
   The added content like:
   
   ```
   Total number of operators: 6
   HashAggregate: 3
   Exchange: 2
   Scan: 1
   ```
   
   WDYT?


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   **[Test build #135649 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135649/testReport)** for PR 31708 at commit [`2cb7080`](https://github.com/apache/spark/commit/2cb7080915641fc807bd3ed19cfda94f5516b184).


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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






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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   **[Test build #135682 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135682/testReport)** for PR 31708 at commit [`9e6729c`](https://github.com/apache/spark/commit/9e6729cc89ac05f6842d335e7ac59fb765a827db).


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   @c21 It's great to see this PR improves the TPCDS plans, but it also reveals that the plan change is hard to check sometime.
   
   Can you help to improve the test framework to include the number of shuffles, reused shuffles, subqueries, and reused subqueries in the golden files?


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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] c21 commented on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   It seems that this PR triggers plan change for two TPCDS queries. I am checking the root cause now.


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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






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

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] c21 commented on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   @cloud-fan - thanks for review.
   
   > Can you help to improve the test framework to include the number of shuffles, reused shuffles, subqueries, and reused subqueries in the golden files?
   
   Sure. I agree this it, and I also found plan check during test failure is quite hard for complicated query. I am actually thinking to add information for ALL physical operators.
   
   The added content like:
   
   ```
   Total number of operators: 5
   HashAggregate: 3
   Exchange: 2
   Scan: 1
   ```
   
   WDYT?


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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] c21 commented on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   cc @cloud-fan and @maropu if you can take a look when you have time, thanks.


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   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.

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] c21 commented on pull request #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   After checking, the plan change in TPCDS q61 and q90 are valid. The plan change is the outermost shuffle no longer existed.
   These two queries are doing a broadcast nested loop join, and then doing a `ORDER BY` (global sort). The shuffle with range partitioning is avoided because we are preserving join streamed side partitioning.
   
   Regenerated the golden files for these two queries' plans with
   
   ```
   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly *PlanStabilitySuite -- -z (tpcds-v1.4/q61)"
   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly *PlanStabilitySuite -- -z (tpcds-v1.4/q90)"
   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly *PlanStabilityWithStatsSuite -- -z (tpcds-v1.4/q61)"
   SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly *PlanStabilityWithStatsSuite -- -z (tpcds-v1.4/q90)"
   ```
   
   Did a micro benchmark on laptop (TPCDS with scale factor 10). Verified there is no performance regression for these two queries. Runtime reduction: q61 (4386ms to 4257ms), and q90 (764ms to 680ms). Given the eliminated shuffle only processing very small amount of data, the runtime reduction here might just be noise. But anyway we get a better query plan here.


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


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


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

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 #31708: [SPARK-34593][SQL] Preserve broadcast nested loop join partitioning and ordering

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


   **[Test build #135682 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/135682/testReport)** for PR 31708 at commit [`9e6729c`](https://github.com/apache/spark/commit/9e6729cc89ac05f6842d335e7ac59fb765a827db).


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

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