Fokko commented on code in PR #3298:
URL: https://github.com/apache/iceberg-python/pull/3298#discussion_r3180260787
##########
pyiceberg/expressions/literals.py:
##########
@@ -332,6 +339,14 @@ def _(self, _: TimestampType) -> Literal[int]:
def _(self, _: TimestamptzType) -> Literal[int]:
return TimestampLiteral(self.value)
+ @to.register(TimestampNanoType)
+ def _(self, _: TimestampNanoType) -> Literal[int]:
+ return TimestampNanoLiteral(self.value)
+
+ @to.register(TimestamptzNanoType)
+ def _(self, _: TimestamptzNanoType) -> Literal[int]:
+ return TimestampNanoLiteral(self.value)
Review Comment:
Unfortunally, this has been shown to be controversial in the Iceberg-Java
implementation:
https://github.com/apache/iceberg/pull/11775#discussion_r1888170004
If you think about it in SQL: `SELECT * FROM tbl WHERE dt > 1777883174`.
This assumes that the int is micros. However, when you would widen the field
`dt` by converting it from `micros` to `nanos`, then the query would return a
different result. When we would bind the `LongLiteral` to
`TimestampNanoLiteral` we implicitly assume that it is a nanos after the
widening of the column.
--
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]