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

Push down more predicates into ParquetExec #4279

Merged
merged 1 commit into from
Nov 21, 2022

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Nov 18, 2022

Draft as it builds on

Which issue does this PR close?

Closes #4020

connects to #3463

I suggest viewing with whitespace blind diff to see the differences clearly: https://github.com/apache/arrow-datafusion/pull/4279/files?w=1

Rationale for this change

Pruning predicates are for eliminating row groups or pages based on min/max values. Only some predicates can be converted into Pruning Predicates.

Filter predicates are evaluated directly on decoded values during the scan.

However, the only predicates that the parquet exec will attempt to push down as filter predicate are the predicates that can be made into pruning predicates. It should attempt to push down all of them.

What changes are included in this PR?

Pass entire pushed down predicate (not just the one attached to pruning predicate)

Are these changes tested?

Yes

Are there any user-facing changes?

More predicates can be pushed as row filters

@github-actions github-actions bot added the core Core DataFusion crate label Nov 18, 2022
@alamb alamb changed the title Push down more predicates into parquet exec Push down more predicates into ParquetExec Nov 18, 2022
@alamb alamb changed the title Push down more predicates into ParquetExec Push down more predicates into ParquetExec Nov 18, 2022
@alamb alamb force-pushed the alamb/push_all_the_predicates branch 2 times, most recently from a31928f to fa1e18d Compare November 18, 2022 13:43
@@ -284,6 +288,7 @@ impl ExecutionPlan for ParquetExec {
partition_index,
projection: Arc::from(projection),
batch_size: ctx.session_config().batch_size(),
predicate: self.predicate.clone(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like all the cloning -- I have a follow on PR (#4283) to stop the copying

@alamb alamb force-pushed the alamb/push_all_the_predicates branch from fa1e18d to ec6de25 Compare November 18, 2022 16:20
@@ -98,6 +100,7 @@ impl ParquetExec {
MetricBuilder::new(&metrics).global_counter("num_predicate_creation_errors");

let pruning_predicate = predicate
.clone()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the key difference here is that the original predicate is kept, even if the creation of the pruning predicate fails

@@ -312,6 +317,12 @@ impl ExecutionPlan for ParquetExec {
) -> std::fmt::Result {
match t {
DisplayFormatType::Default => {
let predicate_string = self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The predicate is now explicitly shown as well in EXPLAIN (as it is difference)

@alamb alamb marked this pull request as ready for review November 18, 2022 16:22
@@ -1564,6 +1575,9 @@ mod tests {
&display,
"pruning_predicate=c1_min@0 != bar OR bar != c1_max@1"
);

assert_contains!(&display, r#"predicate=c1 != Utf8("bar")"#);
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@Ted-Jiang Ted-Jiang left a comment

Choose a reason for hiding this comment

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

@alamb Thanks for solving this!

@alamb alamb merged commit afe2333 into apache:master Nov 21, 2022
@alamb alamb deleted the alamb/push_all_the_predicates branch November 21, 2022 17:24
@ursabot
Copy link

ursabot commented Nov 21, 2022

Benchmark runs are scheduled for baseline = bcd6248 and contender = afe2333. afe2333 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

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

Successfully merging this pull request may close these issues.

Simplify Pushed Down Predicates
4 participants