Skip to content

Commit 04c0cc3

Browse files
committed
fix(query): fix join subquery scalar rewrite
1 parent 6cf665b commit 04c0cc3

File tree

1 file changed

+36
-0
lines changed
  • tests/sqllogictests/suites/tpcds

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
statement ok
2+
set sandbox_tenant = 'test_tenant';
3+
4+
statement ok
5+
use tpcds;
6+
7+
statement ok
8+
explain with /* TPC-DS query95.tpl 0.43 */ ws_wh as
9+
(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2
10+
from web_sales ws1,web_sales ws2
11+
where ws1.ws_order_number = ws2.ws_order_number
12+
and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk)
13+
select
14+
count(distinct ws_order_number) as "order count"
15+
,sum(ws_ext_ship_cost) as "total shipping cost"
16+
,sum(ws_net_profit) as "total net profit"
17+
from
18+
web_sales ws1
19+
,date_dim
20+
,customer_address
21+
,web_site
22+
where
23+
d_date between '2001-2-01' and -- with incorrect date string format
24+
date_add(day,60,cast('2001-2-01' as date))
25+
and ws1.ws_ship_date_sk = d_date_sk
26+
and ws1.ws_ship_addr_sk = ca_address_sk
27+
and ca_state = 'GA'
28+
and ws1.ws_web_site_sk = web_site_sk
29+
and web_company_name = 'pri'
30+
and ws1.ws_order_number in (select ws_order_number
31+
from ws_wh)
32+
and ws1.ws_order_number in (select wr_order_number
33+
from web_returns,ws_wh
34+
where wr_order_number = ws_wh.ws_order_number)
35+
order by count(distinct ws_order_number)
36+
limit 100;

0 commit comments

Comments
 (0)