JingsongLi commented on code in PR #11235:
URL: https://github.com/apache/paimon/pull/11235#discussion_r4624013556
##########
paimon-mosaic/src/main/java/org/apache/paimon/format/mosaic/MosaicFileFormat.java:
##########
@@ -215,11 +215,25 @@ public Void visit(TimeType timeType) {
@Override
public Void visit(TimestampType timestampType) {
- return null;
+ return validateTimestampPrecision(timestampType.getPrecision());
}
@Override
public Void visit(LocalZonedTimestampType localZonedTimestampType) {
+ return
validateTimestampPrecision(localZonedTimestampType.getPrecision());
+ }
+
+ /**
+ * Precision 0 is mapped to the Arrow SECOND unit, which the native
writer rejects with
+ * "unsupported Timestamp unit: Second", so reject it while the schema
is validated instead
+ * of failing on the first write.
+ */
+ private Void validateTimestampPrecision(int precision) {
+ if (precision == 0) {
Review Comment:
[P1] Keep existing Mosaic tables readable after upgrade
`validateDataFields` also runs from `AbstractFileStoreTable.runtimeStore`
when planning a read. I used master to create a Mosaic table with an integer
column, commit row `7`, and add a nullable `created_at TIMESTAMP(0)` column.
Master then read `(7, NULL)` from the original file. With this exact change the
same table fails in `newScan()` with `UnsupportedOperationException`, before
reading that file. This is a live upgrade path for tables that evolved before
the first write to the new column. Scope the new validation to new table
definitions or writes and add an upgrade read test for the existing schema.
--
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]