iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

Make `UnaryPredicate` predicate JSON serializable

Open Fokko opened this issue 3 months ago • 1 comments

Feature Request / Improvement

Make sure that the UnaryPredicate predicate can be serialized to JSON:

https://github.com/apache/iceberg-python/blob/e5e74534a4938fcace2c782a237474b7e94da68c/pyiceberg/expressions/init.py#L432-L443

This predicate has four implementations: IsNull, NotNull, IsNaN, and NotNan, and translates to:

{
    "type": "is-null" // Or not-null, is-nan, not-nan
    "term": str, // The column name
}

We use Pydantic for JSON serialization, which can be enabled by deriving from the IcebergBaseModel:

https://github.com/apache/iceberg-python/blob/e5e74534a4938fcace2c782a237474b7e94da68c/pyiceberg/partitioning.py#L124

Example tests can be found here:

https://github.com/apache/iceberg-python/blob/e5e74534a4938fcace2c782a237474b7e94da68c/tests/table/test_partitioning.py#L116-L132

Fokko avatar Sep 25 '25 20:09 Fokko

Hi @Fokko, can work on this issue?

tanmayrauth avatar Sep 25 '25 23:09 tanmayrauth