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.
bool Equals(const Array& arr, const EqualOptions& = EqualOptions::Defaults()) const;
bool Equals(const std::shared_ptr<Array>& arr,
const EqualOptions& = EqualOptions::Defaults()) const;
since ASSERT_TABLES_EQUAL will invoke ChunkedArray::ApproxEquals funciton.There is no way to pass options here
return internal::ApplyBinaryChunked(
*this, other,
[&](const Array& left_piece, const Array& right_piece,
int64_t ARROW_ARG_UNUSED(position)) {
if (!left_piece.ApproxEquals(right_piece, equal_options)) {
return Status::Invalid("Unequal piece");
}
return Status::OK();
})
.ok();
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:
Now the test will fail.
The reasons were found to be as follows:
So how can I modify the interface to support this function?
since ASSERT_TABLES_EQUAL will invoke ChunkedArray::ApproxEquals funciton.There is no way to pass options here
Component(s)
C++