-
Couldn't load subscription status.
- Fork 537
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
Delta-rs version: 0.27.0
Binding: I am using the Rust library
Bug
What happened:
delta-rs does not allow making a column non-nullable to nullable with SchemaMode::Merge.
What you expected to happen:
delta-rs should allow making a column non-nullable to nullable. Nullable to non-nullable should not be permitted with a concept of a default value (Not in the scope of this issue).
How to reproduce it:
#[tokio::test]
async fn null_to_non_null_column() {
let schema_without_null_column = vec![StructField::new("id", DeltaDataType::INTEGER, false)];
let non_null_batch = RecordBatch::try_from_iter_with_nullable(vec![(
"id",
Arc::new(Int32Array::from(vec![1, 2, 3])) as ArrayRef,
false,
)]);
let null_batch = RecordBatch::try_from_iter_with_nullable(vec![(
"id",
Arc::new(Int32Array::from(vec![Some(1), None, Some(3)])) as ArrayRef,
true,
)]);
let ops = DeltaOps::try_from_uri("memory:///").await.unwrap();
let table = ops
.create()
.with_table_name("my_table")
.with_save_mode(SaveMode::Ignore)
.with_columns(schema_without_null_column)
.await
.unwrap();
DeltaOps::from(table.clone())
.write(non_null_batch)
.with_schema_mode(SchemaMode::Merge)
.with_save_mode(SaveMode::Append)
.await
.unwrap();
DeltaOps::from(table)
.write(null_batch)
.with_schema_mode(SchemaMode::Merge)
.with_save_mode(SaveMode::Append)
.await
.unwrap();
}The above code raises InvalidData { violations: ["Non-nullable column violation for id, found 1 null values"] }.
More details:
| match new_field.try_merge(right) { |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working