andishgar commented on PR #47586: URL: https://github.com/apache/arrow/pull/47586#issuecomment-3378351454
**@pitrou @rok** I’ve identified another issue while applying [this change](https://github.com/apache/arrow/pull/47586#discussion_r2410137144).It appears that NaN values are not handled correctly. To clarify, the patches below demonstrate that `NaN` values are not properly managed during sparse tensor creation. Would you prefer that I address this within the current pull request, or should I open a separate issue to track it? ```c++ diff --git a/cpp/src/arrow/sparse_tensor_test.cc b/cpp/src/arrow/sparse_tensor_test.cc index c9c28a1..6aa5835 100644 --- a/cpp/src/arrow/sparse_tensor_test.cc +++ b/cpp/src/arrow/sparse_tensor_test.cc @@ -499,6 +499,8 @@ TYPED_TEST_P(TestFloatingSparseCOOTensorEquality, TestEquality) { ASSERT_OK_AND_ASSIGN(st4, SparseCOOTensor::Make(*this->tensor2_)); EXPECT_FALSE(st4->Equals(*st4)); // same object EXPECT_TRUE(st4->Equals(*st4, EqualOptions().nans_equal(true))); // same object + ASSERT_OK_AND_ASSIGN(auto my_tensor,st4->ToTensor()); + ASSERT_TRUE(my_tensor->Equals(*this->tensor2_)); std::vector<c_value_type> values5 = this->values2_; std::shared_ptr<SparseCOOTensor> st5; @@ -955,6 +957,8 @@ TYPED_TEST_P(TestFloatingSparseCSRMatrixEquality, TestEquality) { ASSERT_OK_AND_ASSIGN(st4, SparseCSRMatrix::Make(*this->tensor2_)); EXPECT_FALSE(st4->Equals(*st4)); // same object EXPECT_TRUE(st4->Equals(*st4, EqualOptions().nans_equal(true))); // same object + ASSERT_OK_AND_ASSIGN(auto my_tensor,st4->ToTensor()); + ASSERT_TRUE(my_tensor->Equals(*this->tensor2_)); std::vector<c_value_type> values5 = this->values2_; std::shared_ptr<SparseCSRMatrix> st5; @@ -1290,6 +1294,8 @@ TYPED_TEST_P(TestFloatingSparseCSCMatrixEquality, TestEquality) { ASSERT_OK_AND_ASSIGN(st4, SparseCSCMatrix::Make(*this->tensor2_)); EXPECT_FALSE(st4->Equals(*st4)); // same object EXPECT_TRUE(st4->Equals(*st4, EqualOptions().nans_equal(true))); // same object + ASSERT_OK_AND_ASSIGN(auto my_tensor,st4->ToTensor()); + ASSERT_TRUE(my_tensor->Equals(*this->tensor2_)); std::vector<c_value_type> values5 = this->values2_; std::shared_ptr<SparseCSCMatrix> st5; @@ -1411,6 +1417,8 @@ TYPED_TEST_P(TestFloatingSparseCSFTensorEquality, TestEquality) { ASSERT_OK_AND_ASSIGN(st4, SparseCSFTensor::Make(*this->tensor2_)); EXPECT_FALSE(st4->Equals(*st4)); // same object EXPECT_TRUE(st4->Equals(*st4, EqualOptions().nans_equal(true))); // same object + ASSERT_OK_AND_ASSIGN(auto my_tensor,st4->ToTensor()); + ASSERT_TRUE(my_tensor->Equals(*this->tensor2_)); c_value_type values5[2][3][4][5] = {}; std::copy_n(&this->values2_[0][0][0][0], this->length_ / sizeof(c_value_type), ``` -- 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]
