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

Make `and` expression JSON serializable

Open Fokko opened this issue 2 months ago • 6 comments

Feature Request / Improvement

Make sure that the and expression can be serialized to JSON:

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

This should follow:

{
    "type": "and",
    "left": BooleanExpression,
    "right": BooleanExpression
}

Where BooleanExpression refers to the class:

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

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 19:09 Fokko

Hi @Fokko, can work on this issue?

tanmayrauth avatar Sep 25 '25 23:09 tanmayrauth

hey @tanmayrauth normally i would say please feel free to submit a PR. But for this one, it looks like Fokko might have created it specifically for "PyData Amsterdam 2025" which i think is right now.

So lets wait a bit and see if this is already taken

kevinjqliu avatar Sep 26 '25 02:09 kevinjqliu

@tanmayrauth Indeed, as @kevinjqliu is saying, this is staged for the open source sprints for PyData Amsterdam. After today, I'll delete the label, and everyone is welcome to jump in :)

Fokko avatar Sep 26 '25 09:09 Fokko

I've removed the label and this one is up for grabs. Keep in min that this issue requires BooleanExpression to extend IcebergBaseModel, so it would be good to get the unary/literal/set predicates in first.

Fokko avatar Sep 30 '25 07:09 Fokko

@kevinjqliu Can I pick this up?

tanmayrauth avatar Sep 30 '25 13:09 tanmayrauth

hey @tanmayrauth feel free to submit a PR for this one (and other ones too)! Generally the issues are first come first serve. You dont need permission to work on something :) We just want to make sure that there's no duplicate effort from multiple people

kevinjqliu avatar Sep 30 '25 15:09 kevinjqliu