You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/11/07 21:08:11 UTC
[GitHub] [iceberg] Fokko commented on a diff in pull request #6139: Python: Remove dataclasses
Fokko commented on code in PR #6139:
URL: https://github.com/apache/iceberg/pull/6139#discussion_r1015901564
##########
python/pyiceberg/expressions/__init__.py:
##########
@@ -32,6 +41,24 @@
B = TypeVar("B")
+def _to_literal(lit: Optional[Union[T, Literal[T]]]) -> Optional[Literal[T]]:
+ # This should not be optional, to be fixed in a separate PR
+ if lit:
+ return lit if isinstance(lit, Literal) else literal(lit)
+ else:
+ return None
+
+
+def _combine_into_set(values: Tuple[Union[T, Literal[T], Iterable[T], Iterable[Literal[T]]], ...]) -> Set[Literal[T]]:
Review Comment:
From the signature of the `__new__` function of `{BoundSetPredicate,SetPredicate}` you can see that you can also provide positional arguments, I think that's a nice touch:
```python
def test_in_positional_args():
assert In(Reference("foo"), "a", "bc", "def").literals == {StringLiteral("a"), StringLiteral("bc"), StringLiteral("def")}
```
--
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