kou commented on code in PR #46422:
URL: https://github.com/apache/arrow/pull/46422#discussion_r2120940464
##########
cpp/src/arrow/array/statistics.cc:
##########
@@ -15,7 +15,66 @@
// specific language governing permissions and limitations
// under the License.
-// This empty .cc file is for embedding not inlined symbols in
-// arrow::ArrayStatistics into libarrow.
-
#include "arrow/array/statistics.h"
+
+#include <cmath>
+#include <type_traits>
+
+#include "arrow/compare.h"
+#include "arrow/util/logging_internal.h"
+namespace arrow {
+
+namespace {
+
+using ValueType = ArrayStatistics::ValueType;
+
+bool DoubleEquals(const double& left, const double& right, const EqualOptions&
options) {
+ if (left == right) {
+ return options.signed_zeros_equal() || (std::signbit(left) ==
std::signbit(right));
+ } else if (options.nans_equal() && (std::isnan(left) || std::isnan(right))) {
+ return std::isnan(left) && std::isnan(right);
+ } else if (options.use_atol()) {
+ return std::fabs(left - right) <= options.atol();
+ } else {
+ return false;
+ }
+}
Review Comment:
Can we reuse existing implementation?
https://github.com/apache/arrow/blob/dfac0ccdba379692b29a74f09c62827df3ba2f3c/cpp/src/arrow/compare.cc#L72-L167
--
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]