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


##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -70,6 +76,25 @@ 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()) {
+        String algorithmName = geography.group(2);
+        EdgeAlgorithm algorithm =
+            (algorithmName == null || algorithmName.isEmpty())

Review Comment:
   Why is `algorithmName.isEmpty` valid here? I think it should be an error if 
the type is passed as `"geography(srid:1234,)"`. If there is a non-null string 
then it must be a valid algorithm name. When there is no comma, the second 
capture group is null, so removing this `isEmpty` check will fix it.



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