rdblue commented on code in PR #8067:
URL: https://github.com/apache/iceberg/pull/8067#discussion_r1285263111


##########
python/pyiceberg/avro/reader.py:
##########
@@ -270,9 +270,8 @@ class DecimalReader(Reader):
     scale: int = dataclassfield()
 
     def read(self, decoder: BinaryDecoder) -> Decimal:
-        data = decoder.read(decoder.read_int())
-        unscaled_datum = int.from_bytes(data, byteorder="big", signed=True)
-        return unscaled_to_decimal(unscaled_datum, self.scale)
+        data = decoder.read(decimal_required_bytes(self.precision))

Review Comment:
   `decimal_required_bytes(self.precision)` should be done in the constructor 
and reused, right? Or does a frozen dataclass make that hard?



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