Fokko commented on code in PR #3808:
URL: https://github.com/apache/iceberg-python/pull/3808#discussion_r3907787099
##########
tests/avro/test_decoder.py:
##########
@@ -160,6 +160,23 @@ def test_read_double(decoder_class: Callable[[bytes],
BinaryDecoder]) -> None:
assert decoder.read_double() == 19.25
[email protected]("decoder_class", AVAILABLE_DECODERS)
[email protected](
+ "value",
+ [
+ 3.141592653589793,
+ 429496729622.314,
+ 0.1,
+ 1.0000000000000002, # smallest double above 1.0
+ 1e308, # overflows to inf in single precision
+ 5e-324, # underflows to 0.0 in single precision
+ ],
+)
+def test_read_double_keeps_full_precision(decoder_class: Callable[[bytes],
BinaryDecoder], value: float) -> None:
Review Comment:
I'm seeing the issue as well:
```
__________________________________________________
test_read_double_keeps_full_precision[3.141592653589793-CythonBinaryDecoder]
___________________________________________________
decoder_class = <class 'pyiceberg.avro.decoder_fast.CythonBinaryDecoder'>,
value = 3.141592653589793
@pytest.mark.parametrize("decoder_class", AVAILABLE_DECODERS)
@pytest.mark.parametrize(
"value",
[
3.141592653589793,
429496729622.314,
0.1,
1.0000000000000002, # smallest double above 1.0
1e308, # overflows to inf in single precision
5e-324, # underflows to 0.0 in single precision
],
)
def test_read_double_keeps_full_precision(decoder_class:
Callable[[bytes], BinaryDecoder], value: float) -> None:
decoder = decoder_class(struct.pack("<d", value))
> assert decoder.read_double() == value
E assert 3.1415927410125732 == 3.141592653589793
E + where 3.1415927410125732 = read_double()
E + where read_double =
<pyiceberg.avro.decoder_fast.CythonBinaryDecoder object at
0x11d2abe70>.read_double
tests/avro/test_decoder.py:221: AssertionError
```
`make clean` should give you a clean state.
--
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]