Hi, Why does flink sql-client allows altering column types from nullable to non nullable?Here is an example
- CREATE CATALOG paimon WITH ('type' = 'paimon', 'warehouse' = 'file:/Users/ashish/Documents/flink-1.20.1/paimon_warehouse'); - USE CATALOG paimon; - CREATE TABLE evolution_test(field1 INT, field2 INT, PRIMARY KEY (field1) NOT ENFORCED); - DESCRIBE evolution_test; +--------+------+-------+-------------+--------+-----------+ | name | type | null | key | extras | watermark | +--------+------+-------+-------------+--------+-----------+ | field1 | INT | FALSE | PRI(field1) | | | | field2 | INT | TRUE | | | | +--------+------+-------+-------------+--------+-----------+ - INSERT INTO evolution_test VALUES (1, 1); - INSERT INTO evolution_test VALUES (2, CAST (NULL AS INT)); - SELECT * FROM evolution_test; # this returns rows correctly - ALTER TABLE evolution_test MODIFY field2 INT NOT NULL; - SELECT * FROM evolution_test; # this fails as field2 has null value written into it but schema specifies that field2 can't be null It would have made sense to allow converting NON NULL type to NULL but this doesn't make sense. This also defeats the purpose of ensuring newly added column is nullable.Example continue from above - ALTER TABLE evolution_test ADD (field3 INT NOT NULL); # this fails as it expects the newly added fields as nullable. # but if I follow the route of adding new column as nullable and then converting it to non null it works - ALTER TABLE evolution_test ADD (field3 INT); - ALTER TABLE evolution_test MODIFY field3 INT NOT NULL; # this succeeds -- Thanks & regards Ashish Khatkar