dramaticlly commented on a change in pull request #4436:
URL: https://github.com/apache/iceberg/pull/4436#discussion_r839019341



##########
File path: python/src/iceberg/expression/literals.py
##########
@@ -200,78 +205,52 @@ def _(self, type_var):
         return self
 
 
-class IntegerLiteral(Literal[int]):
-    @singledispatchmethod
-    def to(self, type_var):
-        return None
-
-    @to.register(IntegerType)
-    def _(self, type_var: IntegerType) -> "IntegerLiteral":
-        return self
-
-    @to.register(LongType)
-    def _(self, type_var: LongType) -> "LongLiteral":
-        return LongLiteral(self.value)
-
-    @to.register(FloatType)
-    def _(self, type_var: FloatType) -> "FloatLiteral":
-        return FloatLiteral(float(self.value))
-
-    @to.register(DoubleType)
-    def _(self, type_var: DoubleType) -> "DoubleLiteral":
-        return DoubleLiteral(self.value)
-
-    @to.register(DateType)
-    def _(self, type_var: DateType) -> "DateLiteral":
-        return DateLiteral(self.value)
-
-    @to.register(DecimalType)
-    def _(self, type_var: DecimalType) -> "DecimalLiteral":
-        if type_var.scale == 0:
-            return DecimalLiteral(Decimal(self.value))
-        else:
-            return DecimalLiteral(Decimal(self.value).quantize(Decimal((0, 
(1,), -type_var.scale)), rounding=ROUND_HALF_UP))
-
-
 class LongLiteral(Literal[int]):
     @singledispatchmethod
     def to(self, type_var):
         return None
 
     @to.register(LongType)
-    def _(self, type_var: LongType) -> "LongLiteral":
+    def _(self, type_var: LongType) -> Literal[int]:
         return self
 
     @to.register(IntegerType)
-    def _(self, type_var: IntegerType) -> Union[AboveMax, BelowMin, 
IntegerLiteral]:
+    def _(self, type_var: IntegerType) -> Union[AboveMax, BelowMin, 
Literal[int]]:
         if IntegerType.max < self.value:
             return AboveMax()
         elif IntegerType.min > self.value:
             return BelowMin()
-        return IntegerLiteral(self.value)
+        return self
 
     @to.register(FloatType)
-    def _(self, type_var: FloatType) -> "FloatLiteral":
+    def _(self, type_var: FloatType) -> Literal[float]:
         return FloatLiteral(float(self.value))
 
     @to.register(DoubleType)
-    def _(self, type_var: DoubleType) -> "DoubleLiteral":
-        return DoubleLiteral(self.value)
+    def _(self, type_var: DoubleType) -> Literal[float]:
+        return DoubleLiteral(float(self.value))

Review comment:
       oh gotcha, this is about what you suggested [earlier on what's 
missing](https://github.com/apache/iceberg/pull/4262#discussion_r837642495), 
right? Thank you!




-- 
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]

Reply via email to