Skip to content

GH-32381: [C++] Improve error handling for hash table merges - #49512

Merged
zanmato1984 merged 5 commits into
apache:mainfrom
kris-gaudel:kris-gaudel/hash-table-merge-errors
May 14, 2026
Merged

GH-32381: [C++] Improve error handling for hash table merges#49512
zanmato1984 merged 5 commits into
apache:mainfrom
kris-gaudel:kris-gaudel/hash-table-merge-errors

Conversation

@kris-gaudel

@kris-gaudelkris-gaudel commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Fixes#32381

What changes are included in this PR?

Proper error handling in util/hashing.h and unit test for said error handling in util/hashing_test.cc

Are these changes tested?

Yes, via included unit test

Are there any user-facing changes?

Yes, error handling in hashing utilities

@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@kris-gaudelkris-gaudel changed the title Kris gaudel/hash table merge errorsGH-32381: [C++] Improve error handling for hash table mergesMar 14, 2026

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — the fix direction looks right to me overall, but I think there are two follow-ups worth addressing inline.

Comment threadcpp/src/arrow/util/hashing_test.cc
Comment threadcpp/src/arrow/util/hashing.h Outdated
@kris-gaudel
kris-gaudelforce-pushed the kris-gaudel/hash-table-merge-errors branch from 7b7f298 to bdcacb8CompareApril 20, 2026 03:53
@kris-gaudel

Copy link
Copy Markdown
ContributorAuthor

@zanmato1984 Anything else? I think I addressed everything

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment (helper refactor idea)

Nice work on propagating merge-time failures. One follow-up suggestion to make BinaryMemoTable::MergeTable a bit less awkward: since VisitValues(...) is void, the current implementation has to capture a Status and early-exit the visitor.

Consider adding a small helper that allows a fallible visitor, e.g.:

// Like VisitValues but allows the visitor to fail.// Visitor signature: Status(std::string_view).template <typename VisitFunc>
Status VisitValuesStatus(int32_t start, VisitFunc&& visit) const {
for (int32_t i = start; i < size(); ++i) {
RETURN_NOT_OK(visit(binary_builder_.GetView(i)));
}
returnStatus::OK();
}

and then implement merge as:

return other_table.VisitValuesStatus(0, [this](std::string_view v) {
int32_t unused;
returnthis->GetOrInsert(v, &unused);
});

(Your existing logic is totally fine; this is just a readability/style cleanup.)

Comment threadcpp/src/arrow/util/hashing.h Outdated
@kris-gaudel
kris-gaudelforce-pushed the kris-gaudel/hash-table-merge-errors branch from d2f63a8 to a2cd26fCompareMay 13, 2026 21:33
@kris-gaudel

Copy link
Copy Markdown
ContributorAuthor

@zanmato1984 thank you for the suggestions! Lmk what you think

@zanmato1984zanmato1984 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Thanks for working on this!

@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels May 14, 2026
@zanmato1984
zanmato1984 merged commit 70113a6 into apache:mainMay 14, 2026
54 of 56 checks passed
@zanmato1984zanmato1984 removed the awaiting committer review Awaiting committer review label May 14, 2026
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 70113a6.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 25 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…pache#49512)
### Rationale for this change
Fixesapache#32381 ### What changes are included in this PR?
Proper error handling in `util/hashing.h` and unit test for said error handling in `util/hashing_test.cc`
### Are these changes tested?
Yes, via included unit test
### Are there any user-facing changes?
Yes, error handling in hashing utilities
* GitHub Issue: apache#32381
Authored-by: kris-gaudel <kristofergaudel@gmail.com>
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Improve error handling for hash table merges

2 participants

@kris-gaudel@zanmato1984