GitHub user danny0405 added a comment to the discussion: Native SQL DDL support for Hudi table creation across engines (Trino, Presto etc.)
sounds like you want some function similar with the catalog, it actually makes sense: Trino supports table-creation APIs through its connector SPI, but the current Hudi connector does **not** implement them. Today, the Trino Hudi connector is read-only and expects Hudi tables to already exist and be synchronized to Hive Metastore. [[Trino’s documentation says this explicitly](https://trino.io/docs/current/connector/hudi.html)](https://trino.io/docs/current/connector/hudi.html). The local implementation confirms it: - [HudiMetadata.java](/Users/chenyuzhao/workspace/hudi-commu/hudi-trino-plugin/src/main/java/io/trino/plugin/hudi/HudiMetadata.java:109) implements only read/metadata operations—no `createTable()` or `beginCreateTable()`. - [HudiConnector.java](/Users/chenyuzhao/workspace/hudi-commu/hudi-trino-plugin/src/main/java/io/trino/plugin/hudi/HudiConnector.java:94) provides a page source but no page sink, so it cannot write data. - [HudiTableProperties.java](/Users/chenyuzhao/workspace/hudi-commu/hudi-trino-plugin/src/main/java/io/trino/plugin/hudi/HudiTableProperties.java:31) currently exposes only `location` and `partitioned_by`. It is feasible to add empty-table creation using Trino SQL. The connector would implement Trino’s `ConnectorMetadata.createTable()` and: 1. Validate the schema and Hudi properties. 2. Initialize the physical Hudi table and `.hoodie` metadata. 3. Register the table in HMS. 4. Roll back initialization if catalog registration fails. The prospective Trino syntax would look like: ```sql CREATE TABLE hudi.sales.trips ( id BIGINT, event_time TIMESTAMP(6), rider VARCHAR, city VARCHAR ) WITH ( location = 's3://warehouse/sales/trips', table_type = 'COPY_ON_WRITE', primary_key = ARRAY['id'], precombine_field = 'event_time', partitioned_by = ARRAY['city'] ); ``` Those additional properties are illustrative—they would need to be added to the connector. Trino does not use Spark’s `USING hudi` syntax; the `hudi` catalog identifies the connector. A sensible staged design would be: - First: empty `CREATE TABLE` and perhaps `register_table` for an existing Hudi location. - Later: `CREATE TABLE AS SELECT` and `INSERT`, which additionally require `beginCreateTable()`, a page-sink implementation, and Hudi commit/write handling. [[Trino documents those write-side SPI requirements here](https://trino.io/docs/current/develop/insert.html)](https://trino.io/docs/current/develop/insert.html). So the short answer is: **Trino has the necessary catalog SPI, and we can make this work, but the current Hudi connector does not support it yet.** cc @voonhous for the support for Trio Hudi SQL table creation/management. GitHub link: https://github.com/apache/hudi/discussions/19484#discussioncomment-17902950 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
