fix: reset reused join result vectors after empty probe#24273
Open
LeftHandCold wants to merge 3 commits intomatrixorigin:3.0-devfrom
Open
fix: reset reused join result vectors after empty probe#24273LeftHandCold wants to merge 3 commits intomatrixorigin:3.0-devfrom
LeftHandCold wants to merge 3 commits intomatrixorigin:3.0-devfrom
Conversation
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
There was a problem hiding this comment.
Pull request overview
This PR is broader than the title/description suggest. It includes the stated join-batch reuse fix in the columnar join operators, but it also adds new SQL surface area (<=>, JSON ->/->>), JSON-to-numeric cast behavior, and multi-table DROP TABLE planning/authentication changes.
Changes:
- Reset reused join result vectors in
loopjoin,left, andsingleafter empty-probe paths, with regression tests. - Add null-safe equality support and JSON arrow operator parsing/execution coverage, plus JSON-to-numeric cast behavior/tests.
- Add multi-table
DROP TABLEplan/compile/authentication handling and distributed SQL tests.
Reviewed changes
Copilot reviewed 36 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/distributed/cases/join/apply.result | Updates distributed join/apply expected output. |
| test/distributed/cases/function/func_null_safe_equal.sql | Adds SQL coverage for <=>. |
| test/distributed/cases/function/func_null_safe_equal.result | Expected results for <=> coverage. |
| test/distributed/cases/function/func_json_arrow.sql | Adds SQL coverage for -> / ->>. |
| test/distributed/cases/function/func_json_arrow.result | Expected results for JSON arrow coverage. |
| test/distributed/cases/ddl/drop_table_multiple.sql | Adds distributed tests for multi-table drop. |
| test/distributed/cases/ddl/drop_table_multiple.result | Expected results for multi-table drop tests. |
| proto/plan.proto | Extends DropTable protobuf shape for multi-target drop. |
| pkg/sql/plan/function/list_operator.go | Registers <=> operator metadata. |
| pkg/sql/plan/function/init.go | Adds encoded name/id helpers for <=>. |
| pkg/sql/plan/function/function_id.go | Assigns function id for <=>. |
| pkg/sql/plan/function/function_id_test.go | Updates function id assertions. |
| pkg/sql/plan/function/func_compare.go | Implements <=> dispatch and updates mixed-type compare callbacks. |
| pkg/sql/plan/function/func_compare_test.go | Adds comparison regression/unit tests. |
| pkg/sql/plan/function/func_compare_fix.go | Reworks mixed numeric comparison fallback logic. |
| pkg/sql/plan/function/func_cast.go | Adds JSON-to-numeric cast support. |
| pkg/sql/plan/function/func_cast_test.go | Adds JSON cast regression tests. |
| pkg/sql/plan/deepcopy.go | Adds deep-copy support for nested drop-table plans. |
| pkg/sql/plan/build_expr_test.go | Adds binder tests for tuple <=>. |
| pkg/sql/plan/build_ddl.go | Builds multi-table drop plans. |
| pkg/sql/plan/build_ddl_test.go | Adds unit tests for multi-drop FK target checks. |
| pkg/sql/plan/build_alter_table_test.go | Verifies JSON→numeric remains blocked for DDL type change. |
| pkg/sql/plan/build_alter_modify_column.go | Blocks JSON→numeric ALTER COLUMN conversions. |
| pkg/sql/plan/base_binder.go | Binds tuple <=> expressions. |
| pkg/sql/parsers/dialect/mysql/scanner.go | Tokenizes ->> as LONG_ARROW. |
| pkg/sql/parsers/dialect/mysql/mysql_sql.y | Parses JSON arrow operators into function calls. |
| pkg/sql/parsers/dialect/mysql/mysql_sql_test.go | Adds parser coverage for JSON arrow syntax. |
| pkg/sql/compile/ddl.go | Executes multi-table drop entries sequentially. |
| pkg/sql/colexec/single/join.go | Resets reused result vectors after empty probe. |
| pkg/sql/colexec/single/join_test.go | Adds regression test for single join reuse. |
| pkg/sql/colexec/loopjoin/join.go | Resets reused result vectors after empty probe. |
| pkg/sql/colexec/loopjoin/join_test.go | Adds regression test for loop join reuse. |
| pkg/sql/colexec/left/join.go | Resets reused result vectors after empty probe. |
| pkg/sql/colexec/left/join_test.go | Adds regression test for left join reuse. |
| pkg/frontend/authenticate.go | Extends auth/privilege handling for multi-table drop. |
| pkg/frontend/authenticate_test.go | Adds auth regression tests for multi-table drop. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Reviewed and updated this PR. Changes made:
Validation:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aunjgr
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #24270
What this PR does / why we need it:
This fixes the panic caused by reusing join result batches after an empty probe path.
When
emptyProbebuilds const output vectors, the next execution could reuse the same result batch with onlyCleanOnlyData(). That does not clear const vector state, so a later probe can append into a const vector and panic withappend to const vector.The PR now resets reused result vectors with
ResetWithSameType()before writing probe results again. It also usesvector.SetConstNull()for empty-probe right-side NULL output, so reused vectors cannot retain stale data and accidentally become non-null constants after a previous non-empty probe.Regression tests cover loopjoin / left / single join reuse in both directions: empty probe followed by non-empty probe, and non-empty probe followed by empty probe.
Validation
go test ./pkg/sql/colexec/left ./pkg/sql/colexec/single ./pkg/sql/colexec/loopjoin -count=1