Fokko commented on code in PR #6141: URL: https://github.com/apache/iceberg/pull/6141#discussion_r1017702146
########## python/pyiceberg/expressions/literals.py: ########## @@ -125,81 +127,71 @@ def literal(value) -> Literal: @literal.register(bool) -def _(value: bool) -> Literal[bool]: +def _(value: bool) -> BooleanLiteral: return BooleanLiteral(value) @literal.register(int) -def _(value: int) -> Literal[int]: +def _(value: int) -> LongLiteral: return LongLiteral(value) @literal.register(float) -def _(value: float) -> Literal[float]: +def _(value: float) -> DoubleLiteral: # expression binding can convert to FloatLiteral if needed return DoubleLiteral(value) @literal.register(str) -def _(value: str) -> Literal[str]: +def _(value: str) -> StringLiteral: return StringLiteral(value) @literal.register(UUID) -def _(value: UUID) -> Literal[UUID]: +def _(value: UUID) -> UUIDLiteral: return UUIDLiteral(value) @literal.register(bytes) -def _(value: bytes) -> Literal[bytes]: +def _(value: bytes) -> BinaryLiteral: # expression binding can convert to FixedLiteral if needed return BinaryLiteral(value) @literal.register(bytearray) -def _(value: bytearray) -> Literal[bytes]: +def _(value: bytearray) -> BinaryLiteral: return BinaryLiteral(bytes(value)) @literal.register(Decimal) -def _(value: Decimal) -> Literal[Decimal]: +def _(value: Decimal) -> DecimalLiteral: return DecimalLiteral(value) @literal.register(date) -def _(value: date) -> Literal[int]: +def _(value: date) -> DateLiteral: return DateLiteral(date_to_days(value)) -class AboveMax(Singleton): - @property - def value(self): - raise ValueError("AboveMax has no value") - - def to(self, type_var): +class AboveMax(Literal): Review Comment: Had to turn the `AboveMax` into a literal, since the `to()` always returns a literal. We pass in the Max value of the `{int,long}` that it exceeds. -- 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