Uh oh!
There was an error while loading. Please reload this page.
[SPARK-33442][SQL] Change Combine Limit to Eliminate limit using max row - #30368
[SPARK-33442][SQL] Change Combine Limit to Eliminate limit using max row#30368ulysses-you wants to merge 17 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 13, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 13, 2020
Test build #131054 has finished for PR 30368 at commit
|
SparkQA
commented
Nov 13, 2020
Kubernetes integration test status failure |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 13, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 13, 2020
Kubernetes integration test status failure |
SparkQA
commented
Nov 13, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 13, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 13, 2020
Test build #131066 has finished for PR 30368 at commit
|
SparkQA
commented
Nov 13, 2020
Test build #131068 has finished for PR 30368 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 14, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 14, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 14, 2020
Test build #131092 has finished for PR 30368 at commit
|
| @@ -1,5 +1,5 @@ | |||
| == Physical Plan == | |||
| TakeOrderedAndProject (34) | |||
| * Sort (34) | |||
There was a problem hiding this comment.
It changes from TakeOrderedAndProject to Sort seems because Limit after Sort is removed?
It might have additional shuffle for global Sort.
There was a problem hiding this comment.
This q92 sql:
SELECT sum(ws_ext_discount_amt) AS `Excess Discount Amount `
FROM web_sales, item, date_dim
WHERE i_manufact_id = 350
AND i_item_sk = ws_item_sk
AND d_date BETWEEN '2000-01-27' AND (cast('2000-01-27' AS DATE) + INTERVAL 90 days)
AND d_date_sk = ws_sold_date_sk
AND ws_ext_discount_amt >
(
SELECT 1.3 * avg(ws_ext_discount_amt)
FROM web_sales, date_dim
WHERE ws_item_sk = i_item_sk
AND d_date BETWEEN '2000-01-27' AND (cast('2000-01-27' AS DATE) + INTERVAL 90 days)
AND d_date_sk = ws_sold_date_sk
)
ORDER BY sum(ws_ext_discount_amt)
LIMIT 100
yes, Limit after Sort is a special case, we will convert to TakeOrderedAndProject, but it seems not necessary to do both sort and limit if child maxRow == 1. Maybe we can do an another check seems like if sort.child.maxRow <= 1 then remove sort ?
There was a problem hiding this comment.
Other thought, we can add this pattern
case sort @ Sort(order, true, child)
if sort.maxRow < conf.topKSortFallbackThreshold =>
TakeOrderedAndProjectExec()
In this way, we can infer the TakeOrderedAndProjectExec from Sort which has not Limit after.
What do you think about this? @maropu@viirya@cloud-fan
There was a problem hiding this comment.
Ah, @viirya , nice catch! Yea, how about simply excluding the case in the EliminateLimits rule? @ulysses-you
SparkQA
commented
Nov 15, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 15, 2020
Kubernetes integration test status failure |
SparkQA
commented
Nov 15, 2020
Test build #131104 has finished for PR 30368 at commit
|
SparkQA
commented
Nov 16, 2020
Test build #131160 has finished for PR 30368 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 16, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 16, 2020
Kubernetes integration test status failure |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 17, 2020
Test build #131182 has finished for PR 30368 at commit
|
SparkQA
commented
Nov 17, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test status failure |
SparkQA
commented
Nov 17, 2020
Test build #131199 has finished for PR 30368 at commit
|
SparkQA
commented
Nov 17, 2020
Test build #131197 has finished for PR 30368 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 17, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 17, 2020
Kubernetes integration test status success |
SparkQA
commented
Nov 17, 2020
Test build #131225 has finished for PR 30368 at commit
|
cloud-fan
commented
Nov 18, 2020
Hi @ulysses-you , can you put the conclusion of #30368 (comment) in PR description, to mention that we may end up replacing |
ulysses-you
commented
Nov 19, 2020
@cloud-fan updated the description. |
cloud-fan
commented
Nov 19, 2020
thanks, merging to master! |
ulysses-you
commented
Nov 20, 2020
thanks for merging! |
What changes were proposed in this pull request?
Change
CombineLimitsname toEliminateLimitsand add check ifLimitchild max row <= limit.Why are the changes needed?
In Add-hoc scene, we always add limit for the query if user have no special limit value, but not all limit is nesessary.
A general negative example is
It will be great if we can eliminate limit at Spark side.
Also, we make a benchmark for this case
and the result is
It shows that it makes sense to replace
TakeOrderedAndProjectExecwithSort + Project.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Add test.