Skip to content

Honor column defaults on Insert - #70

Draft
hareshkh wants to merge 1 commit into
apache:mainfrom
hareshkh:insert-required-null-check
Draft

hareshkh wants to merge 1 commit into
apache:mainfrom
hareshkh:insert-required-null-check

Conversation

@hareshkh

@hareshkh hareshkh commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Columns omitted from an INSERT were filled with NULL even when the Iceberg field has a write-default, so NOT NULL columns failed and nullable ones lost their default. CREATE TABLE ... DEFAULT also discarded the default.

IcebergCatalogTableProvider now implements get_column_default, returning each top-level primitive column's write-default, and DataFusion fills omitted columns with it. Explicit values, including an explicit NULL, are unchanged.

register_table stores each column's SQL DEFAULT as the field's write-default, folding constant expressions such as 1 + 0.5 with DataFusion's ExprSimplifier. Iceberg stores a value, not an expression, so CREATE TABLE rejects non-constant defaults such as now() or random(), defaults that don't cast to the column's type, and defaults on non-primitive columns.

Verified: workspace tests, formatting, and Clippy with warnings denied. New create_table.slt cases cover filled and explicit values, a mixed-type default, and rejected defaults.

@hareshkh
hareshkh force-pushed the insert-required-null-check branch from 4f9933c to 9fed241 Compare October 12, 2026 23:00
@hareshkh hareshkh changed the title Insert checks for null insertions in required columns Honor column defaults on Insert Oct 12, 2026
@hareshkh
hareshkh force-pushed the insert-required-null-check branch 3 times, most recently from 92a18cc to b17e965 Compare November 23, 2026 15:51
@hareshkh
hareshkh force-pushed the insert-required-null-check branch from b17e965 to 3066193 Compare November 23, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant