New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow adding not null column when Delta Lake table is not empty #13785
Conversation
Read timed out happened. I hope #13746 fixes the issue.
|
The release note seems to be backwards? |
@electrum Thanks, fixed. |
@@ -1153,7 +1153,7 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle | |||
columnsBuilder.build(), | |||
partitionColumns, | |||
columnComments.buildOrThrow(), | |||
columnNullability.buildOrThrow(), | |||
columnsNullability.buildOrThrow(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be a separate commit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's related: we allow adding NOT NULL for empty tables
(previously it was ignored)
i think it;s fine to keep as one commit
@@ -1116,6 +1116,10 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle | |||
DeltaLakeTableHandle handle = (DeltaLakeTableHandle) tableHandle; | |||
checkSupportedWriterVersion(session, handle.getSchemaTableName()); | |||
|
|||
if (!newColumnMetadata.isNullable() && !metastore.getValidDataFiles(handle.getSchemaTableName(), session).isEmpty()) { | |||
throw new TrinoException(DELTA_LAKE_BAD_WRITE, format("Unable to add NOT NULL column '%s' for non empty table: %s.%s", newColumnMetadata.getName(), handle.getSchemaName(), handle.getTableName())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO "non-empty" should be with a hyphen
@@ -1153,7 +1153,7 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle | |||
columnsBuilder.build(), | |||
partitionColumns, | |||
columnComments.buildOrThrow(), | |||
columnNullability.buildOrThrow(), | |||
columnsNullability.buildOrThrow(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's related: we allow adding NOT NULL for empty tables
(previously it was ignored)
i think it;s fine to keep as one commit
Additionally, stores the correct nullability when adding a new column. It was always nullable before this change.
26cf070
to
563391b
Compare
Description
Relates to #13587
Documentation
(x) No documentation is needed.
Release notes
(x) Release notes entries required with the following suggested text: