You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "robreeves (via GitHub)" <gi...@apache.org> on 2026/04/28 22:03:50 UTC
[PR] Fix deepcopy for And, Or, and Not expressions [iceberg-python]
robreeves opened a new pull request, #3295:
URL: https://github.com/apache/iceberg-python/pull/3295
# Rationale for this change
`copy.deepcopy()` on `And`, `Or`, and `Not` expressions raises `TypeError` because Pydantic v2's default `__deepcopy__` calls `cls.__new__(cls)` with no args, but these classes require positional arguments in `__new__`.
This breaks frameworks like Ray Train that deepcopy objects containing pyiceberg expression trees.
The fix adds `__deepcopy__` to `And`, `Or`, and `Not` that deepcopy their fields and call the constructor directly.
## Are these changes tested?
Yes. 11 new unit tests covering all expression types, balanced trees, nested expressions, and deepcopy followed by pickle.
## Are there any user-facing changes?
No. `copy.deepcopy()` on expressions now works instead of raising.
--
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
Re: [PR] Fix deepcopy for And, Or, and Not expressions [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #3295:
URL: https://github.com/apache/iceberg-python/pull/3295
--
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
Re: [PR] Fix deepcopy for And, Or, and Not expressions [iceberg-python]
Posted by "robreeves (via GitHub)" <gi...@apache.org>.
robreeves commented on code in PR #3295:
URL: https://github.com/apache/iceberg-python/pull/3295#discussion_r3164735892
##########
tests/expressions/test_expressions.py:
##########
@@ -1292,6 +1293,78 @@ def test_bind_ambiguous_name() -> None:
assert "Invalid schema, multiple fields for name foo.bar: 2 and 3" in str(exc_info)
+# --- deepcopy tests ---
Review Comment:
Removed
--
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
Re: [PR] Fix deepcopy for And, Or, and Not expressions [iceberg-python]
Posted by "rambleraptor (via GitHub)" <gi...@apache.org>.
rambleraptor commented on code in PR #3295:
URL: https://github.com/apache/iceberg-python/pull/3295#discussion_r3164401691
##########
tests/expressions/test_expressions.py:
##########
@@ -1292,6 +1293,78 @@ def test_bind_ambiguous_name() -> None:
assert "Invalid schema, multiple fields for name foo.bar: 2 and 3" in str(exc_info)
+# --- deepcopy tests ---
Review Comment:
There's a whole bunch of empty lines here. Can you get rid of these?
--
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