-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: HashJoin panic with String dictionary keys (don't flatten keys)
#20505
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -737,3 +737,108 @@ DROP TABLE t_union_mem; | |
|
|
||
| statement ok | ||
| DROP TABLE t_union_parquet; | ||
|
|
||
| # Cleanup settings | ||
| statement ok | ||
| set datafusion.optimizer.max_passes = 3; | ||
|
|
||
| statement ok | ||
| set datafusion.execution.parquet.pushdown_filters = false; | ||
|
|
||
|
|
||
| # Regression test for https://github.com/apache/datafusion/issues/20696 | ||
| # Multi-column INNER JOIN with dictionary fails | ||
| # when parquet pushdown filters are enabled. | ||
|
|
||
|
|
||
| statement ok | ||
| COPY ( | ||
| SELECT | ||
| to_timestamp_nanos(time_ns) AS time, | ||
| arrow_cast(state, 'Dictionary(Int32, Utf8)') AS state, | ||
| arrow_cast(city, 'Dictionary(Int32, Utf8)') AS city, | ||
| temp | ||
| FROM ( | ||
| VALUES | ||
| (200, 'CA', 'LA', 90.0), | ||
| (250, 'MA', 'Boston', 72.4), | ||
| (100, 'MA', 'Boston', 70.4), | ||
| (350, 'CA', 'LA', 90.0) | ||
| ) AS t(time_ns, state, city, temp) | ||
| ) | ||
| TO 'test_files/scratch/parquet_filter_pushdown/issue_20696/h2o/data.parquet'; | ||
|
|
||
| statement ok | ||
| COPY ( | ||
| SELECT | ||
| to_timestamp_nanos(time_ns) AS time, | ||
| arrow_cast(state, 'Dictionary(Int32, Utf8)') AS state, | ||
| arrow_cast(city, 'Dictionary(Int32, Utf8)') AS city, | ||
| temp, | ||
| reading | ||
| FROM ( | ||
| VALUES | ||
| (250, 'MA', 'Boston', 53.4, 51.0), | ||
| (100, 'MA', 'Boston', 50.4, 50.0) | ||
| ) AS t(time_ns, state, city, temp, reading) | ||
| ) | ||
| TO 'test_files/scratch/parquet_filter_pushdown/issue_20696/o2/data.parquet'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE h2o_parquet_20696 STORED AS PARQUET | ||
| LOCATION 'test_files/scratch/parquet_filter_pushdown/issue_20696/h2o/'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE o2_parquet_20696 STORED AS PARQUET | ||
| LOCATION 'test_files/scratch/parquet_filter_pushdown/issue_20696/o2/'; | ||
|
|
||
| # Query should work both with and without filters | ||
| statement ok | ||
| set datafusion.execution.parquet.pushdown_filters = false; | ||
|
|
||
| query RRR | ||
| SELECT | ||
| h2o_parquet_20696.temp AS h2o_temp, | ||
| o2_parquet_20696.temp AS o2_temp, | ||
| o2_parquet_20696.reading | ||
| FROM h2o_parquet_20696 | ||
| INNER JOIN o2_parquet_20696 | ||
| ON h2o_parquet_20696.time = o2_parquet_20696.time | ||
| AND h2o_parquet_20696.state = o2_parquet_20696.state | ||
| AND h2o_parquet_20696.city = o2_parquet_20696.city | ||
| WHERE h2o_parquet_20696.time >= '1970-01-01T00:00:00.000000050Z' | ||
| AND h2o_parquet_20696.time <= '1970-01-01T00:00:00.000000300Z'; | ||
| ---- | ||
| 72.4 53.4 51 | ||
| 70.4 50.4 50 | ||
|
|
||
|
|
||
| statement ok | ||
| set datafusion.execution.parquet.pushdown_filters = true; | ||
|
|
||
| query RRR | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test fails with Prior to this fix |
||
| SELECT | ||
| h2o_parquet_20696.temp AS h2o_temp, | ||
| o2_parquet_20696.temp AS o2_temp, | ||
| o2_parquet_20696.reading | ||
| FROM h2o_parquet_20696 | ||
| INNER JOIN o2_parquet_20696 | ||
| ON h2o_parquet_20696.time = o2_parquet_20696.time | ||
| AND h2o_parquet_20696.state = o2_parquet_20696.state | ||
| AND h2o_parquet_20696.city = o2_parquet_20696.city | ||
| WHERE h2o_parquet_20696.time >= '1970-01-01T00:00:00.000000050Z' | ||
| AND h2o_parquet_20696.time <= '1970-01-01T00:00:00.000000300Z'; | ||
| ---- | ||
| 72.4 53.4 51 | ||
| 70.4 50.4 50 | ||
|
|
||
| # Cleanup | ||
| statement ok | ||
| DROP TABLE h2o_parquet_20696; | ||
|
|
||
| statement ok | ||
| DROP TABLE o2_parquet_20696; | ||
|
|
||
| # Cleanup settings | ||
| statement ok | ||
| set datafusion.execution.parquet.pushdown_filters = false; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am quite pleased that the "fix" is to delete code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mark of a great engineer 😉