Repository navigation
[CALCITE-7801] SqlFunctions.cast: support BINARY, VARBINARY, GEOMETRY and UUID targets - #10
Merged
wasabii merged 1 commit intoSep 22, 2026
Conversation
… and UUID targets Make the runtime cast used by JSON_VALUE feature-parallel with a generated CAST for the remaining scalar types a character value can convert to: BINARY and VARBINARY (encoding the value's bytes with the default charset, padding or truncating to the precision), GEOMETRY (from EWKT), and UUID. Add SqlFunctionsCastTest.testCastFromStringToEachType, which converts a character value to each scalar target type, and JSON_VALUE RETURNING cases for UUID and VARBINARY.
wasabii
merged commit Sep 22, 2026
f31f12d
into
calcite-7801-json-value-returning-conversion
10 of 32 checks passed
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.
Extends
SqlFunctions.cast— the runtime conversionJSON_VALUE/JSON_QUERYuse — to the scalar target types a character value can convert to that it did not yet handle:BINARY/VARBINARY— the value's bytes, zero-padded (BINARY) or truncated (VARBINARY) to the precisionGEOMETRY— parsed from EWKTUUIDUUIDandGEOMETRYuse the same methods a generatedCASTdoes. Binary has one caveat: a generatedCASTencodes the string with the source type's charset, butcastreceives a bare runtime value with no charset attached, so it uses the default charset (Util.getDefaultCharset()). ForJSON_VALUE, whose extracted strings carry no SQL charset, that default is the correct source charset; for a source with an explicit non-default charset it would differ, which the runtime-value signature cannot express.Adds
SqlFunctionsCastTest.testCastFromStringToEachType(a character value → each scalar target type) plusJSON_VALUE ... RETURNINGcases foruuidandvarbinary.Targeted at
calcite-7801-json-value-returning-conversionso merging it updates upstream apache#5276.Still unsupported, because they need structural type information a target descriptor cannot carry:
ROW,MAP,INTERVAL,VARIANT.