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

   **Version:** main branch
   
   **Describe what's wrong**
   INSERT into Iceberg tables partitioned by time-based transforms (`days()`, 
`hours()`, `months()`, `years()`) fails with an `AnalysisException` when using 
the Gravitino Spark Glue connector.
   
   **Error message and/or stacktrace**
   ```
   AnalysisException: [CANNOT_UP_CAST_DATATYPE] Cannot up cast days(ts) from 
"INT" to "VOID".
   ```
   
   **How to reproduce**
   1. Configure a Gravitino Spark Glue catalog
   2. Run the following SQL:
   ```sql
   CREATE TABLE orders (id INT, ts TIMESTAMP)
   USING iceberg PARTITIONED BY (days(ts));
   
   INSERT INTO orders VALUES (1, TIMESTAMP '2024-01-01 12:00:00');
   ```
   3. INSERT fails with AnalysisException
   
   **Additional context**
   Root cause: `GravitinoGlueCatalog` does not override `loadFunction`. During 
INSERT planning, Spark calls `loadFunction` to resolve partition functions like 
`days()`. `BaseCatalog.loadFunction` only queries the Gravitino server's 
function registry, which does not include Iceberg built-in functions. 
`GravitinoIcebergCatalog` already handles this correctly by delegating to the 
underlying Iceberg `SparkCatalog`.


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