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

feat: Support expression simplify rule #14133

Closed
chenzl25 opened this issue Dec 21, 2023 · 3 comments · Fixed by #15275
Closed

feat: Support expression simplify rule #14133

chenzl25 opened this issue Dec 21, 2023 · 3 comments · Fixed by #15275
Assignees
Milestone

Comments

@chenzl25
Copy link
Contributor

          Interestingly, we got a `not(others) or others` which equals true. We could use another rule to simplify this condition.

Originally posted by @chenzl25 in #14127 (comment)

@github-actions github-actions bot added this to the release-1.6 milestone Dec 21, 2023
@chenzl25 chenzl25 modified the milestones: release-1.6, release-1.7 Jan 9, 2024
@chenzl25 chenzl25 self-assigned this Jan 9, 2024
@chenzl25
Copy link
Contributor Author

chenzl25 commented Feb 8, 2024

Both of the following examples can be simplified into true.

StreamFilter { predicate: (Not((t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) OR (t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) }
StreamFilter { predicate: (((Not((t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) AND Not(IsNull(t1.ts))) OR (t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) OR IsNull(t1.ts)) }

@xzhseh xzhseh self-assigned this Feb 10, 2024
@xiangjinwu
Copy link
Contributor

xiangjinwu commented Feb 19, 2024

Both of the following examples can be simplified into true.

StreamFilter { predicate: (Not((t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) OR (t1.ts > '2023-12-18 00:00:00+00:00':Timestamptz)) }

This predicate can be simplified to IsNotNull(t1.ts) rather than true. Right?

https://www.postgresql.org/docs/current/functions-logical.html

related: #12931

@xzhseh
Copy link
Contributor

xzhseh commented Mar 13, 2024

For batch plan, something like below could also be optimized, e.g.,
CleanShot 2024-03-13 at 16 26 59@2x

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 a pull request may close this issue.

3 participants