[C++] Enable EqualOptions::atol_ for arrow::Tensor and arrow::SparseTensor, and EqualOptions::signed_zero_ for arrow::SparseTensor
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the bug, including details regarding any error messages, version, and platform.
As [mentioned here](https://github.com/apache/arrow/issues/46767#issuecomment-2959468747), `arrow::EqualOptions::atol_` is not applied when comparing `arrow::Tensor` and` arrow::SparseTensor`.
Additionally, I found that signed zero is not handled correctly in `arrow::SparseTensor`. For example, the following assertion unexpectedly passes:
```c++
TEST(Tensor,FloatComparasion) {
std::vector v1 = {+0.0};
std::vector v2 = {-0.0};
std::shared_ptr b1 = Buffer::Wrap(v1);
std::shared_ptr b2 = Buffer::Wrap(v2);
NumericTensor t1(b1, {1, 1});
NumericTensor t2(b2, {1, 1});
auto st1 = SparseCSCMatrix::Make(t1).ValueOrDie();
auto st2 = SparseCSCMatrix::Make(t2).ValueOrDie();
ASSERT_FALSE(st1->Equals(*st2, EqualOptions::Defaults().signed_zeros_equal(true)));
ASSERT_FALSE(st1->Equals(*st2, EqualOptions::Defaults().signed_zeros_equal(false)));
}
```
### Component(s)
C++
Contributor guide
Assessment
This issue has not been assessed yet.