ulysses-you commented on a change in pull request #30368:
URL: https://github.com/apache/spark/pull/30368#discussion_r523656874
##########
File path:
sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q92/explain.txt
##########
@@ -1,5 +1,5 @@
== Physical Plan ==
-TakeOrderedAndProject (34)
+* Sort (34)
Review 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` ?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]