Skip to content

test: cover prepared IN in nested PK filter - #27558

Merged
LeftHandCold merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:codex/pr1-sql-metamorphic
Aug 26, 2026
Merged

LeftHandCold merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:codex/pr1-sql-metamorphic

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • replace the duplicated information_schema fixture called out in review #5013529566
  • exercise a genuinely distinct reachable axis on a normal VARCHAR primary key
  • cover server PREPARE reuse with a <= ? AND (a IN (?,?,?) OR a > ?) across two bindings

Why this is distinct

Validation

  • go test ./pkg/vm/engine/readutil -run ^TestConstructBasePKFilterWithOr$ -count=1
  • go test ./pkg/sql/plan -run TestDoMergeFiltersOnCompositeKey -count=1
  • go test ./pkg/sql/plan -run TestInRHSValues -count=1
  • SQL/result statement and expected-row alignment checked
  • git diff --check passed

The shared local MatrixOne listener was not used because mo-tester performs destructive global cleanup; the updated fixture is ready for the repository BVT/CI environment.

@XuPeng-SH XuPeng-SH 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.

The added case is duplicate coverage rather than a new regression axis.

test/distributed/cases/optimizer/pk_filter_nested_boolean.sql, merged by #27521, already creates the same five tables and executes the same prepared information_schema.tables ... table_name IN (?,?,?,?,?) query with the same five-row oracle. The new literal query does not add an independent failure detector: both queries are still checked against the same fixed rows, and the existing prepared case already proves the externally visible result.

More importantly, #27503 and #27521 document that #26627's cast makes this exact information_schema query bypass PK pruning on main. Therefore this fixture passes even without the nested-OR root fix and cannot detect a regression of the defect it claims to cover. The existing #27521 BVT adds mixed AND/OR cases that actually reach the faulty merge path, plus this exact public prepared query.

The current CI artifact confirms both files ran successfully in the same pessimistic BVT job (pk_filter_nested_boolean: 29/29, 0.256s; prepared_in_equivalence: 19/19, 0.220s), so validation is no longer missing, but it also confirms the duplicated recurring BVT cost.

Please close this PR as superseded by #27521, or replace it with a genuinely distinct reachable behavior/failure axis that is not already covered.

@LeftHandCold
LeftHandCold marked this pull request as ready for review August 25, 2026 03:07
@LeftHandCold
LeftHandCold requested a review from aptend as a code owner August 25, 2026 03:07
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@LeftHandCold

Copy link
Copy Markdown
Collaborator Author

Addressed in 7267e2d. The duplicated information_schema fixture was replaced with a distinct reachable axis on a normal VARCHAR primary key: server PREPARE reuse with a <= ? AND (a IN (?,?,?) OR a > ?) and two binding sets (a,c,z and b,zz). This reaches the prepared-IN nested disjunction plus outer range merge without relying on the #26627 information_schema cast. Targeted readutil/planner tests, SQL/result alignment, and diff checks pass. Live BVT was not run against the shared local listener because mo-tester performs destructive global cleanup; repository CI is the safe execution environment.

@LeftHandCold LeftHandCold changed the title test: cover prepared IN over information schema test: cover prepared IN in nested PK filter Aug 25, 2026

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

Deep re-review completed on exact head 7267e2d5098dc25a6cb7ffa5c8c6ceb9c2e89d29, including the prior CHANGES_REQUESTED review, the author response, the complete diff, and the delta from reviewed head df5d181a2dd8d1c961c4dbd7e56c7bfcba89d419. The previous blocker is closed: the duplicated information_schema fixture was fully replaced by a normal VARCHAR primary-key query that reaches (prepared IN OR range) AND range without the #26627 cast bypass, and reuses one PREPARE across two materially different bindings. This is distinct from #27521's equality/range operand-order BVT while retaining a small deterministic oracle. CI confirms the new SQL file is included in the passing BVT job. Local full pkg/vm/engine/readutil and pkg/sql/plan tests passed; focused readutil race passed for 10 iterations; vet and diff checks passed. No blocking issues found.

