Kontinuation commented on code in PR #12346: URL: https://github.com/apache/iceberg/pull/12346#discussion_r2002238713
########## 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)) { + return "geometry"; + } + + return String.format("geometry(%s)", crs); + } + } + + public static class GeographyType extends PrimitiveType { + + private final String crs; + private final EdgeAlgorithm algorithm; + + private GeographyType(String crs, EdgeAlgorithm algorithm) { + this.crs = (crs == null || crs.isEmpty()) ? null : crs; + this.algorithm = algorithm; + } + + public static GeographyType crs84() { + return new GeographyType(null, null); + } + + public static GeographyType of(String crs) { + return new GeographyType(crs, null); + } + + public static GeographyType of(String crs, EdgeAlgorithm algorithm) { + return new GeographyType(crs, algorithm); + } + + @Override + public TypeID typeId() { + return TypeID.GEOGRAPHY; + } + + public String crs() { + return crs; + } + + public EdgeAlgorithm algorithm() { + return algorithm; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (!(o instanceof GeographyType)) { + return false; + } + + GeographyType that = (GeographyType) o; + return Objects.equals(crs, that.crs) && Objects.equals(algorithm, that.algorithm); + } + + @Override + public int hashCode() { + return Objects.hash(GeographyType.class, crs, algorithm); + } + + @Override + public String toString() { + if (algorithm != null) { + return String.format( + "geography(%s, %s)", + crs != null ? crs : "", algorithm.name().toLowerCase(Locale.ENGLISH)); Review Comment: Implemented `toString` in the enum to perform `toLowerCase`. -- 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