jiangxt2 commented on code in PR #12275:
URL: https://github.com/apache/gravitino/pull/12275#discussion_r3826932090


##########
catalogs-contrib/catalog-jdbc-clickhouse/src/main/java/org/apache/gravitino/catalog/clickhouse/converter/ClickHouseTypeConverter.java:
##########
@@ -162,8 +162,11 @@ public Type toGravitino(JdbcTypeBean typeBean) {
       case DATE:
         return Types.DateType.get();
       case DATE32:
-        // Date32 supports 1900-2299 vs Date's 1970-2149. Use ExternalType to 
preserve round-trip.
-        return Types.ExternalType.of(DATE32);
+        // Date32 supports 1900-2299 vs Date's 1970-2149-06-06. Map to 
DateType as a lossy
+        // downgrade: writing DateType yields Date (not Date32), and 
out-of-range Date32 values
+        // are silently saturated by ClickHouse (e.g. 1900-01-01 -> 
1970-01-01). Use
+        // ExternalType("Date32") when lossless round-trip of the wider range 
is required.
+        return Types.DateType.get();

Review Comment:
   Thanks for pointing this out. DateType cannot distinguish ClickHouse Date 
from Date32, so I kept Date32 as ExternalType("Date32") to preserve its type 
and range. The fix is in commit 7975bc455, and the relevant tests pass.



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