Fokko commented on code in PR #2561:
URL: https://github.com/apache/iceberg-python/pull/2561#discussion_r2440788499
##########
pyiceberg/expressions/__init__.py:
##########
@@ -52,8 +52,14 @@
ConfigDict = dict
-def _to_unbound_term(term: Union[str, UnboundTerm[Any]]) -> UnboundTerm[Any]:
- return Reference(term) if isinstance(term, str) else term
+def _to_unbound_term(term: Union[str, UnboundTerm[Any], BoundReference[Any]])
-> UnboundTerm[Any]:
+ if isinstance(term, str):
+ return Reference(term)
+ if isinstance(term, UnboundTerm):
+ return term
+ if isinstance(term, BoundReference):
+ return Reference(term.field.name)
+ raise ValueError(f"Expected UnboundTerm | BoundReference | str, got
{type(term).__name__}")
Review Comment:
There were some faulty tests:
https://github.com/apache/iceberg-python/pull/2632/
```suggestion
def _to_unbound_term(term: Union[str, UnboundTerm[Any]]) -> UnboundTerm[Any]:
return Reference(term) if isinstance(term, str) else term
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]