rdblue commented on code in PR #12346: URL: https://github.com/apache/iceberg/pull/12346#discussion_r2008321522
########## api/src/test/java/org/apache/iceberg/types/TestTypes.java: ########## @@ -79,6 +95,77 @@ public void fromPrimitiveString() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> Types.fromPrimitiveString("abcdefghij")) .withMessage("Cannot parse type string to primitive: abcdefghij"); + + assertThat(Types.fromPrimitiveString("geometry")).isEqualTo(Types.GeometryType.crs84()); + assertThat(Types.fromPrimitiveString("Geometry")).isEqualTo(Types.GeometryType.crs84()); + assertThat(Types.fromPrimitiveString("geometry(srid:3857)")) + .isEqualTo(Types.GeometryType.of("srid:3857")); + assertThat(Types.fromPrimitiveString("geometry( srid:3857 )")) + .isEqualTo(Types.GeometryType.of("srid:3857")); + assertThat(Types.fromPrimitiveString("geometry( srid: 3857 )")) + .isEqualTo(Types.GeometryType.of("srid: 3857")); + assertThat(Types.fromPrimitiveString("Geometry( projjson:TestIdentifier )")) + .isEqualTo(Types.GeometryType.of("projjson:TestIdentifier")); + + assertThatExceptionOfType(IllegalArgumentException.class) + .isThrownBy(() -> Types.fromPrimitiveString("geometry()")) + .withMessageContaining("Cannot parse type string to primitive"); Review Comment: @szehon-ho what do you think the behavior here should be? I would expect it to match the following case and throw `Invalid CRS: (empty string)`. -- 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