leaves12138 commented on code in PR #9251:
URL: https://github.com/apache/paimon/pull/9251#discussion_r3792109171


##########
paimon-core/src/main/java/org/apache/paimon/iceberg/metadata/IcebergDataField.java:
##########
@@ -196,6 +199,16 @@ private static Object toTypeObject(DataType dataType, int 
fieldId, int depth) {
                 return timestampLtzPrecision >= 7 ? "timestamptz_ns" : 
"timestamptz";
             case VARIANT:
                 return "variant";
+            case GEOMETRY:
+                return String.format("geometry(%s)", ((GeometryType) 
dataType).getCrs());

Review Comment:
   Could we validate the geometry CRS against Iceberg's serialized type grammar 
before enabling Iceberg metadata? `GeometryType` currently accepts any 
non-empty string, so a valid Paimon schema such as `GEOMETRY('foo)bar')` is 
serialized here as `geometry(foo)bar)`. Iceberg 1.11's 
`Types.fromTypeName("geometry(foo)bar)")` rejects that string, which makes the 
generated metadata unreadable by Iceberg. We already reject commas for 
geography; please similarly reject `)` for geometry when Iceberg metadata is 
enabled (and add a regression test). It would also be safer to normalize or 
reject leading/trailing CRS whitespace because Iceberg trims it while parsing.



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