Repository navigation
[Server] Support geometry and geography in the Iceberg REST catalog - #2371
timothyw553 wants to merge 3 commits into
Conversation
03177b5 to
9e9663e
Compare
timothyw553
left a comment
There was a problem hiding this comment.
two comments on projjson: crs handling and test coverage.
4303e23 to
930ac5c
Compare
timothyw553
left a comment
There was a problem hiding this comment.
conversion logic looks good overall, main question is spark compatibility for some of the crs/algorithm values we still accept. also left one smaller comment on the projjson: error message.
| * Delta clients only parse {@code <authority>:<code>}, so a table with another CRS would be | ||
| * unreadable to them. | ||
| */ | ||
| private static String geoTypeString(String geoType, String crs) { |
There was a problem hiding this comment.
this validates against delta kernel's grammar, right? i checked spark 4.1–4.3 and epsg:4326, srid:4326, SRID:4326, plus karney/vincenty all still fail to read (and EPSG:4326 fails on 4.1.1). should we clarify whether we're guaranteeing kernel compatibility or spark readability, and either restrict to what spark supports or document the subset?
There was a problem hiding this comment.
Clarified the Javadoc so it describes the Delta protocol / Kernel grammar that UC validates against rather than a single Spark version's reader subset.
| if (crs.toLowerCase(Locale.ROOT).startsWith("projjson:") | ||
| || ColumnUtils.resolveGeoTypeName(geoType) == null) { | ||
| throw new BadRequestException( | ||
| "Iceberg type %s is not supported by Unity Catalog: the CRS must be <authority>:<code>", |
There was a problem hiding this comment.
the error message for projjson:crs_def is a bit misleading since it already matches <authority>:<code>. to my understanding we're rejecting it because iceberg treats it as a table-property reference that wouldn't resolve here, not because of the format. could we split the message and update the comment/tests?
- if (crs.toLowerCase(Locale.ROOT).startsWith("projjson:")
- || ColumnUtils.resolveGeoTypeName(geoType) == null) {
+ if (crs.toLowerCase(Locale.ROOT).startsWith("projjson:")) {
+ throw new BadRequestException(
+ "Iceberg type %s is not supported by Unity Catalog: "
+ + "PROJJSON table-property CRS references are not supported",
+ geoType);
+ }
+ if (ColumnUtils.resolveGeoTypeName(geoType) == null) {There was a problem hiding this comment.
Added an explicit BadRequestException for projjson: CRS references with a clearer error message and updated the unit test to match.
930ac5c to
91218fa
Compare
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Approving. The Iceberg mapping matches the 1.11.0 types and the Iceberg spec, and the converter runs before any metadata write.
Non-blocking question: should an Iceberg srid:N CRS map to EPSG:N, or be rejected? Delta uses authority:code forms, so geometry(srid:4326) is not the Delta spelling of 4326.
390395d to
dde86ef
Compare
|
/review |
1 similar comment
|
/review |
Add GEOMETRY and GEOGRAPHY to ColumnTypeName in api/all.yaml (appended so existing ordinals stay unchanged). Widen the ordinal CHECK constraints on uc_functions.data_type and uc_function_params.type_name from 0..21 to 0..23 across H2, PostgreSQL, and MySQL: - V24 / V26 (SQL): add named CHECK (0..23) constraints on uc_functions and uc_function_params. - V25 / V27 (Java migrations): look up and drop the old unnamed 0..21 CHECK constraints by clause so upgrades work on both fresh and repaired databases. Update SchemaMigrator, MigrationStepRulesTest, docs/server/upgrades.md, and schema-effects for all three databases, and add SdkFunctionCRUDTest coverage for GEOMETRY and GEOGRAPHY function parameters and return types. Signed-off-by: Timothy Wang <[email protected]>
Resolve the geo type strings Delta Kernel parses (geometry[(crs)], geography[(crs[, algorithm])|(algorithm)]) to GEOMETRY and GEOGRAPHY, and keep the string as type_text so the CRS and algorithm survive. type_json already carries it. Without this a Delta table with a geo column is rejected at create time as an unsupported primitive. A geography algorithm Delta does not define is rejected with INVALID_ARGUMENT, as Kernel does; other malformed forms fall through to the existing unsupported-primitive error. Signed-off-by: Timothy Wang <[email protected]>
Iceberg 1.11 defines geometry(crs) and geography(crs, algorithm), so map them to GEOMETRY and GEOGRAPHY instead of rejecting the table, and drop the comment that said Iceberg has no such types. type_text and type_json carry the Delta form, geometry(<crs>) and geography(<crs>, <algorithm>). Iceberg accepts any CRS string, but Delta clients only parse <authority>:<code>, so another CRS is rejected up front rather than stored as a type they can't read. Signed-off-by: Timothy Wang <[email protected]>
dde86ef to
4bed744
Compare
🥞 Stacked PR
Use this link to review incremental changes.
PR Checklist
docsis updated (in [CLI/UI/Docs] Support and document geometry and geography columns #2373)Description of changes
Maps Iceberg 1.11
geometry(crs)andgeography(crs, algorithm)types inIcebergSchemaConvertertoColumnTypeName.GEOMETRYandColumnTypeName.GEOGRAPHY, formattingtype_textandtype_jsonin Delta's form (geometry(<crs>)andgeography(<crs>, <algorithm>)with lowercase algorithm). Rejects CRS strings outside<authority>:<code>(includingprojjson:<property-name>table-property references and inline PROJJSON) with400 Bad Requestso Delta clients are not left with unreadable metadata.Tested with
IcebergSchemaConverterTest(top-level and nested geo types,projjson:and inline PROJJSON rejection) andIcebergRestCatalogTest(create, schema commit, and 400 rejection verifying persisted column metadata).