fix: preserve binary literal semantics across expressions - #26750
Draft
ck89119 wants to merge 26 commits into
Draft
fix: preserve binary literal semantics across expressions#26750ck89119 wants to merge 26 commits into
ck89119 wants to merge 26 commits into
Conversation
# Conflicts: # pkg/container/batch/batch.go # pkg/container/batch/batch_test.go # pkg/container/pSpool/copy.go # pkg/container/vector/vector.go # pkg/defines/const.go # pkg/frontend/back_exec.go # pkg/frontend/compiler_context.go # pkg/frontend/computation_wrapper.go # pkg/frontend/computation_wrapper_test.go # pkg/frontend/mysql_cmd_executor.go # pkg/frontend/session.go # pkg/frontend/util.go # pkg/frontend/variables.go # pkg/sql/colexec/evalExpression.go # pkg/sql/colexec/evalExpression_test.go # pkg/sql/compile/remoterunServer.go # pkg/sql/compile/remoterunServer_test.go # pkg/sql/plan/rule/constant_fold_test.go # pkg/vm/process/process.go # pkg/vm/process/process_codec.go # pkg/vm/process/process_codec_test.go # pkg/vm/process/types.go
# Conflicts: # pkg/defines/const.go
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:
issue #25295
What this PR does / why we need it:
This PR completes the binary-literal contract across expression, materialization,
session-variable, and distributed execution boundaries.
The implementation separates two independent concepts:
Literal.IsBinremains local to raw hexadecimal/bit literals and preservestheir big-endian numeric-context behavior. It is not propagated through
batches, user variables, prepared statements, or RPC.
dynamically typed values. It is carried through local batch copies, user
variables, text PREPARE parameters, and remote process parameters, then
materialized as a static binary string type at projection boundaries.
This preserves the existing numeric and bitwise rules for raw literals while
fixing byte-oriented behavior for
CHAR_LENGTH,CONCAT,SUBSTR,LOWER/UPPER,REPEAT,IF,CASE, andCOALESCE. CTAS and set-operationoutputs now receive the correct binary type and byte width, and
BINARY(N)comparisons retain their padding semantics.
The regression matrix includes:
BINARY(N)comparison/filter behavior, empty/NULL/invalid UTF-8;Validation on the final head:
./pkg/container/batch ./pkg/sql/plan/function ./pkg/sql/plan ./pkg/sql/colexec ./pkg/sql/compile ./pkg/frontend ./pkg/vm/process;make build;func_string_char_length.test: 141/141;func_cast.test: 243/243 value checks;mysql_compat_bitwise_unsigned.test: 28/28 value checks;PREPARE, numeric insertion, bitwise/unary operations, binary padding,
CTAS/UNION, and COM_STMT;
git diff --checkand complete-diff self-review.