Skip to content

Commit 42d091d

Browse files
committed
test case for bad snapshot id
1 parent 8377be9 commit 42d091d

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/integration/test_inspect_table.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,42 @@ def test_inspect_files(
551551
assert rm_lhs['upper_bound'] == rm_rhs['upper_bound']
552552
else:
553553
assert left == right, f"Difference in column {column}: {left} != {right}"
554+
555+
556+
@pytest.mark.integration
557+
@pytest.mark.parametrize("format_version", [1, 2])
558+
def test_inspect_files_bad_snapshot_id(
559+
spark: SparkSession, session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int
560+
) -> None:
561+
identifier = "default.table_metadata_files"
562+
563+
tbl = _create_table(session_catalog, identifier, properties={"format-version": format_version})
564+
565+
tbl.overwrite(arrow_table_with_null)
566+
567+
# append more data
568+
tbl.append(arrow_table_with_null)
569+
570+
df = tbl.refresh().inspect.files(12123212)
571+
572+
assert df.column_names == [
573+
'content',
574+
'file_path',
575+
'file_format',
576+
'spec_id',
577+
'record_count',
578+
'file_size_in_bytes',
579+
'column_sizes',
580+
'value_counts',
581+
'null_value_counts',
582+
'nan_value_counts',
583+
'lower_bounds',
584+
'upper_bounds',
585+
'key_metadata',
586+
'split_offsets',
587+
'equality_ids',
588+
'sort_order_id',
589+
'readable_metrics',
590+
]
591+
592+
assert df.to_pandas().empty is True

0 commit comments

Comments
 (0)