Kontinuation commented on code in PR #12346:
URL: https://github.com/apache/iceberg/pull/12346#discussion_r1982612715


##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -70,6 +74,20 @@ public static Type fromTypeName(String typeString) {
       return TYPES.get(lowerTypeString);
     }
 
+    if (lowerTypeString.startsWith("geometry")) {
+      Matcher geometry = GEOMETRY_PARAMETERS.matcher(typeString.substring(8));
+      if (geometry.matches()) {
+        return GeometryType.of(geometry.group(1));
+      }
+    }
+
+    if (lowerTypeString.startsWith("geography")) {
+      Matcher geography = 
GEOGRAPHY_PARAMETERS.matcher(typeString.substring(9));
+      if (geography.matches()) {
+        return GeographyType.of(geography.group(1), geography.group(2));
+      }

Review Comment:
   We'll throw an `IllegalArgumentException` at the bottom of this function if 
none of the pattern matches: `"Cannot parse type string to primitive: " + 
typeString`. I think this is already informative. Do you think that we need a 
more specific error message for geospatial types?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to