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

[opt] merge filters on composite primary keys in plan (cp to 1.2-dev) #16406

Merged
merged 3 commits into from
May 28, 2024

Conversation

aunjgr
Copy link
Contributor

@aunjgr aunjgr commented May 27, 2024

for a composite primary key (a, b), we merge multiple filters into one, i.e.:

  • a = 1 and b = 2 => cpk = serial(1, 2)
  • a = 1 => prefix_eq(cpk, serial(1))
  • (a = 1 and b = 2) or (a = 3 and b = 4) => cpk in [serial(1, 2), serial(3, 4)]
  • (a = 1) or (a = 2 and b = 3) => prefix_in(cpk, [serial(1), serial(2, 3)])

Approved by: @m-schen, @badboynt1, @XuPeng-SH

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #14515

What this PR does / why we need it:

for a composite primary key (a, b), we merge multiple filters into one, i.e.:

a = 1 and b = 2 => cpk = serial(1, 2)
a = 1 => prefix_eq(cpk, serial(1))
(a = 1 and b = 2) or (a = 3 and b = 4) => cpk in [serial(1, 2), serial(3, 4)]
(a = 1) or (a = 2 and b = 3) => prefix_in(cpk, [serial(1), serial(2, 3)])

…4541)

for a composite primary key (a, b), we merge multiple filters into one, i.e.:
* a = 1 and b = 2 => cpk = serial(1, 2)
* a = 1 => prefix_eq(cpk, serial(1))
* (a = 1 and b = 2) or (a = 3 and b = 4) => cpk in [serial(1, 2), serial(3, 4)]
* (a = 1) or (a = 2 and b = 3) => prefix_in(cpk, [serial(1), serial(2, 3)])

Approved by: @m-schen, @badboynt1, @XuPeng-SH
@mergify mergify bot requested a review from sukki37 May 27, 2024 02:54
@mergify mergify bot added the kind/feature label May 27, 2024
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label May 27, 2024
@matrixorigin matrixorigin deleted a comment from matrix-meow May 27, 2024
@mergify mergify bot merged commit 1716d36 into matrixorigin:1.2-dev May 28, 2024
18 of 19 checks passed
@aylei aylei mentioned this pull request Jun 5, 2024
@aunjgr aunjgr deleted the cp-1.2 branch June 5, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature size/L Denotes a PR that changes [500,999] lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants