[GLUTEN-12504][VL] Fix segfault looking up BHJ hash table without a JVM#12592
Draft
malinjawi wants to merge 1 commit into
Draft
[GLUTEN-12504][VL] Fix segfault looking up BHJ hash table without a JVM#12592malinjawi wants to merge 1 commit into
malinjawi wants to merge 1 commit into
Conversation
getJoin() dereferenced JniHashTableContext::vm_ unconditionally. vm_ is only set from JNI_OnLoad, so in a process with no JVM attached (the standalone micro benchmark, the native tests) it is null and converting any substrait plan with a non-empty hashTableId crashed. The existing try/catch at the call site cannot help, since a null deref is a signal rather than an exception. Report a cache miss instead, so the caller builds the hash table from the join's build side input. Also add the missing checkException/DeleteLocalRef in callJavaGet, matching the other JNI callbacks in this tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12504.
getJoin()dereferencesJniHashTableContext::vm_, which is only set fromJNI_OnLoad. In a process with no JVM (micro benchmark, native tests) it is null, so converting a plan with a non-emptyhashTableIdsegfaults. Thetry/catchat the call site cannot catch a null deref.Returns a cache miss instead, so the caller builds from the build side input. Adds the missing
checkException/DeleteLocalRefincallJavaGet, and a regression test that runs in the no-JVM configuration.Not yet compiled locally — relying on CI.
Note this does not make the micro benchmark support BHJ; the build side is still dumped empty. Design for that is in #12504.
🤖 Generated with Claude Code