apache / arrow

Apache Arrow is the universal columnar format and multi-language toolbox for fast data interchange and in-memory analytics
https://arrow.apache.org/
Apache License 2.0
14.63k stars 3.56k forks source link

[C++] Float16.{ToBytes,FromBytes} fail on big-endian machines #44767

Closed QuLogic closed 3 days ago

QuLogic commented 3 days ago

Describe the bug, including details regarding any error messages, version, and platform.

The above named tests fail in the following way:

[ RUN      ] Float16Test.ToBytes
/builddir/build/BUILD/libarrow-16.1.0-build/apache-arrow-16.1.0/cpp/src/arrow/util/float16_test.cc:332: Failure
Expected equality of these values:
  load()
    Which is: 7376
  0xd01c
    Which is: 53276

[  FAILED  ] Float16Test.ToBytes (0 ms)
[ RUN      ] Float16Test.FromBytes
/builddir/build/BUILD/libarrow-16.1.0-build/apache-arrow-16.1.0/cpp/src/arrow/util/float16_test.cc:361: Failure
Expected equality of these values:
  Float16::FromLittleEndian(data)
    Which is: 0.00469971
  Float16(0x1cd0)
    Which is: 7376

[  FAILED  ] Float16Test.FromBytes (0 ms)

The tests themselves look suspicious to me, as they start with a "native" check, but use a fixed byte order.

Component(s)

C++

pitrou commented 3 days ago

Issue resolved by pull request 44768 https://github.com/apache/arrow/pull/44768