Shahzeb-DataEngineer opened a new issue, #4528:
URL: https://github.com/apache/iceberg-python/issues/4528

   ### Apache Iceberg version
   
   main (development)
   
   ### Please describe the bug 🐞
   
   Version: PyIceberg main at commit c73bee86489b4d1c8d634b441c13efdede21cd3e 
(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:
   ```python
   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.
   
   Related to #2775 and #2792.
   
   ### 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to