sgilmore10 opened a new issue, #37515:
URL: https://github.com/apache/arrow/issues/37515

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   While working on #37448, I noticed the `Equals()` method of `ChunkedArray` 
treats NaNs as equal by default. I found this behavior surprising because the 
`Equals()` method of `Array` doesn't treat NaNs as equal by default.
   
   Below is a program to reproduce this behavior: 
   
   ```c++
   #include <arrow/api.h>
   #include <arrow/type.h>
   
   #include <iostream>
   #include <math.h>
   #include <sstream>
   
   arrow::Result<std::shared_ptr<arrow::ChunkedArray>> make_chunked_array() {
       arrow::NumericBuilder<arrow::DoubleType> builder;
       
       std::shared_ptr<arrow::Array> array;
       ARROW_RETURN_NOT_OK(builder.AppendValues({0, 1, NAN, 2, 4}));
       ARROW_RETURN_NOT_OK(builder.Finish(&array));
       
       return arrow::ChunkedArray::Make({array});
   }
   
   int main(int argc, char *argv[])
   {
       auto maybe_chunked_array = make_chunked_array();
       if (!maybe_chunked_array.ok()) {
           return -1;
       }
       auto chunked_array = std::move(maybe_chunked_array).ValueUnsafe();
       auto array = chunked_array->chunk(0);
       
       std::stringstream stream;
       stream << "array contents: ";
       stream << "\n\n";
       stream << array->ToString();
       stream << "\n\n";
       stream << "array->Equals(array): ";
       stream << array->Equals(array);
       stream << "\n\n";
   
       stream << "chunked_array contents: ";
       stream << "\n\n";
       stream << chunked_array->ToString();
       stream << "\n\n";
       stream << "chunked_array->Equals(chunked_array): ";
       stream << chunked_array->Equals(chunked_array);
       
       std::cout << stream.str() << std::endl;
   }
   ```
   
   Here is the output of this program:
   
   ```shell
   array contents: 
   
   [
     0,
     1,
     nan,
     2,
     4
   ]
   
   array->Equals(array): 0
   
   chunked_array contents: 
   
   [
     [
       0,
       1,
       nan,
       2,
       4
     ]
   ]
   
   chunked_array->Equals(chunked_array): 1
   ```
   
   Am I correct in that this is a bug?
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to