Kontinuation commented on code in PR #12346: URL: https://github.com/apache/iceberg/pull/12346#discussion_r2017760546
########## api/src/main/java/org/apache/iceberg/types/Types.java: ########## @@ -543,6 +566,135 @@ public int hashCode() { } } + public static class GeometryType extends PrimitiveType { + public static final String DEFAULT_CRS = "OGC:CRS84"; + + public static GeometryType crs84() { + return new GeometryType(); + } + + public static GeometryType of(String crs) { + return new GeometryType(crs); + } + + private final String crs; + + private GeometryType() { + crs = null; + } + + private GeometryType(String crs) { + Preconditions.checkArgument(crs == null || !crs.isEmpty(), "Invalid CRS: (empty string)"); + this.crs = DEFAULT_CRS.equalsIgnoreCase(crs) ? null : crs; + } + + @Override + public TypeID typeId() { + return TypeID.GEOMETRY; + } + + public String crs() { + return crs; Review Comment: I think it is better to return `DEFAULT_CRS`, so that the callers don't have to handle both nulls and default CRS. We can make `GeographyType.algorithm` return `EdgeAlgorithm.SPHERICAL` when algorithm is null as well. -- 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