nevzheng opened a new pull request, #11958:
URL: https://github.com/apache/gravitino/pull/11958
### What changes were proposed in this pull request?
Adds native `Types.GeometryType(crs)` and `Types.GeographyType(crs,
algorithm)` to Gravitino's unified type system, so Iceberg V3 geospatial
columns load through the native metadata API as first-class types instead of
the read-only `ExternalType("GEOMETRY")` / `ExternalType("GEOGRAPHY")` stopgap,
and become creatable through Gravitino.
- **api**: `Type.Name.GEOMETRY`/`GEOGRAPHY` + two parameterized
`PrimitiveType`s (modeled on `FixedType`/`DecimalType`). CRS is an opaque
string preserved verbatim and compared case-insensitively; the geography edge
algorithm is validated against the five spec values (`spherical`, `vincenty`,
`thomas`, `andoyer`, `karney`) and normalized to lowercase. Defaults
(`OGC:CRS84`, `spherical`) elide to the bare `geometry`/`geography` token.
- **common (`JsonUtils`)**: registers the default tokens and parses the
parameterized form; the matcher runs against the original (non-lowercased) type
string so a case-sensitive CRS survives the round-trip.
- **catalog-lakehouse-iceberg**: `FromIcebergType`/`ToIcebergType`
round-trip CRS (and algorithm) via the existing `atomic()` path.
- **clients/client-python, docs, OpenAPI**: mirror both types + serde.
### Why are the changes needed?
Iceberg V3 adds `geometry` and `geography` (planar vs. spheroidal geospatial
shapes, WKB-encoded, parameterized by CRS ± edge algorithm). Today they load as
`external(GEOMETRY/GEOGRAPHY)`, which drops the CRS/algorithm to a bare name
and is opaque to consumers (external types have caused downstream issues —
#10957, #11805), and the write path throws. Native types preserve the
parameters and make the columns writable. As a catalog, Gravitino only
describes the column and preserves metadata; it does not interpret the WKB.
Fix: #11955
### Does this PR introduce _any_ user-facing change?
Yes. New unified types `Types.GeometryType` / `Types.GeographyType` (Java +
Python), with JSON tokens `geometry` / `geometry(<crs>)` and `geography` /
`geography(<crs>,<algorithm>)`. Iceberg `geometry`/`geography` columns now load
natively and can be created via Gravitino at `format-version = 3`. No
property-key changes.
### How was this patch tested?
- Unit: `TestTypes` (contract + validation + case-insensitivity),
`TestJsonUtils` (JSON serde incl. mixed-case CRS), `TestConvertUtil` (converter
both directions, non-default CRS/algorithm); Python `test_types.py` +
`test_type_serdes.py` (serialize/deserialize round-trip for
`geometry(srid:3857)` and `geography(EPSG:4326,karney)`).
- Integration (REST/IRC backend): `CatalogIcebergRestIT` —
`testV3TypeConversionViaIcebergClient` (IRC→Gravitino native load),
`testCreateGeometryColumnWriteRoundTrip` and
`testCreateGeographyColumnWriteRoundTrip` (Gravitino→IRC write round-trip). Ran
green: 3 tests, 0 skipped, 0 failures.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]