jiangxt2 opened a new issue, #12272:
URL: https://github.com/apache/gravitino/issues/12272

   ### What would you like to be improved?
   
   ClickHouse Date32 (range 1900–2299) currently maps to ExternalType via the 
default branch in `ClickHouseTypeConverter.toGravitino()`. Gravitino already 
has a `Types.DateType` which represents a calendar date and is the closest 
native match.
   
   Additionally, ClickHouse Enum8/Enum16 types are not covered by integration 
tests, leaving a gap in verifying their round-trip correctness through the 
Gravitino type system.
   
   ### How should we improve?
   
   1. **Date32 → DateType**: Add `case DATE32: return Types.DateType.get()` in 
`toGravitino()`. This is a one-way downgrade — the read path maps Date32 to 
DateType, but the write path maps DateType back to `Date` (not `Date32`), 
because `fromGravitino` maps `DateType` to the `Date` string without preserving 
the source precision. This is consistent with the existing `DateTime64(3)` → 
`TimestampType.withoutTimeZone(3)` → `DateTime(0)` pattern, where 
`fromGravitino` maps `TimestampType` back to `DateTime` (dropping sub-second 
precision) rather than `DateTime64(3)`. Users who need the full 1900–2299 range 
can use ExternalType explicitly when creating tables.
   
   2. **Enum IT test**: Add an integration test that:
      - Creates a ClickHouse table with Enum8 and Enum16 columns
      - Verifies they load as ExternalType with the full enum definition 
preserved (including spaces and equals signs)
      - Validates round-trip: recreating the table through Gravitino using the 
loaded schema and confirming the DDL output matches the original
   


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