rdblue commented on code in PR #6139:
URL: https://github.com/apache/iceberg/pull/6139#discussion_r1023228294
##########
python/pyiceberg/expressions/__init__.py:
##########
@@ -48,12 +65,13 @@ class Bound(ABC):
"""Represents a bound value expression"""
-class Unbound(Generic[B], ABC):
+class Unbound(ABC):
"""Represents an unbound value expression"""
+ @property
@abstractmethod
- def bind(self, schema: Schema, case_sensitive: bool = True) -> B:
- ... # pragma: no cover
+ def as_bound(self) -> Type[Bound]:
+ ...
class BoundTerm(Term[T], Bound, ABC):
Review Comment:
Looks like this is one line where it fails:
```python
test_expressions.py:522: In(Reference("foo"), (literal("goodbye"),
literal("world")))
```
```
test_expressions.py:522: error: Argument 2 to "In" has incompatible type
"Tuple[Literal[str], Literal[str]]"; expected "Iterable[Literal[<nothing>]]"
```
It looks like it is getting the type param (`<nothing>`) from
`Reference("foo")` and then applying it to the second type like you said. I'll
have to look into this a bit more, but there are a couple of fixes that come to
mind:
1. Use the string/value syntax rather than supplying the literals and
reference: `In("foo", "goodbye", "world")` -- I think our intent is for this to
work, but we aren't using it in test to be more specific about what object gets
created. If that's the case, then I'd go with the next fix...
2. Rather than remove the type from the parent of `Reference`,
`BoundTerm[T]`, can we separate the term's type from the literal's type? I
think the problem is that the type checker expects that to match and it won't
necessarily (we probably want it to be `BoundTerm[Any]`). But we could just
define the unbound types as `In(Generic[R, L])` where `R` is a reference type
(that becomes `Any`) and `L` is a literal type.
--
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]