zhang-jianq commented on code in PR #13670:
URL: https://github.com/apache/gluten/pull/13670#discussion_r4750442824
##########
gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java:
##########
@@ -67,6 +68,11 @@ private interface VLTypeConverter {
logicalType -> new
io.github.zhztheplayer.velox4j.type.VarCharType()),
Map.entry(
CharType.class, logicalType -> new
io.github.zhztheplayer.velox4j.type.VarCharType()),
+ // BYTES maps to VARBINARY; fixed-length BINARY(n) stays unmapped
+ // because velox cannot preserve its pad/truncate semantics.
+ Map.entry(
+ VarBinaryType.class,
Review Comment:
Thank you — fixed in the CAST branch of `RexNodeConverter`: a cast whose
target is in the BINARY family with a length below `VarBinaryType.MAX_LENGTH`
is rejected at planning. I reproduced both of your examples over source columns
(native hashes `abc` where the pre-fix offload hashed `abcdef`), and the UTs
pin the rejection with source columns rather than literals, since literal casts
are folded by the planner before conversion. `CAST(... AS BYTES)` is unchanged.
One deviation from the suggestion: I dropped the "operand length <= target
length" exemption. A probe over a BYTES column showed Flink zero-pads shorter
binary values too: casting the 2-byte `ab` to `VARBINARY(3)` yields
`5d36fe0e...` natively (the digest of `ab\0`) where the offload yielded
`187ef443...` — `Arrays.copyOf` is unconditional on that path, so the case is
not a no-op, and the actual value length is not known at plan time anyway.
##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java:
##########
@@ -311,8 +323,8 @@ public static Variant toVariant(RexLiteral literal) {
// For CHAR, we convert it to VARCHAR
return new VarCharValue(literal.getValueAs(String.class));
case BINARY:
Review Comment:
Thank you for review, it's dropped, with a two-line note on why no `BINARY`
case is expected. I checked the second option as well: every reachable bare
`X'..'` shape is folded by the planner ahead of conversion (`MD5(X'6162')`
folds to a VARCHAR literal; a bare literal fed to a BYTES-parameter function is
coerced by a cast that folds into a VARBINARY literal and already takes the
`VARBINARY` case), so mapping `BINARY(n)` literals would wire a path no query
reaches.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]