Skip to content

feat(rest): preserve column bounds and key metadata during REST scan planning - #4544

Open
SurenderguliaEnginner wants to merge 2 commits into
apache:mainfrom
SurenderguliaEnginner:fix/4528-rest-scan-planning-metadata
Open

SurenderguliaEnginner wants to merge 2 commits into
apache:mainfrom
SurenderguliaEnginner:fix/4528-rest-scan-planning-metadata

Conversation

@SurenderguliaEnginner

Copy link
Copy Markdown

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)

@SurenderguliaEnginner
SurenderguliaEnginner force-pushed the fix/4528-rest-scan-planning-metadata branch from eddc546 to c61e652 Compare December 1, 2026 10:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST scan planning drops data file lower/upper bounds and key metadata

1 participant