zhangshenghang opened a new pull request, #12158:
URL: https://github.com/apache/seatunnel/pull/12158
## Purpose
SAP HANA defines NCHAR as a fixed-length Unicode string type, but the SAP
HANA type converter had no entry for it. Catalog introspection of a NCHAR
column therefore fell into the default branch and failed with
`convertToSeaTunnelTypeError` instead of being mapped to a string column.
NCHAR semantics (fixed-length Unicode string) match NVARCHAR for the
purposes of the SeaTunnel type system, so this change registers NCHAR in the
same case group and lets it round-trip through the existing string conversion
path.
## Changes
- `SapHanaTypeConverter`
- Add `HANA_NCHAR = "NCHAR"` constant alongside the other string types.
- Add `HANA_NCHAR` to the `shouldAppendLength` list so
`appendColumnSizeIfNeed` emits `NCHAR(<length>)` and `removeColumnSizeIfNeed`
strips it back to the bare type name.
- Group `HANA_NCHAR` into the existing `HANA_NVARCHAR` / `HANA_SHORTTEXT`
case, which maps it to `STRING_TYPE` with `charTo4ByteLength(length)`.
- `SapHanaTypeConverterTest#testConvertChar`: add a NCHAR conversion case
that asserts the column name, data type, four-byte length, and source type are
preserved.
## Validation
```
./mvnw -pl seatunnel-connectors-v2/connector-jdbc \
-Dtest=SapHanaTypeConverterTest#testConvertChar \
-Dcheckstyle.skip -Dspotless.check.skip test
```
Result: `Tests run: 1, Failures: 0, Errors: 0, Skipped: 0`
## Impact
- Behavior change: NCHAR columns now convert to `STRING_TYPE` instead of
throwing. Other SAP HANA types, source mapping, and existing round-trips are
unchanged.
- No new public API, no configuration 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]