[GLUTEN-12597][CORE] Migrate nested loop joins from CrossRel to NestedLoopJoinRel (Substrait 0.98) - #12700
Open
nielspardon wants to merge 1 commit into
Open
Conversation
nielspardon
force-pushed
the
feat/substrait-0.98-inc3-cross-to-nlj
branch
from
August 5, 2026 09:01
9dae337 to
acb01ba
Compare
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
…dLoopJoinRel (Substrait 0.98) Substrait 0.98 splits Gluten's overloaded CrossRel (which carried both `expression` and `type`) into a pure-cartesian CrossRel plus a new NestedLoopJoinRel (expression=4, type=5) with a paired JoinType enum. This increment of the proto rebase adopts that split across the vendored proto, the JVM producer, and both native consumers in lockstep. The NestedLoopJoinRel.JoinType enum reorders the anti/semi/single values relative to the old CrossRel.JoinType fork, but Gluten only ever emits and consumes INNER/OUTER/LEFT/LEFT_SEMI, whose proto numbers (1/2/3/5) are identical in both, so the split is semantically neutral for Gluten's code paths. The new rel takes its official Substrait 0.98 Rel-oneof number nested_loop_join = 18. Fields 18 and 19 were held by write and top_n in Gluten's fork, so both are moved to their own final 0.98 numbers (write = 19, top_n = 23) to free the slot. Field numbers are codegen-transparent for Gluten's coupled build (single proto source, transient plans, producer + both consumers regenerate and ship together), so these moves are purely mechanical. The remaining fork-order rels and the not-yet-added 0.98 relations are reconciled in the final oneof reconciliation increment. Part of apache#12597. Generated-by: Claude Code (Claude Opus 4.8)
nielspardon
force-pushed
the
feat/substrait-0.98-inc3-cross-to-nlj
branch
from
August 5, 2026 12:26
acb01ba to
887aa5b
Compare
|
Run Gluten Clickhouse CI on x86 |
Contributor
Author
|
The three failing checks all failed at dependency-download / tool-install steps — not in the actual build, test, or format logic. This run hit a bad network window for the hosted runners:
Everything else is green — both native backends build (Velox + ClickHouse), the full JVM producer, all join-bearing Spark groups, and the entire TPC-H/DS matrix. Could a committer kindly re-run these three failed jobs? Thanks! 🤖 Generated with AI Generated-by: Claude Code (Claude Opus 4.8) |
nielspardon
marked this pull request as ready for review
August 7, 2026 05:43
19 tasks
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?
One increment of the Substrait proto rebase (v0.23.0 → 0.98.0), tracked by #12597.
Substrait 0.98 splits Gluten's overloaded
CrossRel— which carried bothexpressionandtype— into a pure-cartesianCrossRelplus a newNestedLoopJoinRel(expression=4,type=5) with a pairedJoinTypeenum. This PR adopts that split across the vendored proto, the JVM producer, and both native consumers, in lockstep:algebra.proto): reduceCrossRelto the pure-cartesian shape; addNestedLoopJoinRelverbatim from 0.98 (including the newLEFT_MARK/RIGHT_MARKjoin types). The new rel is parked at a temporary Rel-oneof field number; the final oneof-reconciliation increment relocates it to the officialnested_loop_join = 18. Field numbers are codegen-transparent for Gluten's coupled build (single proto source, transient plans, producer + both consumers regenerate and ship together → no wire-compat constraint).CrossRelNode→NestedLoopJoinRelNode,RelBuilder.makeNestedLoopJoinRel,SubstraitUtil.toNestedLoopJoinSubstrait, and all callers (CartesianProductExecTransformer,BroadcastNestedLoopJoinExecTransformer,JoinUtils,StorageJoinBuilder).SubstraitToVeloxPlanandSubstraitToVeloxPlanValidatordispatch and parseNestedLoopJoinRelinstead ofCrossRel.CrossRelParser,CHUtil, andBroadcastJoinBuilderre-point tonested_loop_join/NestedLoopJoinRel_JoinType(class/file names kept to minimize churn).The
NestedLoopJoinRel.JoinTypeenum reorders the anti/semi/single values relative to the oldCrossRel.JoinTypefork, but Gluten's producers only ever emitINNER/OUTER/LEFT/LEFT_SEMI— whose proto numbers (1/2/3/5) are identical in both — and both consumers only handle those same values, so the split is semantically neutral for Gluten's code paths.Part of #12597.
How was this patch tested?
SubstraitUtilJoinTypeSuitelocks the semantic-neutrality invariant: the Spark →NestedLoopJoinRel.JoinTypemapping, the stable proto numbers (INNER=1/OUTER=2/LEFT=3/LEFT_SEMI=5), the unsupported-type →UNRECOGNIZEDfallback, andordinal() == getNumber()for every declared enum value (the raw-ordinal-over-JNI path thatStorageJoinBuilderrelies on).gluten-substrait, spark-3.5) and the Velox native backend both compile cleanly; the new suite passes.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
🤖 Generated with AI