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. We 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: we 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.



-- 
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]

Reply via email to