Uh oh!
There was an error while loading. Please reload this page.
Fix column projection predicate evaluation - #2254
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
cc @gabeiglio since you implemented #1443 :) could you also take a look? |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in predicate evaluation for column projection where predicates on columns not present in the Parquet file schema would incorrectly return no results. The fix changes the behavior to return AlwaysTrue when a field has no initial_default, allowing for proper row-level filtering.
Key changes:
- Modified
_ColumnNameTranslatorto returnAlwaysTrueinstead ofAlwaysFalsefor missing fields withoutinitial_default - Added comprehensive unit tests for the
translate_column_namesfunction - Added integration tests for partition value projection with predicates
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyiceberg/expressions/visitors.py | Updated _ColumnNameTranslator to handle missing fields without initial_default by returning AlwaysTrue |
| tests/expressions/test_visitors.py | Added comprehensive unit tests for translate_column_names function covering various scenarios |
| tests/io/test_pyarrow.py | Added integration tests for partition value projection with predicates |
Comments suppressed due to low confidence (1)
tests/expressions/test_visitors.py:1684
- The test creates a field with
initial_default="default"but never tests the behavior when this field is missing from the file schema. Consider adding a test case to verify that fields with string defaults are handled correctly.
NestedField(field_id=1, name="existing_col", field_type=StringType(), required=False, initial_default="default"),
Uh oh!
There was an error while loading. Please reload this page.
06c4a4d to
50b7b39Comparekevinjqliu
commented
Jul 26, 2025
this isnt right. we should evaluate the column projection predicates |
kevinjqliu
commented
Jul 27, 2025
Closing in favor of #2029 |
Rationale for this change
Closes#2028
Heavily inspired by #2029 (thanks @Erigara)
This PR fixes a bug where predicate evaluation for a column that is not in the parquet file schema will return no result. This is due to
_ColumnNameTranslatorvisitor returningAlwaysFalsewhen the column cannot be found in the file schema.This PR follows the change in #1644 to evaluate predicates based on a field's
initial_default. When the evaluated field does not haveinitial_default,_ColumnNameTranslatorwill now returnAlwaysTrueto scan the entire parquet file and pass the result along for further evaluation.Are these changes tested?
Yes, added some unit tests for
_ColumnNameTranslator/translate_column_namesAdded a test for predicate evaluation for projected columns.
Are there any user-facing changes?