MisterRaindrop opened a new pull request, #904:
URL: https://github.com/apache/iceberg-cpp/pull/904

   Next step of the HiveCatalog split (follows #796). Two conversion layers 
between Iceberg's catalog model and the Hive Metastore record shape — no 
Thrift, no I/O, fully unit tested.
   
   - **`hive_schema`** — `TypeToHiveString()` / `SchemaToHiveColumns()` render 
an Iceberg `Schema` as the Hive DDL column list HMS stores. Nested struct / 
list / map render recursively; types Hive cannot express fall back to the 
closest equivalent (time, string, uuid → `string`; binary, fixed → `binary`).
   - **`hive_utils`** — `Namespace` / `TableIdentifier` ↔ HMS `Database` / 
`Table` conversion, plus the Iceberg-on-HMS parameter keys 
(`metadata_location`, `table_type=ICEBERG`, `EXTERNAL=TRUE`) and the 
LazySimpleSerDe storage descriptor that keeps Spark and Trino reading tables 
this catalog creates. These deliberately produce plain structs rather than 
Thrift objects, so `HmsClient` stays the only translation unit that includes 
the generated bindings.
   
   Two places where the reference implementations disagree, and the choice made:
   
   - **`timestamptz`** → Hive `timestamp with local time zone`, following 
iceberg-java's `HiveSchemaUtil`. Engines reading through HMS take their column 
types from this DDL, so a naive `timestamp` would misrepresent a tz-adjusted 
column. iceberg-rust instead rejects zoned timestamps outright, which would 
make such tables uncreatable. Java's sub-Hive-3 fallback to plain `timestamp` 
is not reproduced: there is no Hive-version probe here, the vendored Metastore 
IDL is Hive 4.0.1, and Hive 2 is long end-of-life.
   - **database owner** → carried by `hive.metastore.database.owner` / 
`hive.metastore.database.owner-type`, the keys both iceberg-java 
(`HiveCatalog.HMS_DB_OWNER`) and iceberg-rust use; a bare `owner` is the 
*table* owner key. `owner-type` must accompany an owner and must name an HMS 
`PrincipalType` — USER, GROUP or ROLE, compared case-insensitively — so an 
unusable value fails here rather than at the Thrift boundary.
   
   Iceberg v3 types that neither reference maps to a real Hive type 
(`timestamp_ns`, `geometry`, `geography`, `unknown`) return `kNotImplemented` 
rather than guessing a DDL spelling. `variant`, which iceberg-java maps to 
`unknown`, is left for a follow-up together with the rest.
   
   Nothing calls these yet — `HiveCatalog` remains a stub. `HmsClient`'s Thrift 
wrappers and the catalog CRUD paths come next.
   
   33 new unit tests; `hive_catalog_test` goes from 17 to 50 cases.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to