You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Light-City (via GitHub)" <gi...@apache.org> on 2023/11/07 10:05:48 UTC

[I] Float Array Equals for nan. [arrow]

Light-City opened a new issue, #38624:
URL: https://github.com/apache/arrow/issues/38624

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   The default array options now have a nan comparison of false, but in a unit test situation we might expect nan=true.
   for example:
   
   ```
     auto schema = ::arrow::schema({
         {field("a", float32())},
         {field("b", float64())},
     });
   
     std::vector<std::string> expected = {R"([{"a": 1,    "b": 5},
                                              {"a": 1,    "b": 3},
                                              {"a": 3,    "b": null},
                                              {"a": NaN,  "b": 5},
                                              {"a": NaN,  "b": NaN},
                                              {"a": NaN,   "b": null},
                                              {"a": null, "b": 5},
                                              {"a": null, "b": null}
                                             ])"};
     std::vector<std::string> actual = {R"([{"a": 1,    "b": 5},
                                            {"a": 1,    "b": 3},
                                            {"a": 3,    "b": null},
                                            {"a": NaN,  "b": 5},
                                            {"a": NaN,  "b": NaN},
                                            {"a": NaN,   "b": null},
                                            {"a": null, "b": 5},
                                            {"a": null, "b": null}
                                           ])"};
     ASSERT_TABLES_EQUAL(*TableFromJSON(schema, expected), *TableFromJSON(schema, actual));
   ```
   
   Now the test will fail.
   
   The reasons were found to be as follows:
   
   ```
     bool Equals(const Array& arr, const EqualOptions& = EqualOptions::Defaults()) const;
     bool Equals(const std::shared_ptr<Array>& arr,
                 const EqualOptions& = EqualOptions::Defaults()) const;
   ```
   
   So how can I modify the interface to support this function?
   
   ### 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-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] During unit testing, the float array contains nan equality judgment [arrow]

Posted by "bkietz (via GitHub)" <gi...@apache.org>.
bkietz closed issue #38624: [C++] During unit testing, the float array contains nan equality judgment
URL: https://github.com/apache/arrow/issues/38624


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] During unit testing, the float array contains nan equality judgment [arrow]

Posted by "Light-City (via GitHub)" <gi...@apache.org>.
Light-City commented on issue #38624:
URL: https://github.com/apache/arrow/issues/38624#issuecomment-1801262662

   right.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] During unit testing, the float array contains nan equality judgment [arrow]

Posted by "js8544 (via GitHub)" <gi...@apache.org>.
js8544 commented on issue #38624:
URL: https://github.com/apache/arrow/issues/38624#issuecomment-1801163688

   Yeah I think it's a bug because when comparing arrays we use the `TestingEqualOptions()` which has `nans_equal=true`. Could you submit a PR to fix this?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Float Array Equals for nan. [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #38624:
URL: https://github.com/apache/arrow/issues/38624#issuecomment-1798230925

   `EqualOptions` supports a `nans_equal` flag which would be helpful in this case.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] Float Array Equals for nan. [arrow]

Posted by "Light-City (via GitHub)" <gi...@apache.org>.
Light-City commented on issue #38624:
URL: https://github.com/apache/arrow/issues/38624#issuecomment-1798537108

   Sorry, I know this parameter, but I can't pass it during unit testing, such as ASSERT_TABLES_EQUAL


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++] During unit testing, the float array contains nan equality judgment [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #38624:
URL: https://github.com/apache/arrow/issues/38624#issuecomment-1801184988

   I agree it's a bug, lets fixing this


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org