markhoerth opened a new issue, #10750:
URL: https://github.com/apache/gravitino/issues/10750

   ### Describe the feature
   
   CREATE TABLE AS SELECT (CTAS) is currently unsupported in the Gravitino 
Iceberg connector when queried via Trino. Attempting CTAS returns:
   
   ```
   This connector does not support creating tables with data
   ```
   
   Native Apache Iceberg catalogs accessed directly via Trino support CTAS. The 
limitation is specific to the Gravitino connector wrapper.
   
   ### Motivation
   
   CTAS is a standard and commonly-used SQL pattern for creating Iceberg tables 
from existing data sources — particularly during lakehouse migrations, ETL 
pipeline development, and exploratory data work. 
   
   Without CTAS, users must fall back to a two-step CREATE TABLE + INSERT INTO 
pattern. This is not only more verbose, but introduces a failure mode: if the 
CREATE succeeds but the INSERT fails (e.g. due to a timeout or transient 
error), the table is registered in the Iceberg REST catalog pointing to 
metadata files that were never written. Subsequent attempts to DROP or reload 
the table then fail because the connector tries to load the missing metadata 
before executing the drop. Recovery requires bypassing Gravitino entirely and 
calling the IRC REST API directly.
   
   CTAS support would eliminate this failure mode entirely by making table 
creation and data load atomic.
   
   
   ### Describe the solution
   
   Implement CTAS support in the Gravitino Iceberg connector so that `CREATE 
TABLE ... AS SELECT` queries issued via Trino (and Spark) are passed through 
correctly to the underlying Iceberg REST catalog. The behavior should be 
consistent with what a user would expect from a native Iceberg catalog — the 
table is created and populated atomically, and if the operation fails no 
partial registration is left behind.
   
   ### Additional context
   
   Discovered while working through end-to-end Iceberg setup with Gravitino 
1.2.0, Trino, and standard Apache Spark 3.5.5. Related to #10698 (multi-level 
namespace) and the Iceberg connector JAR compatibility investigation. The 
orphaned-registration failure mode caused by the missing CTAS support is 
documented in the companion bug filed in that thread.


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

Reply via email to