Repository navigation
Description
Apache Iceberg version
main (development)
Please describe the bug 🐞
Version: PyIceberg main at commit c73bee8 (2026-11-29).
When a REST catalog plans a scan server-side, the server can return per-column lower and upper bounds and key metadata on each data file. PyIceberg parses those fields into RESTDataFile (lower-bounds, upper-bounds) and RESTContentFile (key-metadata), but _rest_file_to_data_file in pyiceberg/table/init.py never passes them to DataFile.from_args. The converted DataFile therefore always has lower_bounds=None, upper_bounds=None and key_metadata=None.
Repro:
import base64
from pyiceberg.catalog.rest.scan_planning import RESTFileScanTask
from pyiceberg.table import FileScanTask
rest_task = RESTFileScanTask.model_validate(
{
"data-file": {
"spec-id": 0,
"content": "data",
"file-path": "s3://bucket/table/data/file.parquet",
"file-format": "parquet",
"file-size-in-bytes": 1024,
"record-count": 100,
"lower-bounds": {"keys": [1], "values": [10]},
"upper-bounds": {"keys": [1], "values": [20]},
"key-metadata": base64.b64encode(b"test-key-metadata").decode(),
}
}
)
task = FileScanTask.from_rest_response(rest_task, [])
print(task.file.lower_bounds) # None, expected {1: b'\n\x00\x00\x00'}
print(task.file.upper_bounds) # None, expected {1: b'\x14\x00\x00\x00'}
print(task.file.key_metadata) # None, expected b'test-key-metadata'Impact:
- Planned tasks carry no column bounds, so nothing downstream can prune on them even though the server sent them.
- For encrypted tables, the missing key metadata means no decryption properties are built and reading the planned files fails.
Fix sketch: forward the three fields in _rest_file_to_data_file. Bounds arrive as primitive values and need serializing with pyiceberg.conversions.to_bytes using the table schema field types, and key metadata arrives as a base64 string and needs decoding to bytes, matching the existing encrypted-key-metadata handling in table/metadata.py.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
Activity
SurenderguliaEnginner commentedon Nov 30, 2026
Hi @Shahzeb-DataEngineer, thanks for reporting this!
I can reproduce the issue:
_rest_file_to_data_fileinpyiceberg/table/__init__.pyomitslower_bounds,upper_bounds, andkey_metadatawhen convertingRESTDataFiletoDataFile.from_args().I would like to work on this and submit a PR with unit tests covering REST scan planning metadata preservation. Could you please assign this to me? Thanks!