Skip to content

Commit

Permalink
fix unrelated issues breaking CI
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Ulmasov <[email protected]>
  • Loading branch information
r3stl355 committed Dec 28, 2023
1 parent 0125c15 commit df74743
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/deltalake-core/src/delta_datafusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl DeltaTableState {
let files = self.files();

// Initalize statistics
let mut table_stats = match files.get(0) {
let mut table_stats = match files.first() {
Some(file) => match file.get_stats() {
Ok(Some(stats)) => {
let mut column_statistics = Vec::with_capacity(schema.fields().size());
Expand Down
20 changes: 12 additions & 8 deletions python/tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,30 +855,34 @@ def test_partition_overwrite_unfiltered_data_fails(


@pytest.mark.parametrize(
"value_1,value_2,value_type,filter_string",
"sub_path,value_1,value_2,value_type,filter_string",
[
(1, 2, pa.int64(), "1"),
(False, True, pa.bool_(), "false"),
(date(2022, 1, 1), date(2022, 1, 2), pa.date32(), "2022-01-01"),
("1", 1, 2, pa.int64(), "1"),
("2", False, True, pa.bool_(), "false"),
("3", date(2022, 1, 1), date(2022, 1, 2), pa.date32(), "2022-01-01"),
],
)
def test_replace_where_overwrite(
tmp_path: pathlib.Path,
sub_path: str,
tmp_path: pathlib.Path(),
value_1: Any,
value_2: Any,
value_type: pa.DataType,
filter_string: str,
):
table_path = tmp_path / sub_path
sample_data = pa.table(
{
"p1": pa.array(["1", "1", "2", "2"], pa.string()),
"p2": pa.array([value_1, value_2, value_1, value_2], value_type),
"val": pa.array([1, 1, 1, 1], pa.int64()),
}
)
write_deltalake(tmp_path, sample_data, mode="overwrite", partition_by=["p1", "p2"])
write_deltalake(
table_path, sample_data, mode="overwrite", partition_by=["p1", "p2"]
)

delta_table = DeltaTable(tmp_path)
delta_table = DeltaTable(table_path)
assert (
delta_table.to_pyarrow_table().sort_by(
[("p1", "ascending"), ("p2", "ascending")]
Expand All @@ -902,7 +906,7 @@ def test_replace_where_overwrite(
)

write_deltalake(
tmp_path,
table_path,
sample_data,
mode="overwrite",
predicate="`p1` = 1",
Expand Down

0 comments on commit df74743

Please sign in to comment.