chovy-3012 opened a new pull request, #13434:
URL: https://github.com/apache/seatunnel/pull/13434

   ### Purpose of this pull request
   
   Add the charset conversion SQL functions `ENCODE(string, charset) -> BINARY` 
and `DECODE(binary, charset) -> STRING` requested in #13378, available on both 
the default Zeta SQL transform and the Calcite SQL transform 
(`EncodeFunction`/`DecodeFunction` registered via `CalciteUdf` SPI, Zeta 
dispatch in `ZetaSQLFunction`).
   
   Only the six documented charset names are accepted, case insensitively and 
with no aliases (`US-ASCII`, `ISO-8859-1`, `UTF-8`, `UTF-16BE`, `UTF-16LE`, 
`UTF-16`); blank or unsupported names fail with `COMMON-08 unsupported 
encoding`, so behavior does not depend on the JVM charset registry. A NULL in 
either argument returns NULL before charset validation; malformed bytes decode 
with the JVM replacement character instead of erroring; the Oracle conditional 
`DECODE` remains out of scope (3 arguments is an argument-count error).
   
   Fixes #13378
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Compared to the released versions and dev, `ENCODE`/`DECODE` are new 
SQL functions: previously both engines failed with `Unsupported function` 
(Zeta) / `No match found` (Calcite), now both return the same results on both 
engines. No existing function, config or default changes — 
`TO_BASE64`/`FROM_BASE64` keep their separate Base64 semantics, and the EN/ZH 
function docs are updated.
   
   ### How was this patch tested?
   
   Unit and engine-parity tests plus E2E IT configs:
   
   ```
   ./mvnw test -pl seatunnel-transforms-v2 -Dtest=SQLEncodeDecodeFunctionsTest
   # Tests run: 10, Failures: 0, Errors: 0 (Zeta + Calcite same assertions)
   ```
   
   Module regression `./mvnw test -pl seatunnel-transforms-v2`: 1999 tests, 0 
failures, 18 skipped (pre-existing). E2E: `func_encode_decode.conf` and 
`calcite_encode_decode_udf.conf` run as real jobs on both engines via 
`TestSQLIT`/`TestCalciteIT` (dev baseline fails both engines with `Unsupported 
function`/`No match found`, this branch passes all 11+11 Assert rules), and an 
18-job real-job matrix covering all 19 contract points from the issue (6 
positive + 12 negative, negative error messages verified verbatim) passed 18/18.
   
   ### 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)
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
   * [ ] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 and add new connector information in it
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in 
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e)
     5. Update connector 
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   
   Notes: no new jar binary (existing `seatunnel-transforms-v2` module only); 
no incompatible change (new functions, no existing behavior modified); 
connector items n/a (Transform-V2, not a connector).
   


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