felipecrv commented on code in PR #38394:
URL: https://github.com/apache/arrow/pull/38394#discussion_r1431458021


##########
cpp/src/arrow/compute/kernels/vector_hash.cc:
##########
@@ -457,14 +457,17 @@ class DictionaryHashKernel : public HashKernel {
       // A better approach may be to run the kernel over each individual chunk,
       // and then hash-aggregate all results (for example sum-group-by for
       // the "value_counts" kernel).
+      if (dictionary_unifier_ == nullptr) {
+        ARROW_ASSIGN_OR_RAISE(dictionary_unifier_,
+                              DictionaryUnifier::Make(dictionary_->type()));
+        RETURN_NOT_OK(dictionary_unifier_->Unify(*dictionary_));
+      }
       auto out_dict_type = dictionary_->type();
       std::shared_ptr<Buffer> transpose_map;
       std::shared_ptr<Array> out_dict;
-      ARROW_ASSIGN_OR_RAISE(auto unifier, 
DictionaryUnifier::Make(out_dict_type));
 
-      ARROW_CHECK_OK(unifier->Unify(*dictionary_));
-      ARROW_CHECK_OK(unifier->Unify(*arr_dict, &transpose_map));
-      ARROW_CHECK_OK(unifier->GetResult(&out_dict_type, &out_dict));
+      RETURN_NOT_OK(dictionary_unifier_->Unify(*arr_dict, &transpose_map));
+      RETURN_NOT_OK(dictionary_unifier_->GetResult(&out_dict_type, &out_dict));
 
       dictionary_ = out_dict;

Review Comment:
   @js8544 to clarify, `dictionary_unifier_ = unify(dictionary_unifier_, 
arr_dict)` means something like `unifier->unify(arr_dict)` in the actual code :)



-- 
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]

Reply via email to