From 2c167e63439bc60eca4cbd09e2d08bfaa745dd94 Mon Sep 17 00:00:00 2001 From: micah-white Date: Tue, 9 May 2023 17:09:00 -0500 Subject: [PATCH] Only hash array data bitmaps if the null count is not 0 --- cpp/src/arrow/scalar.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/scalar.cc b/cpp/src/arrow/scalar.cc index 1f467ad93b123..9c7c942683e58 100644 --- a/cpp/src/arrow/scalar.cc +++ b/cpp/src/arrow/scalar.cc @@ -153,9 +153,10 @@ struct ScalarHashImpl { Status ArrayHash(const ArrayData& a) { RETURN_NOT_OK(StdHash(a.length) & StdHash(a.GetNullCount())); - if (a.buffers[0] != nullptr) { + if (a.GetNullCount() != 0) { // We can't visit values without unboxing the whole array, so only hash - // the null bitmap for now. + // the null bitmap for now. Only hash the null bitmap if the null count + // is 0 to ensure hash consistency. RETURN_NOT_OK(BufferHash(*a.buffers[0])); } for (const auto& child : a.child_data) {