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

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `BaseCatalog.createTable` maps every Flink column to a plain physical 
Gravitino column and ignores watermarks. A `CREATE TABLE` with a computed 
column, a metadata column or a watermark succeeds, but the table that comes 
back has a different schema: the computed or metadata column is now a nullable 
physical column, and the watermark is gone. This happens in the Paimon, Iceberg 
and JDBC catalogs, and for Hive tables created with `'connector'='hive'`. 
`ALTER TABLE t ADD b AS a + 1` has the same problem.
   
   ### Error message and/or stacktrace
   
   ```
   Column types of query result and sink for 'cat.db.t' do not match. Cause: 
Different number of columns.  Query schema: [EXPR$0: INT NOT NULL] Sink schema: 
 [a: INT, b: INT]
   ```
   
   ### How to reproduce
   
   In a Paimon, Iceberg or MySQL catalog managed by Gravitino:
   
   ```sql
   CREATE TABLE t (a INT, b AS a + 1);   -- succeeds; Gravitino stores b as a 
nullable INT column
   INSERT INTO t VALUES (1);            -- fails with the error above
   INSERT INTO t (a) VALUES (1);
   SELECT a, b FROM t;                  -- returns 1, NULL instead of 1, 2
   ```
   
   In the Paimon catalog, `CREATE TABLE t2 (a INT, ts TIMESTAMP(3), WATERMARK 
FOR ts AS ts - INTERVAL '5' SECOND)` also succeeds, and `t2` comes back without 
the watermark.
   
   ### Additional context
   
   Iceberg's own Flink catalog rejects these tables ("Creating table with 
computed columns is not supported yet."). Paimon's own Flink catalog keeps 
computed columns and watermarks in table options.
   


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