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

Support filter/limit pushdown for views/dataframes #3905

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

Dandandan
Copy link
Contributor

Which issue does this PR close?

Closes #3681
Closes #3249

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Oct 20, 2022
@Dandandan Dandandan changed the title Support filter pushdown for views/dataframes Support filter/limit pushdown for views/dataframes Oct 20, 2022
Support filter, limit pushdown for views/dataframes

Support filter, limit pushdown for views/dataframes

Support filter, limit pushdown for views/dataframes
@Dandandan Dandandan force-pushed the filter_pushdown_views_dataframes branch from f74373e to deda756 Compare October 20, 2022 14:52
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

👨‍🍳 👌

Very nice @Dandandan

&self,
_filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
// A filter is added on the DataFrame when given
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

.select_columns(&["bool_col", "int_col"])?;

let plan = df.explain(false, false)?.collect().await?;
// Filters all the way to Parquet
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

self.logical_plan().clone()
};
let mut plan = LogicalPlanBuilder::from(plan);
let filter = filters.iter().cloned().reduce(|acc, new| acc.and(new));
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use conjunction here and above too if you wanted : https://github.com/apache/arrow-datafusion/blob/master/datafusion/optimizer/src/utils.rs#L123-L147

it just does the same thing, so I don't feel strongly

@Dandandan Dandandan merged commit 6bcee13 into apache:master Oct 20, 2022
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
2 participants