Skip to content

Eliminate the scalar value filter - #2002

Merged
yjshen merged 3 commits into
apache:masterfrom
jackwener:eliminate_false
Mar 14, 2022
Merged

yjshen merged 3 commits into
apache:masterfrom
jackwener:eliminate_false

Conversation

@jackwener

@jackwener jackwener commented Mar 13, 2022 •

Copy link
Copy Markdown
Member

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.

@jackwener

Copy link
Copy Markdown
Member Author

PTAL @Dandandan @houqp ❤

Comment thread datafusion/src/optimizer/eliminate_filter.rs Outdated
}) => {
if !*v {
return Ok(LogicalPlan::EmptyRelation(EmptyRelation {
produce_one_row: false,

@Ted-Jiang Ted-Jiang Mar 13, 2022 •

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 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)

Comment thread datafusion/src/optimizer/eliminate_filter.rs
@jackwener jackwener changed the title Eliminate the false filter Eliminate the scalar value filter Mar 13, 2022

@liukun4515 liukun4515 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.

LGTM
Thanks @jackwener

@yjshen yjshen 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.

Thanks @jackwener !

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

alamb commented Mar 14, 2022

Copy link
Copy Markdown
Contributor

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize Out Redundant Filter Expresions

7 participants