Fokko commented on code in PR #6141: URL: https://github.com/apache/iceberg/pull/6141#discussion_r1018963278
########## python/pyiceberg/expressions/literals.py: ########## @@ -58,25 +60,25 @@ timestamp_to_micros, timestamptz_to_micros, ) -from pyiceberg.utils.singleton import Singleton T = TypeVar("T") class Literal(Generic[T], ABC): """Literal which has a value and can be converted between types""" - def __init__(self, value: T, value_type: type): + def __init__(self, value: T, value_type: Type): if value is None or not isinstance(value, value_type): raise TypeError(f"Invalid literal value: {value} (not a {value_type})") self._value = value @property def value(self) -> T: - return self._value # type: ignore + return self._value + @singledispatchmethod @abstractmethod - def to(self, type_var) -> Literal: + def to(self, type_var: IcebergType) -> Literal: Review Comment: I added types to revive the TypeChecker, and it failed on this one. `to` returns a literal, therefore `AboveMax` and `BelowMin` also need to be literal. We can also turn this into a `Union[Literal, AboveMin, AboveMax]`. @rdblue thoughts? -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org