chovy-3012 opened a new pull request, #12564:
URL: https://github.com/apache/seatunnel/pull/12564
### Purpose of this pull request
Add a Hive-compatible `MD5(string|binary)` built-in SQL function to the Zeta
SQL transform, as requested in #12563. The function computes the MD5 digest and
returns it as a 32-character lowercase hexadecimal `STRING`; a `null` input
returns `null`, matching Hive's `md5()`.
Motivation: sensitive-data masking, deduplication keys, and Hive-syntax
parity for users migrating Hive pipelines to SeaTunnel.
Changes (6 files, +122 lines, pure addition):
- `ZetaSQLFunction.java`: register the `MD5` constant and add `case MD5`
dispatch.
- `ZetaSQLType.java`: resolve `MD5` return type as `STRING`.
- `StringFunction.java`: implement `md5()` via the shaded Guava
`Hashing.md5()` already imported for `MURMUR64` — no new dependency. Handles
`byte[]` (Hive `md5(binary)`) and string inputs (UTF-8).
- `SQLHashFunctionsTest.java`: add 5 test cases (normal / empty / null /
consistency / Hive-parity).
- `docs/{en,zh}/transforms/sql-functions.md`: document `MD5` after
`MURMUR64`.
Closes #12563
### Does this PR introduce _any_ user-facing change?
Yes — a new built-in SQL function. Pure addition; no existing function or
behavior is changed.
```sql
SELECT MD5('hello world') AS h; -- '5eb63bbbe01eeed093cb22bb8f5acdc3'
SELECT MD5(name) FROM users; -- 32-char lowercase hex of each name
```
### How was this patch tested?
```bash
./mvnw -pl seatunnel-transforms-v2 test -Dtest=SQLHashFunctionsTest
```
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according [New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
— N/A, no new dependency added.
* [x] If necessary, please update the documentation to describe the new
feature. — Updated `docs/en/transforms/sql-functions.md` and
`docs/zh/transforms/sql-functions.md`.
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR. — N/A, pure addition, no incompatible change.
* [ ] If you are contributing the connector code, please check that the
following files are updated — N/A, not a connector change.
--
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]