TianJialong commented on code in PR #13484:
URL: https://github.com/apache/gluten/pull/13484#discussion_r4420340765


##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java:
##########
@@ -108,6 +108,14 @@ public class RexCallConverterFactory {
           Map.entry(
               "REGEXP_EXTRACT", Arrays.asList(() -> new 
DefaultRexCallConverter("regexp_extract"))),
           Map.entry("LOWER", Arrays.asList(() -> new 
DefaultRexCallConverter("lower"))),
+          // Direct name mapping: the SHA-2 family. The fixed-length spellings
+          // are the sha2 core with the length bound on the velox side; the
+          // hashLength operand is routed by the velox sha2 signature set.
+          Map.entry("SHA2", Arrays.asList(() -> new 
DefaultRexCallConverter("sha2"))),

Review Comment:
   @ggjh-159 Thanks for the review. Pushed 0f769d4, Done as suggested: the SHA2 
converter now validates a constant hashLength at conversion time — anything 
outside {224, 256, 384, 512} fails the conversion with a clear message 
([Sha2RexCallConverter.isSuitable](https://github.com/TianJialong/gluten/blob/main-hash/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/Sha2RexCallConverter.java#L45-L67)),
 so `SHA2(s, 0)` fails before any input is processed, empty table included — 
the same input-independent stage as Flink's check in the generated operator's 
constructor 
([CodeGeneratorContext.scala:1047-1056](https://github.com/apache/flink/blob/release-1.19/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGeneratorContext.scala#L1047-L1056)).
 NULL constants and column references keep the per-row runtime rejection in 
velox, as requested.
   
   Tests: constant 0 / 385 / -1 (INT) and 0 (folded BIGINT) fail to convert; 
valid INT and BIGINT constants and a NULL constant still convert 
([RexNodeConverterTest.java:122-203](https://github.com/TianJialong/gluten/blob/main-hash/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/RexNodeConverterTest.java#L122-L203))
 — the old constant-0 pass-through pin is replaced by these. End-to-end, the 
constant form now fails at submission while the column form still fails the job 
at runtime 
([HashFunctionsTest.java:104-149](https://github.com/TianJialong/gluten/blob/main-hash/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/HashFunctionsTest.java#L104-L149)).
   



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