SEZ9 commented on issue #12714:
URL: https://github.com/apache/seatunnel/issues/12714#issuecomment-6118025123

   Thanks for the detailed report and reproduction. The analysis is consistent 
with what's described: `ArrayType.BYTE_ARRAY_TYPE` is `Byte[].class`, so `arg 
instanceof byte[]` never matches for an `ARRAY<BYTE>` column and 
`StringFunction.md5` falls through to hashing the array's `toString()` value, 
which explains why the output is unrelated to the data and nondeterministic.
   
   Suggested direction: either add a `Byte[]` branch in `StringFunction.md5` 
that unboxes to `byte[]` before hashing, or reject array/non-scalar arguments 
explicitly, as `CryptoFunction.rejectNonScalar` does for the AES functions. 
Either way, the `toString()` fallback should not apply to arrays, and the 
existing primitive `byte[]` behavior must stay unchanged. A regression test 
through the SQL path (`SELECT MD5(arr_col)` on an actual `ARRAY<BYTE>` column), 
plus a primitive `byte[]` control, would guard against this coming back. It may 
also be worth validating `MD5` argument types in 
`ZetaSQLType`/`ZetaSQLFunction` so unsupported inputs fail at plan time instead 
of silently producing wrong output.
   
   Since #12717 has already been identified in this thread as the in-progress 
fix, let's continue there. Please make sure it stays scoped to this issue 
(without unrelated changes) and includes the SQL-path regression described 
above so we can review it.
   
   <!-- streview-comment:1696 -->


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

Reply via email to