Kontinuation commented on code in PR #12346: URL: https://github.com/apache/iceberg/pull/12346#discussion_r2002239402
########## api/src/main/java/org/apache/iceberg/types/Types.java: ########## @@ -543,6 +568,124 @@ public int hashCode() { } } + public static class GeometryType extends PrimitiveType { + + private final String crs; + + private GeometryType(String crs) { + this.crs = (crs == null || crs.isEmpty()) ? null : crs; + } + + public static GeometryType crs84() { + return new GeometryType(null); + } + + public static GeometryType of(String crs) { + return new GeometryType(crs); + } + + @Override + public TypeID typeId() { + return TypeID.GEOMETRY; + } + + public String crs() { + return crs; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (!(o instanceof GeometryType)) { + return false; + } + + GeometryType that = (GeometryType) o; + return Objects.equals(crs, that.crs); + } + + @Override + public int hashCode() { + return Objects.hash(GeometryType.class, crs); + } + + @Override + public String toString() { + if (Strings.isNullOrEmpty(crs)) { Review Comment: Fixed. Now we only check for `null`. ########## 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: Removed `isEmpty`. -- 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