Skip to content

[4.2.1-hotfix] fix(plan): skip empty predicate deduction traversals - #31511

Merged
XuPeng-SH merged 1 commit into
matrixorigin:release/v4.2.1-hotfix-20261026from
ck89119:issue-31502-release-v4.2.1-hotfix-20261026
Oct 28, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:release/v4.2.1-hotfix-20261026from
ck89119:issue-31502-release-v4.2.1-hotfix-20261026

Conversation

@ck89119

@ck89119 ck89119 commented Oct 28, 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:

Related to #31502.

What this PR does / why we need it:

Minimally backport the non-empty predicate-deduction guards from main commit 5d6f921345 (#26927). Skip the extra child traversal when no predicates were deduced, while preserving normal pushdown and non-empty deduction. No UPDATE alias, DEDUP, cancellation, or other changes from that PR are included.

Add deterministic regression coverage for both chain directions and all six affected JOIN types, non-empty deduction semantics, and an eight-table PREPARE through the real planner entry point. The unpatched eight-table INNER chain performs 509 visits for 15 nodes; the guarded version performs 15. Independently reverting any of the four guards is caught by the regression.

Validation on this target branch (Go 1.26.4, macOS arm64, branch-local native libraries):

  • New regressions fail on unpatched production code for the expected visit-count assertion; non-empty deduction and PREPARE controls pass.
  • Focused regression and related pushdown tests pass.
  • Full pkg/sql/plan tests, go vet, and incremental golangci-lint 2.6.2 pass.
  • All eight added executable production lines are covered (100%).

This addresses empty-deduction traversal amplification, not a general planning-memory budget or a proof of linear planning cost for every SQL shape. No changes to main are included.

@mergify
mergify Bot requested a review from XuPeng-SH October 28, 2026 04:06
@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Oct 28, 2026
@ck89119
ck89119 marked this pull request as ready for review October 28, 2026 04:19
@ck89119
ck89119 requested a review from aunjgr as a code owner October 28, 2026 04:19
@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 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

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

Reviewed f0426d0 against the actual hotfix base 47e644f. No blocking finding. The four guards remove empty deduction traversals while preserving normal child pushdown, residual handling and nonempty deductions; no unrelated changes from #26927 are included. Production net +8 lines; the 165 test lines provide deterministic complexity, direction/semantics and real PREPARE coverage.

Independently validated this hotfix with its own native libraries (Go 1.26.4, macOS arm64): 48 related planner tests / 87 subtests pass under -race; incremental golangci-lint 2.6.2 reports 0 issues. An actual three-CN embedded cluster passes 17 SQL scenarios in both direct and PREPARE/EXECUTE modes, plus invalid-PREPARE recovery. Reverting only production pushdown.go to base reproduces 509 visits for the eight-table/15-node regression.

Serial base/head/base PREPARE measurements for 16 INNER tables improve from 92–94ms and 138.5MiB allocated per operation to 0.37ms and 0.59MiB. Single-table and LEFT-chain controls show no stable regression. This addresses empty-deduction amplification, not a general planner memory budget.

CI caveat: Iceberg E2E job 122629279416 timed out during go build before SQL validation. Its log does not establish the underlying build stall cause; this approval does not claim that remote CI is all green.

@XuPeng-SH
XuPeng-SH merged commit 7ce664f into matrixorigin:release/v4.2.1-hotfix-20261026 Oct 28, 2026
5 of 9 checks passed
@ck89119
ck89119 deleted the issue-31502-release-v4.2.1-hotfix-20261026 branch October 28, 2026 08:19
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 kind/test-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants