-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Add bloom filter metric to ParquetExec #8772
Merged
alamb
merged 8 commits into
apache:main
from
my-vegetable-has-exploded:metric-sbbf-tests
Jan 9, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
12ddbf5
sbbf metric for parquet.
my-vegetable-has-exploded 8831fad
fix tests.
my-vegetable-has-exploded 37f6c04
integration-test
my-vegetable-has-exploded 3e9aa57
fix clippy & tests
my-vegetable-has-exploded 8949858
fix clippy.
my-vegetable-has-exploded 8589075
add more comments
my-vegetable-has-exploded 76c200c
rename make_int32_range
my-vegetable-has-exploded ecfccdd
update metric name.
my-vegetable-has-exploded 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
//! expected. | ||
use datafusion::prelude::SessionConfig; | ||
use datafusion_common::ScalarValue; | ||
use itertools::Itertools; | ||
|
||
use crate::parquet::Unit::RowGroup; | ||
use crate::parquet::{ContextWithParquet, Scenario}; | ||
|
@@ -48,6 +49,38 @@ async fn test_prune( | |
); | ||
} | ||
|
||
/// check row group pruning by bloom filter and statistics independently | ||
async fn test_prune_verbose( | ||
case_data_type: Scenario, | ||
sql: &str, | ||
expected_errors: Option<usize>, | ||
expected_row_group_pruned_sbbf: Option<usize>, | ||
expected_row_group_pruned_statistics: Option<usize>, | ||
expected_results: usize, | ||
) { | ||
let output = ContextWithParquet::new(case_data_type, RowGroup) | ||
.await | ||
.query(sql) | ||
.await; | ||
|
||
println!("{}", output.description()); | ||
assert_eq!(output.predicate_evaluation_errors(), expected_errors); | ||
assert_eq!( | ||
output.row_groups_pruned_bloom_filter(), | ||
expected_row_group_pruned_sbbf | ||
); | ||
assert_eq!( | ||
output.row_groups_pruned_statistics(), | ||
expected_row_group_pruned_statistics | ||
); | ||
assert_eq!( | ||
output.result_rows, | ||
expected_results, | ||
"{}", | ||
output.description() | ||
); | ||
} | ||
|
||
#[tokio::test] | ||
async fn prune_timestamps_nanos() { | ||
test_prune( | ||
|
@@ -336,16 +369,38 @@ async fn prune_int32_eq_in_list() { | |
#[tokio::test] | ||
async fn prune_int32_eq_in_list_2() { | ||
// result of sql "SELECT * FROM t where in (1000)", prune all | ||
test_prune( | ||
// test whether statistics works | ||
test_prune_verbose( | ||
Scenario::Int32, | ||
"SELECT * FROM t where i in (1000)", | ||
Some(0), | ||
Some(0), | ||
Some(4), | ||
0, | ||
) | ||
.await; | ||
} | ||
|
||
#[tokio::test] | ||
async fn prune_int32_eq_large_in_list() { | ||
// result of sql "SELECT * FROM t where i in (2050...2582)", prune all | ||
// test whether sbbf works | ||
test_prune_verbose( | ||
Scenario::Int32Range, | ||
format!( | ||
"SELECT * FROM t where i in ({})", | ||
(200050..200082).join(",") | ||
) | ||
.as_str(), | ||
Some(0), | ||
Some(1), | ||
// we don't support pruning by statistics for in_list with more than 20 elements currently | ||
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. Also I think it the pruning by bloom filters happens first, so it may not even try to prune by statistics 👍 |
||
Some(0), | ||
0, | ||
) | ||
.await; | ||
} | ||
|
||
#[tokio::test] | ||
async fn prune_int32_eq_in_list_negated() { | ||
// result of sql "SELECT * FROM t where not in (1)" prune nothing | ||
|
This file contains 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 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 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
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.
this is a neat idea to display guarantees 👍