felipecrv commented on code in PR #38394:
URL: https://github.com/apache/arrow/pull/38394#discussion_r1435305627
##########
cpp/src/arrow/compute/kernels/vector_hash.cc:
##########
@@ -495,12 +500,25 @@ class DictionaryHashKernel : public HashKernel {
return dictionary_value_type_;
}
- std::shared_ptr<Array> dictionary() const { return dictionary_; }
+ Result<std::shared_ptr<Array>> dictionary() const {
Review Comment:
```suggestion
/// This can't be called more than once because
DictionaryUnifier::GetResult()
/// can't be called more than once and produce the same output.
Result<std::shared_ptr<Array>> dictionary() const {
```
##########
cpp/src/arrow/compute/kernels/vector_hash.cc:
##########
@@ -495,12 +500,25 @@ class DictionaryHashKernel : public HashKernel {
return dictionary_value_type_;
}
- std::shared_ptr<Array> dictionary() const { return dictionary_; }
+ Result<std::shared_ptr<Array>> dictionary() const {
+ if (!first_dictionary_) { // Append is never called
+ return nullptr;
+ }
+ if (!dictionary_unifier_) { // Append is called only once
+ return first_dictionary_;
+ }
Review Comment:
```suggestion
if (!first_dictionary_) { // Append was never called
return nullptr;
}
if (!dictionary_unifier_) { // Append was called only once
return first_dictionary_;
}
```
--
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]