[GLUTEN-12921][VL] Support full outer BroadcastNestedLoopJoin with guarded rewrite - #12922
Open
WangGuangxin wants to merge 3 commits into
Open
[GLUTEN-12921][VL] Support full outer BroadcastNestedLoopJoin with guarded rewrite#12922WangGuangxin wants to merge 3 commits into
WangGuangxin wants to merge 3 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
2 similar comments
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
8 similar comments
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
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?
This PR adds Velox support for
BroadcastNestedLoopJoinExecinFULL OUTER JOINcases by rewriting the Spark physical plan into a composition that Velox already supports, instead of falling back the originalfull outer BNLJ.
The rewrite transforms:
BroadcastNestedLoopJoinExec(..., FullOuter, ...)into:
Unionto combine both branchesThis avoids introducing native Velox full outer nested-loop join support while preserving full outer join semantics, including null-sensitive cases.
In addition, this PR adds a conservative size-based guard for the rewrite:
spark.gluten.sql.columnar.broadcastNestedLoopJoin.fullOuterRewriteThresholdOtherwise, Gluten keeps the original behavior and lets the plan fall back instead of forcing the rewrite on larger joins.
Why are the changes needed?
Velox does not support Spark's
FULL OUTERbroadcast nested loop join end-to-end today, so Gluten falls back for these queries.A direct native implementation is not a good short-term option because:
A rewrite-based solution is lower risk because it reuses operators already supported by Velox.
However, rewriting every full outer BNLJ into two joins can be more expensive than a single Spark row-based fallback join. To keep the feature safe, this PR only enables the rewrite for small, stats-known joins
and preserves fallback for larger or unknown-size cases.
How was this patch tested?
More UT
Config
A new config is introduced:
spark.gluten.sql.columnar.backend.velox.broadcastNLJ.fullOuterRewriteThresholdIt controls the maximum per-side logical plan size for enabling the full outer BNLJ rewrite.
Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: GPT-5
Related issue: #12921