Skip to content
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

fix(rust,python): checkpoint with column nullable false #2680

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/core/src/kernel/arrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ fn max_min_schema_for_fields(dest: &mut Vec<ArrowField>, f: &ArrowField) {
// don't compute min or max for list, map or binary types
ArrowDataType::List(_) | ArrowDataType::Map(_, _) | ArrowDataType::Binary => { /* noop */ }
_ => {
let f = f.clone();
dest.push(f);
dest.push(ArrowField::new(f.name(), f.data_type().clone(), true));
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions python/tests/test_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,30 @@ def test_checkpoint_post_commit_config_multiple_operations(

delta_table = DeltaTable(str(tmp_table_path))
assert delta_table.version() == 9


def test_checkpoint_with_nullable_false(tmp_path: pathlib.Path):
tmp_table_path = tmp_path / "path" / "to" / "table"
checkpoint_path = tmp_table_path / "_delta_log" / "_last_checkpoint"

pylist = [{"year": 2023, "n_party": 0}, {"year": 2024, "n_party": 1}]
my_schema = pa.schema(
[
pa.field("year", pa.int64(), nullable=False),
pa.field("n_party", pa.int64(), nullable=False),
]
)

data = pa.Table.from_pylist(pylist, schema=my_schema)

write_deltalake(
str(tmp_table_path),
data,
configuration={"delta.dataSkippingNumIndexedCols": "1"},
)

DeltaTable(str(tmp_table_path)).create_checkpoint()

assert checkpoint_path.exists()

assert DeltaTable(str(tmp_table_path)).to_pyarrow_table() == data
Loading