[GLUTEN-12504][VL] Replay a broadcast hash join against its pre-built hash table - #12738
Draft
malinjawi wants to merge 2 commits into
Draft
[GLUTEN-12504][VL] Replay a broadcast hash join against its pre-built hash table#12738malinjawi wants to merge 2 commits into
malinjawi wants to merge 2 commits into
Conversation
…ro benchmark getJoin() dereferenced JniHashTableContext::vm_, which is only set from JNI_OnLoad, so converting a plan with a non-empty hashTableId crashed in a process with no JVM. callJavaGet() now returns std::optional and getJoin() reports a miss, the same way the JVM side cache reports one. VeloxColumnarBatchWriter creates the parquet writer on the first batch, where it learns the schema, so an input iterator that yields nothing left it null and close() dereferenced it. A BHJ build side is such an iterator. close() is now a no-op when nothing was written, and the dumper records the gap as a .empty marker rather than reading back a file that was never created.
… hash table A BHJ's build side is not streamed to the native operator: the hash table is built once per executor, or on the driver and broadcast, and handed to the join through a process local cache keyed by a hash table id. A standalone benchmark process has no such cache, so it replayed the join against an empty build side. VeloxRuntime now walks the converted plan for hash joins that resolved to a cached table, serializes each with HashTableSerializer and writes it next to the plan. GenericBenchmark gains --hash_table to load them back, registering with HashTableCache so HashBuild takes its cached path and never reads the build side, and with getJoin() so the converter chooses that path at all. getJoin() resolves against those tables only when no JVM is attached, so executors are unaffected.
malinjawi
force-pushed
the
feat/gluten-12504-bhj-hashtable-replay
branch
from
August 10, 2026 10:01
7db503c to
77c692d
Compare
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.
What changes are proposed in this pull request?
Closes #12504. Stacked on #12592, please review that first.
A BHJ's build side never reaches the native operator as data. Its hash table is built once per executor and handed to the join through a process local cache, so a standalone benchmark process had nothing to join against and replayed the join against an empty build side.
Dump:
VeloxRuntimewalks the converted plan for hash joins that resolved to a cached table and writes each one ashashtable_{stageId}_{partitionId}_{vId}_{cacheKey}.bin.Replay:
GenericBenchmarkgains--hash_table. Each file is registered withHashTableCache, soHashBuildtakes its cached path and never reads the build side, and withgetJoin(), so the converter chooses that path.getJoin()resolves against these only when no JVM is attached, so executors are unaffected.How was this patch tested?
New
hash_table_dump_file_testcovers the dump format. Built and linked locally, includinggeneric_benchmark.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code