zhang-jianq opened a new issue, #13635:
URL: https://github.com/apache/gluten/issues/13635

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   ### Background
   
   Flink's hash expressions (`MD5`, `SHA1`, `SHA2` / `SHA224` / `SHA256` / 
`SHA384` / `SHA512`)
   accept the STRING family, which includes binary types, and hash the raw 
bytes of the input,
   returning a lowercase hex string. Native reference (Flink 1.19.x):
   
   `SELECT MD5(X'6162')` -> `187ef4436122d1cc2f40dc2b92f0eba0`, the same as 
`MD5('ab')`.
   
   gluten-flink currently supports VARCHAR only:
   
   - velox's flinksql hash functions register `Varchar` input signatures only;
   - `LogicalTypeConverter` has no `VarBinaryType` mapping, so any `BYTES` 
column or expression
     fails at planning with `java.lang.RuntimeException: Unsupported logical 
type: BYTES NOT NULL`
     before the hash converter is reached.
   
   The SHA-2 family (#13484) has exactly the same limitation, and end-to-end 
runs confirm it
   (gluten fails at planning, native succeeds). This is not specific to 
MD5/SHA1 (#13420).
   
   ### Scope
   
   1. velox (flinksql namespace): register `(Varbinary) -> Varchar` for `md5`, 
`sha1`, `sha2`,
      `sha224`, `sha256`, `sha384`, `sha512`, hashing the raw bytes and 
rendering lowercase hex;
      add gtest coverage for binary input (including empty bytes and NULL).
   2. gluten-flink `LogicalTypeConverter`: map `VarBinaryType` to the velox 
`VarbinaryType`.
   3. Tests: gluten UT with a `BYTES` column (`X'6162'`, empty bytes, NULL) 
plus an end-to-end
      dual-run against native Flink.
   4. Covers MD5/SHA1 (#13420) and the SHA-2 family (#13484).
   
   ### Expected behavior
   
   `MD5(bytes)`, `SHA1(bytes)` and `SHA2(bytes, n)` return the same digests as 
native Flink.
   
   
   ### Gluten version
   
   main branch
   
   ### Spark version
   
   None
   
   ### Spark configurations
   
   _No response_
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   ```bash
   
   ```


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