You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Shahzeb-DataEngineer (via GitHub)" <gi...@apache.org> on 2026/10/23 07:26:26 UTC
[I] Binding starts-with/not-starts-with with an out-of-range literal leaks the AboveMax/BelowMin sentinel into a bound predicate [iceberg-python]
Shahzeb-DataEngineer opened a new issue, #4143:
URL: https://github.com/apache/iceberg-python/issues/4143
### Apache Iceberg version
main (development)
### Please describe the bug 🐞
`LiteralPredicate.bind` folds literals that convert to `AboveMax` / `BelowMin` into `AlwaysTrue` / `AlwaysFalse` for the six comparison operations, but `starts-with` and `not-starts-with` fall through and produce a bound predicate whose literal is the sentinel itself:
```python
from pyiceberg.expressions import StartsWith
from pyiceberg.schema import Schema
from pyiceberg.types import IntegerType, NestedField
schema = Schema(NestedField(1, "x", IntegerType(), required=False))
bound = StartsWith("x", "2147483648").bind(schema)
# BoundStartsWith(term=BoundReference(...), literal=IntAboveMax())
# bound.literal.value == 2147483647 (the int type maximum)
```
Row evaluation of the resulting predicate then fails with a confusing error instead of a clean bind-time failure:
```
AttributeError: 'int' object has no attribute 'startswith'
```
The same fall-through exists for `not-starts-with` and for `BelowMin` (for example `StartsWith("x", "-2147483649")` produces a `BoundStartsWith` wrapping `IntBelowMin()`).
Root cause: in `LiteralPredicate.bind` (`pyiceberg/expressions/__init__.py`), the `AboveMax` / `BelowMin` branches enumerate only the comparison operations and have no fallback for the remaining operations, so binding reaches `return self.as_bound(bound_term, lit)` with the sentinel literal.
The Java implementation throws an `IllegalStateException` when an `AboveMax` / `BelowMin` literal is combined with an operation that has no defined fold, so the sentinel never leaks into a bound predicate. PyIceberg should raise a clear error at bind time in the same situation.
I can contribute a fix for this bug independently; a PR follows.
--
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: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Binding starts-with/not-starts-with with an out-of-range literal leaks the AboveMax/BelowMin sentinel into a bound predicate [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko closed issue #4143: Binding starts-with/not-starts-with with an out-of-range literal leaks the AboveMax/BelowMin sentinel into a bound predicate
URL: https://github.com/apache/iceberg-python/issues/4143
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org