-
Notifications
You must be signed in to change notification settings - Fork 68
Disable inserting NULL into columns marked NOT NULL #446
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
Disable inserting NULL into columns marked NOT NULL #446
Conversation
} | ||
auto ¬_null_constraint = constraint->Cast<NotNullConstraint>(); | ||
if (not_null_constraint.index.IsValid() && not_null_constraint.index.index == column.pos) { | ||
required = true; |
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.
Bit of a nitpick, so if there's no other reason to touch the PR, feel free to ignore:
this can use a break
to skip the other constraints
|
||
if (partition_id.IsValid()) { | ||
data_file.partition_spec_id = static_cast<int32_t>(partition_id.GetIndex()); | ||
if (partition_id) { |
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.
This if/else is redundant now
Also, I am weary of using ic_table.table_info.table_metadata.default_spec_id
here, because that is taken from the rest_api_objects::TableMetadata
, which has an accompanying has_default_spec_id
, which I'm not sure is checked.
Though that bool could only be used for stage-create, when a spec_id is not assigned to the table yet ?
Not sure
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.
So I'm pretty sure the default spec id is required in the table metadata response, since the optional
field is missing here
That was also the experience I had when creating a table, the catalog would error if no spec id was set.
We set it in IcebergCreateTableRequest::CreateTableToJSON
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.
but it is redundant yes
Tests structs and primitive types. Have not yet figured out how create a map type with a
NOT NULL
requirement for lists and maps. I've stepped through the code though, and we should still throw an error in these cases