Skip to content

[GLUTEN-12504][VL] Fix segfault looking up BHJ hash table without a JVM#12592

Draft
malinjawi wants to merge 1 commit into
apache:mainfrom
malinjawi:fix/gluten-12504-bhj-microbenchmark
Draft

[GLUTEN-12504][VL] Fix segfault looking up BHJ hash table without a JVM#12592
malinjawi wants to merge 1 commit into
apache:mainfrom
malinjawi:fix/gluten-12504-bhj-microbenchmark

Conversation

@malinjawi

Copy link
Copy Markdown
Contributor

Fixes #12504.

getJoin() dereferences JniHashTableContext::vm_, which is only set from JNI_OnLoad. In a process with no JVM (micro benchmark, native tests) it is null, so converting a plan with a non-empty hashTableId segfaults. The try/catch at 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/DeleteLocalRef in callJavaGet, 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

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>
Sign up for free to 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.

Microbenchmark doesn't support BHJ

1 participant