You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: reject non-null columns in CREATE TABLE unconditionally (#2404)
## What changes are proposed in this pull request?
Gates non-null columns (nullable: false) on the invariants writer
feature during CREATE TABLE. Delta Spark treats non-nullable schema
columns as implicit invariants, requiring the invariants writer feature
in the protocol. Tables created by kernel with non-null columns but
without the feature cause Spark read failures.
Since invariants is not in ALLOWED_DELTA_FEATURES and is not
auto-enabled by any property or schema-driven check, non-null columns
are effectively rejected unconditionally today. The invariants gate
ensures this relaxes automatically when invariants support is added in
the future.
Core changes:
1/ Added invariants_enabled parameter to validate_schema_for_create with
recursive non-null rejection in SchemaValidator
2/ Overrides transform_variant to skip protocol-mandated non-null
Variant internal fields (metadata, value)
3/ Passes the invariants feature check from validated.writer_features
into schema validation during build()
4 Converted incidental non-null fields to nullable in test schemas that
flow through create_table but are not testing nullability behavior
## How was this change tested?
1/ Added rstest unit coverage in schema/validation.rs for non-null
rejection across schema shapes: top-level, nested struct, array-nested,
map-nested, and invariants-enabled pass cases
2/ Added integration test in create_table/main.rs asserting CREATE TABLE
rejects non-null schemas with top-level and nested cases
3/ Full cargo test -p delta_kernel --all-features --locked passes (0
failures)
4/ cargo clippy and cargo fmt clean
---------
Co-authored-by: Sanuj Basu <sanujbasu@users.noreply.github.com>
0 commit comments