Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming: TPC-H Q19 #497

Closed
lmatz opened this issue Jan 28, 2022 · 1 comment · Fixed by #666
Closed

Streaming: TPC-H Q19 #497

lmatz opened this issue Jan 28, 2022 · 1 comment · Fixed by #666

Comments

@lmatz
Copy link
Contributor

lmatz commented Jan 28, 2022

Query:

create materialized view tpch_q19 as
select
	sum(l_extendedprice* (1 - l_discount)) as revenue
from
	lineitem,
	part
where
	(
		p_partkey = l_partkey
		and p_brand = 'Brand#52'
		and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
		and l_quantity >= 1 and l_quantity <= 11
		and p_size between 1 and 5
		and l_shipmode in ('AIR', 'AIR REG')
		and l_shipinstruct = 'DELIVER IN PERSON'
	)
	or
	(
		p_partkey = l_partkey
		and p_brand = 'Brand#24'
		and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
		and l_quantity >= 30 and l_quantity <= 40
		and p_size between 1 and 10
		and l_shipmode in ('AIR', 'AIR REG')
		and l_shipinstruct = 'DELIVER IN PERSON'
	)
	or
	(
		p_partkey = l_partkey
		and p_brand = 'Brand#32'
		and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
		and l_quantity >= 10 and l_quantity <= 20
		and p_size between 1 and 15
		and l_shipmode in ('AIR', 'AIR REG')
		and l_shipinstruct = 'DELIVER IN PERSON'
	);
@lmatz
Copy link
Contributor Author

lmatz commented Feb 23, 2022

Missing conversion is RwLogicalJoin[convention: RisingWave Logical -> RisingWave Streaming Plan]
There is 1 empty subset: rel#163659:RelSubset#14.RisingWave Streaming Plan.[].RwDistributionTrait{type=ANY, keys=[]}, the relevant part of the original plan is as follows
163633:RwLogicalJoin(condition=[OR(AND(=($10, $0), $11, $12, $2, $3, $13, $4, $5), AND(=($10, $0), $14, $15, $6, $7, $16, $4, $5), AND(=($10, $0), $17, $18, $8, $9, $19, $4, $5))], joinType=[inner])

Can this be rewritten into using Union, possibly duplicates?

The optimizer may not realize that the conditions are mutually exclusive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant