Skip to content

[4.2] fix: preserve block filters for remote table scans - #27095

Merged
XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
aptend:backport/4.2-27043-remote-block-filter
Aug 13, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
aptend:backport/4.2-27043-remote-block-filter

Conversation

@aptend

@aptend aptend commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #26960

What this PR does / why we need it:

Backport of #27043 to 4.2-dev.

Remote table-scan pipelines serialized the plan node, but the receiving CN never restored Node.BlockFilterList into its execution Source. Remote range expansion therefore received no block predicates and scanned the full committed persisted partition.

This change:

  • carries raw block-filter expressions in a per-message node copy without mutating the reusable coordinator scope;
  • folds session variables before serialization, then creates and evaluates receiver-owned Fold executors on the remote CN;
  • restores block filters for old-sender/new-receiver rolling upgrades;
  • keeps decoded scopes as raw reusable templates and preserves empty scalar literals across protobuf serialization.

Validation:

  • GOWORK=off go build -mod=readonly ./pkg/sql/compile
  • GOWORK=off go vet -mod=readonly ./pkg/sql/compile
  • focused remote block-filter regression tests
  • focused race stress for all three new tests with count=100
  • full pkg/sql/compile tests, with and without the race detector

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#26960

## What this PR does / why we need it:

Remote table-scan pipelines serialized the plan node, but the receiving
CN never restored Node.BlockFilterList into its execution Source. Remote
range expansion therefore received no block predicates and scanned the
full committed persisted partition.

This change:

- carries raw block-filter expressions in a per-message node copy
without mutating the reusable coordinator scope;
- folds session variables before serialization, then creates and
evaluates receiver-owned Fold executors on the remote CN;
- restores block filters for old-sender/new-receiver rolling upgrades;
- keeps decoded scopes as raw reusable templates and preserves empty
scalar literals across protobuf serialization.

Validation:

- GOWORK=off go build -mod=readonly ./pkg/sql/compile
- GOWORK=off go vet -mod=readonly ./pkg/sql/compile
- GOWORK=off go test -mod=readonly -count=1 -timeout=10m
./pkg/sql/compile
- focused remote block-filter regression tests with -race -count=100
- GOWORK=off go test -mod=readonly -race -count=1 -timeout=15m
./pkg/sql/compile

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 77a4ef3)
@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 →

@mergify mergify Bot added the kind/bug Something isn't working label Aug 13, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Aug 13, 2026
@XuPeng-SH
XuPeng-SH merged commit 3da2955 into matrixorigin:4.2-dev Aug 13, 2026
22 of 26 checks passed

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

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants