Repository navigation
Conversation
|
Dependency and combined-path acceptance after PR #27483: PR #27483 should land first because it owns the DECIMAL common-domain behavior and overlaps with this PR in The combined #27483 + #27466 head must validate this SQL CREATE TABLE t (
id INT PRIMARY KEY,
d DECIMAL(20,4)
);
INSERT INTO t VALUES
(1, 9007199254740992.0000),
(2, 9007199254740992.0001),
(3, 9007199254740993.0000);
PREPARE q FROM 'SELECT id FROM t WHERE d BETWEEN ? AND ? ORDER BY id';
SET @lo = '9007199254740992.0001';
SET @hi = '9007199254740992.0001';
EXECUTE q USING @lo, @hi;Expected: On current PR #27466 head This is intentionally an acceptance requirement for PR #27466 after merging #27483, not additional scope for PR #27483. The exact |
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #25408 issue #27492 ## What this PR does / why we need it: Prepared executions transport SQL user-variable values and binary-protocol string values through text-backed parameter vectors. Two related runtime-specialization gaps could therefore reuse or select an approximate domain that did not match the current execution: - `EXECUTE ... USING` arithmetic could retain an earlier integer cast when a later execution supplied DECIMAL; - text-backed BIGINT UNSIGNED and BIT(64) comparisons could pass `2^53+1` through DOUBLE, merging adjacent BIGINT values or raising a BIT range error. This PR keeps the two ownership rules separate while validating them together: - SQL arithmetic rebinding uses the current user variable's logical source type and includes it in the specialization-cache identity; - comparison rebinding recognizes text operands against exact integer/BIT peers and materializes an in-range integral numeric prefix directly in the peer domain; - fractional, out-of-range, nonnumeric, and DECIMAL string comparisons retain the existing MySQL-compatible DOUBLE fallback; - BIT comparisons remain in the BIT domain, preserving the column-side comparison/index contract; - specialized literals retain parameter provenance so same-category cached plans read each execution's current value. The implementation is based on current `main` after #27483. No code was cherry-picked from the older broad implementation in #27466. ## Testing - complete `pkg/sql/plan` and `pkg/frontend` test packages - complete `TestIssue27088PreparedDecimalCommonType`, including SQL PREPARE and COM_STMT BIGINT UNSIGNED/BIT(64) string, integer, NULL, and reuse transitions - CGo-wrapper `vet=all` for `pkg/sql/plan`, `pkg/frontend`, and `pkg/tests/issues` - `make build` - `prepare_all.sql` in normal mo-tester comparison mode twice on the same final binary: `438 total / 437 success / 0 failed / 1 ignored / 0 abnormal` in both runs - package coverage runs: planner 79.1%, frontend 64.1%, with focused tests for every new specialization branch --------- Co-authored-by: XuPeng-SH <[email protected]>
…origin#27795) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25408 issue matrixorigin#27492 ## What this PR does / why we need it: Prepared executions transport SQL user-variable values and binary-protocol string values through text-backed parameter vectors. Two related runtime-specialization gaps could therefore reuse or select an approximate domain that did not match the current execution: - `EXECUTE ... USING` arithmetic could retain an earlier integer cast when a later execution supplied DECIMAL; - text-backed BIGINT UNSIGNED and BIT(64) comparisons could pass `2^53+1` through DOUBLE, merging adjacent BIGINT values or raising a BIT range error. This PR keeps the two ownership rules separate while validating them together: - SQL arithmetic rebinding uses the current user variable's logical source type and includes it in the specialization-cache identity; - comparison rebinding recognizes text operands against exact integer/BIT peers and materializes an in-range integral numeric prefix directly in the peer domain; - fractional, out-of-range, nonnumeric, and DECIMAL string comparisons retain the existing MySQL-compatible DOUBLE fallback; - BIT comparisons remain in the BIT domain, preserving the column-side comparison/index contract; - specialized literals retain parameter provenance so same-category cached plans read each execution's current value. The implementation is based on current `main` after matrixorigin#27483. No code was cherry-picked from the older broad implementation in matrixorigin#27466. ## Testing - complete `pkg/sql/plan` and `pkg/frontend` test packages - complete `TestIssue27088PreparedDecimalCommonType`, including SQL PREPARE and COM_STMT BIGINT UNSIGNED/BIT(64) string, integer, NULL, and reuse transitions - CGo-wrapper `vet=all` for `pkg/sql/plan`, `pkg/frontend`, and `pkg/tests/issues` - `make build` - `prepare_all.sql` in normal mo-tester comparison mode twice on the same final binary: `438 total / 437 success / 0 failed / 1 ignored / 0 abnormal` in both runs - package coverage runs: planner 79.1%, frontend 64.1%, with focused tests for every new specialization branch --------- Co-authored-by: XuPeng-SH <[email protected]>
…origin#27795) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25408 issue matrixorigin#27492 ## What this PR does / why we need it: Prepared executions transport SQL user-variable values and binary-protocol string values through text-backed parameter vectors. Two related runtime-specialization gaps could therefore reuse or select an approximate domain that did not match the current execution: - `EXECUTE ... USING` arithmetic could retain an earlier integer cast when a later execution supplied DECIMAL; - text-backed BIGINT UNSIGNED and BIT(64) comparisons could pass `2^53+1` through DOUBLE, merging adjacent BIGINT values or raising a BIT range error. This PR keeps the two ownership rules separate while validating them together: - SQL arithmetic rebinding uses the current user variable's logical source type and includes it in the specialization-cache identity; - comparison rebinding recognizes text operands against exact integer/BIT peers and materializes an in-range integral numeric prefix directly in the peer domain; - fractional, out-of-range, nonnumeric, and DECIMAL string comparisons retain the existing MySQL-compatible DOUBLE fallback; - BIT comparisons remain in the BIT domain, preserving the column-side comparison/index contract; - specialized literals retain parameter provenance so same-category cached plans read each execution's current value. The implementation is based on current `main` after matrixorigin#27483. No code was cherry-picked from the older broad implementation in matrixorigin#27466. ## Testing - complete `pkg/sql/plan` and `pkg/frontend` test packages - complete `TestIssue27088PreparedDecimalCommonType`, including SQL PREPARE and COM_STMT BIGINT UNSIGNED/BIT(64) string, integer, NULL, and reuse transitions - CGo-wrapper `vet=all` for `pkg/sql/plan`, `pkg/frontend`, and `pkg/tests/issues` - `make build` - `prepare_all.sql` in normal mo-tester comparison mode twice on the same final binary: `438 total / 437 success / 0 failed / 1 ignored / 0 abnormal` in both runs - package coverage runs: planner 79.1%, frontend 64.1%, with focused tests for every new specialization branch --------- Co-authored-by: XuPeng-SH <[email protected]>
…origin#27795) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25408 issue matrixorigin#27492 ## What this PR does / why we need it: Prepared executions transport SQL user-variable values and binary-protocol string values through text-backed parameter vectors. Two related runtime-specialization gaps could therefore reuse or select an approximate domain that did not match the current execution: - `EXECUTE ... USING` arithmetic could retain an earlier integer cast when a later execution supplied DECIMAL; - text-backed BIGINT UNSIGNED and BIT(64) comparisons could pass `2^53+1` through DOUBLE, merging adjacent BIGINT values or raising a BIT range error. This PR keeps the two ownership rules separate while validating them together: - SQL arithmetic rebinding uses the current user variable's logical source type and includes it in the specialization-cache identity; - comparison rebinding recognizes text operands against exact integer/BIT peers and materializes an in-range integral numeric prefix directly in the peer domain; - fractional, out-of-range, nonnumeric, and DECIMAL string comparisons retain the existing MySQL-compatible DOUBLE fallback; - BIT comparisons remain in the BIT domain, preserving the column-side comparison/index contract; - specialized literals retain parameter provenance so same-category cached plans read each execution's current value. The implementation is based on current `main` after matrixorigin#27483. No code was cherry-picked from the older broad implementation in matrixorigin#27466. ## Testing - complete `pkg/sql/plan` and `pkg/frontend` test packages - complete `TestIssue27088PreparedDecimalCommonType`, including SQL PREPARE and COM_STMT BIGINT UNSIGNED/BIT(64) string, integer, NULL, and reuse transitions - CGo-wrapper `vet=all` for `pkg/sql/plan`, `pkg/frontend`, and `pkg/tests/issues` - `make build` - `prepare_all.sql` in normal mo-tester comparison mode twice on the same final binary: `438 total / 437 success / 0 failed / 1 ignored / 0 abnormal` in both runs - package coverage runs: planner 79.1%, frontend 64.1%, with focused tests for every new specialization branch --------- Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25408
What this PR does / why we need it:
This is the second of three scoped changes for prepared runtime parameter handling. PR #27329 fixed only
LIMIT/OFFSET; this PR fixes runtime numeric rebinding and producer-to-consumer type lineage. Type-signature compile-cache reuse remains a separate follow-up.Previously, SQL
EXECUTE ... USINGdid not pass user-variable runtime types into the specialization path used by COM_STMT. Even when an immediate numeric expression was rebound, derived tables, set operations, aggregates, windows, scalar subqueries, DML consumers, and CTAS schemas could retain the prepare-time physical type. That caused invalid casts, wrong overloads, stale vector layouts, panics, and incorrect persisted values.This change:
DOUBLEdomain, while keeping string predicates such asconcat(v, '') = ?in the string domain;Regression coverage includes SQL PREPARE and COM_STMT, integer/unsigned/DECIMAL/FLOAT/DOUBLE/BOOL/string domains, 65-digit integers, 30-digit decimals, scientific notation and underflow, nested expressions, derived tables, UNION, aggregate/window/scalar-subquery consumers, DISTINCT aggregates, UPDATE/DELETE, BIT assignment provenance, explicit casts, REGEXP direction, and CTAS value/schema consistency.
Validation:
mo-cgo-test ./pkg/sql/plan -count=1mo-cgo-test ./pkg/frontend -count=1mo-cgo-test ./pkg/tests/issues -run '^TestIssue25408PreparedRuntimeNumericRebind$' -count=1golangci-lint run -c .golangci.yml ./pkg/sql/plan ./pkg/frontend ./pkg/tests/issues(0 issues)