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


##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -70,6 +76,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:
   I think that this should validate the algorithm and pass the algorithm enum 
symbol instead of a string. That avoids being able to compile with a typo 
(because `EdgeInterpolationAlgorithm.VINCENTI` is not a symbol) instead of 
allowing code paths that contain `"vincenti"`.



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