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

Add query 19 to TPC-H regression tests #59

Merged
merged 1 commit into from
Apr 26, 2021
Merged

Conversation

Dandandan
Copy link
Contributor

@Dandandan Dandandan commented Apr 25, 2021

Which issue does this PR close?

Closes #58

Rationale for this change

The query failed before because of a missing cross join. The query runs now (but takes an almost infinite time to run because of the cross join, which probably is a bug or missing optimization somewhere in the planner).

What changes are included in this PR?

Add query 19 to TPC-H regression tests

Are there any user-facing changes?

No

@codecov-commenter
Copy link

Codecov Report

Merging #59 (23e601a) into master (fa99979) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #59   +/-   ##
=======================================
  Coverage   76.24%   76.25%           
=======================================
  Files         134      134           
  Lines       23051    23053    +2     
=======================================
+ Hits        17576    17578    +2     
  Misses       5475     5475           
Impacted Files Coverage Δ
benchmarks/src/bin/tpch.rs 35.43% <100.00%> (+0.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa99979...23e601a. Read the comment docs.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @Dandandan -- thanks.

In order to get Q19 to work, the optimizer needs to be clever enough to recognize that p_partkey = l_partkey which appears in each of the three clauses is a join predicate. The query shouldn't be doing a CROSS JOIN, it should be doing an INNER JOIN on p_partkey = l_partkey

Note this is Q19:

select
sum(l_extendedprice * (1 - l_discount) ) as revenue
from
lineitem,
part
where
(
p_partkey = l_partkey
and p_brand = ‘[BRAND1]’
and p_container in ( ‘SM CASE’, ‘SM BOX’, ‘SM PACK’, ‘SM PKG’)
and l_quantity >= [QUANTITY1] and l_quantity <= [QUANTITY1] + 10
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 = ‘[BRAND2]’
and p_container in (‘MED BAG’, ‘MED BOX’, ‘MED PKG’, ‘MED PACK’)
and l_quantity >= [QUANTITY2] and l_quantity <= [QUANTITY2] + 10
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 = ‘[BRAND3]’
and p_container in ( ‘LG CASE’, ‘LG BOX’, ‘LG PACK’, ‘LG PKG’)
and l_quantity >= [QUANTITY3] and l_quantity <= [QUANTITY3] + 10
and p_size between 1 and 15
and l_shipmode in (‘AIR’, ‘AIR REG’)
and l_shipinstruct = ‘DELIVER IN PERSON’
);

@alamb alamb merged commit 8380c5d into apache:master Apr 26, 2021
@jorgecarleitao jorgecarleitao mentioned this pull request Apr 27, 2021
@houqp houqp added ballista enhancement New feature or request labels Jul 29, 2021
alamb pushed a commit that referenced this pull request Nov 17, 2024
* Fix duckdb & sqlite character_length scalar unparsing (#59)

* Fix duckdb & sqlite character_length scalar unparsing

* Add comments

* Update CharacterLengthStyle::SQLStandard to CharacterLengthExtractStyle::CharacterLength

* Fix clippy error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TPC-H query 19 to regression test
4 participants