@XuPeng-SH XuPeng-SH 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.

Deep re-reviewed exact head 7267e2d5098dc25a6cb7ffa5c8c6ceb9c2e89d29.

The previous duplicate/unreachable-fixture blocker is closed. The replacement test uses a normal VARCHAR primary key and reaches the actual (prepared IN OR range) AND outer range BasePKFilter container merge without depending on the information_schema cast bypass. Its two bindings have small deterministic oracles, exercise materially different branches, and reuse the same prepared statement so stale runtime specialization is observable. This is distinct from #27521's equality/range operand-order cases.

I also checked SQL/result alignment, surrounding BVT coverage, cleanup, and diff cleanliness. Current CI includes the new BVT and is green. No blocking implementation or test-design issue found.

@mergify

mergify Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@LeftHandCold
LeftHandCold merged commit 7792fca into matrixorigin:main Aug 26, 2026
22 of 26 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- replace the duplicated information_schema fixture called out in review
#5013529566
- exercise a genuinely distinct reachable axis on a normal VARCHAR
primary key
- cover server PREPARE reuse with `a <= ? AND (a IN (?,?,?) OR a > ?)`
across two bindings

## Why this is distinct
- the case reaches the nested disjunction/container merge through a
prepared `IN` plus a range arm
- it does not depend on the information_schema cast path from matrixorigin#26627
- it is different from the existing equality/range operand-order cases
in matrixorigin#27521

## Validation
- `go test ./pkg/vm/engine/readutil -run
^TestConstructBasePKFilterWithOr$ -count=1`
- `go test ./pkg/sql/plan -run TestDoMergeFiltersOnCompositeKey
-count=1`
- `go test ./pkg/sql/plan -run TestInRHSValues -count=1`
- SQL/result statement and expected-row alignment checked
- `git diff --check` passed

The shared local MatrixOne listener was not used because mo-tester
performs destructive global cleanup; the updated fixture is ready for
the repository BVT/CI environment.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- replace the duplicated information_schema fixture called out in review
#5013529566
- exercise a genuinely distinct reachable axis on a normal VARCHAR
primary key
- cover server PREPARE reuse with `a <= ? AND (a IN (?,?,?) OR a > ?)`
across two bindings

## Why this is distinct
- the case reaches the nested disjunction/container merge through a
prepared `IN` plus a range arm
- it does not depend on the information_schema cast path from matrixorigin#26627
- it is different from the existing equality/range operand-order cases
in matrixorigin#27521

## Validation
- `go test ./pkg/vm/engine/readutil -run
^TestConstructBasePKFilterWithOr$ -count=1`
- `go test ./pkg/sql/plan -run TestDoMergeFiltersOnCompositeKey
-count=1`
- `go test ./pkg/sql/plan -run TestInRHSValues -count=1`
- SQL/result statement and expected-row alignment checked
- `git diff --check` passed

The shared local MatrixOne listener was not used because mo-tester
performs destructive global cleanup; the updated fixture is ready for
the repository BVT/CI environment.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- replace the duplicated information_schema fixture called out in review
#5013529566
- exercise a genuinely distinct reachable axis on a normal VARCHAR
primary key
- cover server PREPARE reuse with `a <= ? AND (a IN (?,?,?) OR a > ?)`
across two bindings

## Why this is distinct
- the case reaches the nested disjunction/container merge through a
prepared `IN` plus a range arm
- it does not depend on the information_schema cast path from matrixorigin#26627
- it is different from the existing equality/range operand-order cases
in matrixorigin#27521

## Validation
- `go test ./pkg/vm/engine/readutil -run
^TestConstructBasePKFilterWithOr$ -count=1`
- `go test ./pkg/sql/plan -run TestDoMergeFiltersOnCompositeKey
-count=1`
- `go test ./pkg/sql/plan -run TestInRHSValues -count=1`
- SQL/result statement and expected-row alignment checked
- `git diff --check` passed

The shared local MatrixOne listener was not used because mo-tester
performs destructive global cleanup; the updated fixture is ready for
the repository BVT/CI environment.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants