TruncateTransform.satisfies_order_of raises AttributeError for different widths
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- data-engineering
Research direction
Start in pyiceberg/transforms.py at TruncateTransform.satisfies_order_of and review the related constructor and source_type property. Run the focused cases in tests/test_transforms.py around lines 501-512, then add coverage for different widths. Done means comparisons return the expected booleans without accessing an uninitialized attribute.
Written by the indexing model from the issue text.
Description
Apache Iceberg version
0.11.0 (latest release)
Please describe the bug 🐞
Description
Calling TruncateTransform.satisfies_order_of with two valid truncate transforms that have different widths raises an AttributeError instead of returning a boolean.
Same-width comparisons work because the method returns early when the transforms are equal.
Reproduction
from pyiceberg.transforms import TruncateTransform
TruncateTransform(5).satisfies_order_of(TruncateTransform(3))
On main at commit 48e710d20ceeeaa637d5aeae7746b787410859f8, this raises:
AttributeError: 'TruncateTransform' object has no attribute '_source_type'
The failure reproduces consistently. The same code is also present in the 0.11.1 release.
Expected behavior
The method should compare the truncate widths and return a boolean:
assert TruncateTransform(5).satisfies_order_of(TruncateTransform(3))
assert not TruncateTransform(3).satisfies_order_of(TruncateTransform(5))
This matches the current Apache Iceberg Java implementation:
Cause
TruncateTransform.__init__ initializes _width but not _source_type. However, satisfies_order_of still accesses the source_type property backed by _source_type:
The existing unit test only compares a transform with itself, so it returns before reaching the failing branch:
A focused fix could compare TruncateTransform widths directly, consistent with the Java implementation, and add regression cases for different widths.
I would be happy to contribute the fix and regression tests.
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
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 589
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 72
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iceberg-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg-python#3996 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/iceberg-python#3979 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg-python#3885 ·
-
[Bug] PyArrowFileIO fails to propagate s3.ssl.ca-cert to pyarrow.fs.S3FileSystem tls_ca_file_path Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/iceberg-python#3866 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg-python#3836 · 1 comment ·
All issues in apache/iceberg-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100