Skip to content
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
1 change: 1 addition & 0 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,7 @@ def _rest_file_to_data_file(rest_file: RESTContentFile, default_referenced_data_
referenced_data_file=referenced_data_file,
content_offset=rest_file.content_offset if isinstance(rest_file, RESTPositionDeleteFile) else None,
content_size_in_bytes=rest_file.content_size_in_bytes if isinstance(rest_file, RESTPositionDeleteFile) else None,
first_row_id=rest_file.first_row_id if isinstance(rest_file, RESTDataFile) else None,
)
data_file.spec_id = rest_file.spec_id
return data_file
Expand Down
8 changes: 8 additions & 0 deletions tests/catalog/test_scan_planning_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,14 @@ def test_plan_scan_with_shared_dv_file(
}


@pytest.mark.parametrize("first_row_id", [1000, None])
def test_rest_task_preserves_first_row_id(first_row_id: int | None) -> None:
rest_data_file = {**_rest_data_file(), **({"first-row-id": first_row_id} if first_row_id is not None else {})}
task = FileScanTask.from_rest_response(RESTFileScanTask.model_validate({"data-file": rest_data_file}), [])

assert task.file.first_row_id == first_row_id


@pytest.mark.parametrize("missing_field", ["content-offset", "content-size-in-bytes"])
@pytest.mark.parametrize("include_referenced_data_file", [True, False])
def test_rest_task_preserves_partial_dv_reference(missing_field: str, include_referenced_data_file: bool) -> None:
Expand Down
Loading