andishgar opened a new issue, #46739: URL: https://github.com/apache/arrow/issues/46739
### Describe the bug, including details regarding any error messages, version, and platform. In the code below, two `NaN` values are considered equal regardless of whether` EqualOptions::nan_equal `is set to `true` or `false`. The root of the problem lies [here](https://github.com/apache/arrow/blob/0e5249b0e8f060f8ee5136579bfeed8c92d0d1ab/cpp/src/arrow/compare.cc#L173), where `float16` values with the same memory representation are not correctly handled, and also [here](https://github.com/apache/arrow/blob/0e5249b0e8f060f8ee5136579bfeed8c92d0d1ab/cpp/src/arrow/compare.cc#L112-L114), where `HalfFloat` is implemented as a `uint16_t`, causing the comparison to return `true`. ```c++ TEST(FloatComparasion, Float16NaN) { auto half_float_array = ArrayFromJSON(float16(), R"([16.0,NaN])"); auto half_float_array_1 = ArrayFromJSON(float16(), R"([16.0,NaN])"); ASSERT_TRUE(half_float_array->Equals(half_float_array_1, EqualOptions::Defaults().nans_equal(false))); ASSERT_TRUE(half_float_array->Equals(half_float_array, EqualOptions::Defaults().nans_equal(false))); } ``` ### Component(s) C++ -- 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: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org