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

Refactor: move RowGroupPredicateBuilder into its own module, rename to PruningPredicateBuilder #365

Merged
merged 5 commits into from
May 20, 2021

Conversation

alamb
Copy link
Contributor

@alamb alamb commented May 19, 2021

Which issue does this PR close?

Part of #363

Rationale for this change

As explained on #363 the high level idea goal is to make the parquet row group pruning logic generic to any types of min/max statistics (not just parquet metadata)

What changes are included in this PR?

  1. Move code out of parquet.rs and into its own module
  2. Rename to StatsPredicateBuilder to reflect its purpose

No changes in functionality are intended

The PR contains two commits to help reviewers

Are there any user-facing changes?

The pub struct RowGroupPredicateBuilder struct was renamed

@alamb alamb added datafusion Changes in the datafusion crate api change Changes the API exposed to users of the crate labels May 19, 2021
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2021

Codecov Report

Merging #365 (2c6a23b) into master (5c5a0bb) will increase coverage by 0.02%.
The diff coverage is 90.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
+ Coverage   75.86%   75.89%   +0.02%     
==========================================
  Files         143      144       +1     
  Lines       23758    23771      +13     
==========================================
+ Hits        18025    18040      +15     
+ Misses       5733     5731       -2     
Impacted Files Coverage Δ
datafusion/src/physical_plan/parquet.rs 81.26% <71.42%> (-4.53%) ⬇️
datafusion/src/physical_optimizer/pruning.rs 90.61% <90.61%> (ø)
datafusion/src/physical_plan/mod.rs 84.70% <0.00%> (-2.36%) ⬇️
datafusion/tests/sql.rs 99.89% <0.00%> (+<0.01%) ⬆️
datafusion/src/physical_plan/hash_join.rs 86.05% <0.00%> (+0.47%) ⬆️
datafusion/src/physical_plan/display.rs 86.66% <0.00%> (+2.05%) ⬆️

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 5c5a0bb...2c6a23b. Read the comment docs.

@alamb
Copy link
Contributor Author

alamb commented May 19, 2021

FYI @yordan-pavlov and @returnString

Copy link
Member

@jorgecarleitao jorgecarleitao left a comment

Choose a reason for hiding this comment

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

I have not read it in detail but I assume it is just a code movement and rename and therefore 👍

let logical_predicate_expr =
build_predicate_expression(expr, &schema, &mut stat_column_req)?;
// println!(
// "PruningPredicateBuilder::try_new, logical_predicate_expr: {:?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Those println comments could be removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

(they were there in the original code but I think would be better to remove them)

self.scalar_expr
}

// fn column_name(&self) -> &String {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in 688dde4

}
}

// fn column_expr(&self) -> &Expr {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in 688dde4

fn is_stat_column_missing(&self, statistics_type: StatisticsType) -> bool {
self.stat_column_req
.iter()
.filter(|(c, t, _f)| c == &self.column_name && t == &statistics_type)
Copy link
Contributor

Choose a reason for hiding this comment

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

This code could use .any instead of filter + count.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In 2c6a23b

@Dandandan
Copy link
Contributor

I also think this is looking good. I think we might clean things up a bit while touching the code, I added some suggestions.

@alamb
Copy link
Contributor Author

alamb commented May 20, 2021

I also think this is looking good. I think we might clean things up a bit while touching the code, I added some suggestions.

Cleaned per @Dandandan 's suggestions

Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

I like it, great use of the physical optimizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants