SurenderguliaEnginner opened a new pull request, #4544:
URL: https://github.com/apache/iceberg-python/pull/4544

   <!--
   Thanks for sending a pull request!
   -->
   
   ### Description
   
   When a REST catalog plans a scan server-side, the server can return 
per-column lower and upper bounds (`lower-bounds`, `upper-bounds`) and 
encryption key metadata (`key-metadata`) on each data file. Previously, 
`_rest_file_to_data_file` in `pyiceberg/table/__init__.py` did not pass these 
fields to `DataFile.from_args()`, causing the converted `DataFile` to always 
drop column bounds and key metadata.
   
   This caused two main issues:
   1. Pruning/skipping on planned tasks failed because column bounds were 
missing.
   2. Encrypted tables failed to read because key metadata was not retained to 
construct decryption properties.
   
   **Changes:**
   1. **`pyiceberg/table/__init__.py`**:
      - Added `_serialize_bounds` helper using `pyiceberg.conversions.to_bytes` 
and field types from `table_schema`.
      - Decoded `key_metadata` from base64 string to bytes via 
`base64.b64decode(validate=True)` (consistent with `table/metadata.py`).
      - Forwarded `lower_bounds`, `upper_bounds`, and `key_metadata` to 
`DataFile.from_args()`.
      - Threaded `table_schema` through `FileScanTask.from_rest_response` and 
`DataScan._plan_files_server_side`.
   2. **`pyiceberg/catalog/rest/__init__.py`**:
      - Forwarded `table_schema` through `_plan_scan_result` and 
`_expand_plan_tasks` into `FileScanTask.from_rest_response`.
   3. **`tests/catalog/test_scan_planning_models.py`**:
      - Added `test_rest_task_preserves_bounds_and_key_metadata` to verify 
bounds serialization and key metadata decoding.
   
   Closes #4528
   
   ### Tests
   
   - `pytest tests/catalog/test_scan_planning_models.py` (63 passed)
   


-- 
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