feat: Make `and` expression JSON serializable (#2784)

Related to: #2518, #2775 

# Rationale for this change

This work was done by @Aniketsy, I just opened this to get the tests
passing, and we can merge for scan planning.

But, this PR allows `And` expressions to be deserialized from JSON
through Pydantic.

This PR aligns the `And` expression with the `Or`/`Not` pattern by
adding `IcebergBaseModel` as an inherited class. This gets teh And
expression into a proven serializable state, preparing it for the full
expression tree [de]serializability work in #2783.

## Are these changes tested?

Yes added a test and ensure that they align with EpressionParser in
Iceberg Java

## Are there any user-facing changes?

No this is just serialization

cc: @kevinjqliu @Fokko

---------

Co-authored-by: Aniket Singh Yadav <singhyadavaniket43@gmail.com>
2 files changed
tree: b34c438a6e84291072a55b6ea6e5deb13985f9af
  1. .github/
  2. dev/
  3. mkdocs/
  4. pyiceberg/
  5. tests/
  6. vendor/
  7. .asf.yaml
  8. .codespellrc
  9. .gitignore
  10. .markdownlint.yaml
  11. .pre-commit-config.yaml
  12. LICENSE
  13. Makefile
  14. MANIFEST.in
  15. NOTICE
  16. pyproject.toml
  17. README.md
  18. ruff.toml
  19. setup.py
  20. uv.lock
README.md

Iceberg Python

PyIceberg is a Python library for programmatic access to Iceberg table metadata as well as to table data in Iceberg format. It is a Python implementation of the Iceberg table spec.

The documentation is available at https://py.iceberg.apache.org/.

Get in Touch