drin commented on code in PR #13487: URL: https://github.com/apache/arrow/pull/13487#discussion_r997268490
########## cpp/src/arrow/compute/kernels/scalar_hash_test.cc: ########## @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <gtest/gtest.h> + +#include "arrow/chunked_array.h" +#include "arrow/compute/api.h" +#include "arrow/compute/kernels/test_util.h" +#include "arrow/result.h" +#include "arrow/status.h" +#include "arrow/testing/gtest_util.h" +#include "arrow/testing/matchers.h" +#include "arrow/util/key_value_metadata.h" + +namespace arrow { +namespace compute { + +TEST(TestScalarHash, FastHash64Primitive) { + for (auto input_dtype : {int32(), uint32(), int8(), uint8()}) { + auto input_arr = ArrayFromJSON(input_dtype, "[3, null, 2, 0, 127, 64]"); + + ASSERT_OK_AND_ASSIGN(Datum hash_result, CallFunction("fast_hash_64", {input_arr})); Review Comment: @pitrou I finally got around to doing this, and it was a good ask because I had some bugs that really needed fixing. @bkietz helped point them out. For now I have only added validation for ints, but I'm working on it for lists of strings. The validation is essentially that I looked for the hashing operation that the hash code eventually bottoms out to and I use that to verify that the hashing is deterministic and follows the expected code path for the data 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]
