Csaba Ringhofer created IMPALA-15364:
----------------------------------------

             Summary: Should not allow adding "not null" column without default 
in Iceberg
                 Key: IMPALA-15364
                 URL: https://issues.apache.org/jira/browse/IMPALA-15364
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Csaba Ringhofer


create table ticenonnull (i int not null) stored as iceberg;
insert into ticenonnull values (1);
alter table ticenonnull add columns (j int not null);

My expectation was that adding a non null column without default value is 
rejected, because existing rows wouldn't have a valid value for that column
What actually happens is that not null is silently omitted and a nullable 
column is added:

describe ticenonnull;
+------+------+---------+----------+
| name | type | comment | nullable |
+------+------+---------+----------+
| i  | int |     | false  |
| j  | int |     | true   |
+------+------+---------+----------+

Kudu tables have a check to reject the alter table:
https://github.com/apache/impala/blob/ac16a39210df9999f8dd1941e3fa513594f9aab2/fe/src/main/java/org/apache/impala/analysis/AlterTableAddColsStmt.java#L124

One question is whether to allow this if the table is empty - at the moment the 
behavior is still buggy (ignoring NOT NULL), but in theory it could be done.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to