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

Eliminate the scalar value filter #2002

Merged
merged 3 commits into from
Mar 14, 2022
Merged

Conversation

jackwener
Copy link
Member

@jackwener jackwener commented Mar 13, 2022

Which issue does this PR close?

Closes #1724.

What changes are included in this PR?

Add rule eliminate_filter, which can eliminate the filter using scalar and add unit test.

Are there any user-facing changes?

None.

@github-actions github-actions bot added the datafusion Changes in the datafusion crate label Mar 13, 2022
@jackwener
Copy link
Member Author

PTAL @Dandandan @houqp

}) => {
if !*v {
return Ok(LogicalPlan::EmptyRelation(EmptyRelation {
produce_one_row: false,
Copy link
Member

@Ted-Jiang Ted-Jiang Mar 13, 2022

Choose a reason for hiding this comment

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

i have checked in pg , it will return 0 row. 👍

postgres=# select 1 from user_tbl where false;
 ?column?
----------
(0 rows)

postgres=# select * from user_tbl where false;
 name | signup_date
------+-------------
(0 rows)

@jackwener jackwener changed the title Eliminate the false filter Eliminate the scalar value filter Mar 13, 2022
Copy link
Contributor

@liukun4515 liukun4515 left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @jackwener

Copy link
Member

@yjshen yjshen left a comment

Choose a reason for hiding this comment

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

Thanks @jackwener !

@yjshen yjshen merged commit 54ffe8a into apache:master Mar 14, 2022
@alamb
Copy link
Contributor

alamb commented Mar 14, 2022

Thanks @jackwener

@jackwener jackwener deleted the eliminate_false branch December 6, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize Out Redundant Filter Expresions
7 participants