Skip to content

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

Merged
alamb merged 5 commits into
apache:masterfrom
alamb:alamb/pull_out_pred_builder
May 20, 2021
Merged

Refactor: move RowGroupPredicateBuilder into its own module, rename to PruningPredicateBuilder#365
alamb merged 5 commits into
apache:masterfrom
alamb:alamb/pull_out_pred_builder

Conversation

@alamb

Copy link
Copy Markdown
Contributor

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

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

codecov-commenter commented May 19, 2021

Copy link
Copy Markdown

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 FilesCoverage Δ
datafusion/src/physical_plan/parquet.rs81.26% <71.42%> (-4.53%)⬇️
datafusion/src/physical_optimizer/pruning.rs90.61% <90.61%> (ø)
datafusion/src/physical_plan/mod.rs84.70% <0.00%> (-2.36%)⬇️
datafusion/tests/sql.rs99.89% <0.00%> (+<0.01%)⬆️
datafusion/src/physical_plan/hash_join.rs86.05% <0.00%> (+0.47%)⬆️
datafusion/src/physical_plan/display.rs86.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
Copy Markdown
ContributorAuthor

FYI @yordan-pavlov and @returnString

@jorgecarleitaojorgecarleitao left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

}
}

// fn column_expr(&self) -> &Expr {

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@Dandandan

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

@DandandanDandandan left a comment

Copy link
Copy Markdown
Contributor

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

@alamb
alamb merged commit 913bf86 into apache:masterMay 20, 2021
@alamb
alamb deleted the alamb/pull_out_pred_builder branch May 20, 2021 21:29
HairstonE pushed a commit to HairstonE/datafusion that referenced this pull request Oct 7, 2025
* Add db-benchmark
* python lint
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changeChanges the API exposed to users of the crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@alamb@codecov-commenter@Dandandan@jorgecarleitao