Joins are the largest missing piece of the DataFrame API today; without them, Java callers cannot programmatically express even simple star-join queries that DataFusion's Rust API has supported for years.
What changes are included in this PR?
This PR ships Phase 1 : column-name join plus joinOn with String-form predicates. By committing to SQL-string predicates here, it also closes the Phase-2 design question. A typed Expr builder is deliberately deferred.
New public Java enum org.apache.datafusion.JoinType mirroring upstream's 10-variant enum (INNER, LEFT, RIGHT, FULL, LEFT_SEMI, RIGHT_SEMI, LEFT_ANTI, RIGHT_ANTI, LEFT_MARK, RIGHT_MARK). Crosses JNI as a byte code, mirroring the existing Volatility precedent for UDFs.
Three new methods on DataFrame:
DataFrame.join(right, type, leftCols, rightCols) — equi-join on named columns, no residual filter.
DataFrame.join(right, type, leftCols, rightCols, filter) — equi-join with a residual SQL filter parsed against the combined schema of left + right.
DataFrame.joinOn(right, type, predicates...) — arbitrary join predicates, each parsed as a SQL expression against the combined schema. Predicates may be qualified with the relation alias when ambiguous (e.g. "l.id = r.id", "left.x < right.y").
All three are non-consuming on the Java side: both left (the receiver) and right remain usable and must still be closed independently. Upstream's Rust join / join_on consume both, but the JNI layer clones the underlying Arc-backed DataFrame like every other transformation method (select / filter / withColumn / unnestColumns). This matches the established Java-side convention and supports the natural star-join pattern where the same fact table is joined to multiple dimensions:
Predicate validation pre-flight on the Java side. DataFusion's parser is the source of truth and surfaces errors the same way filter(String) already does.
Are these changes tested?
Yes, 18 new tests in core/src/test/java/org/apache/datafusion/DataFrameJoinTest.java
No API removals, no deprecations, no behavior change for existing callers. The native binary is unchanged in size (no new Cargo features or dependencies).
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
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.
Which issue does this PR close?
Rationale for this change
Joins are the largest missing piece of the DataFrame API today; without them, Java callers cannot programmatically express even simple star-join queries that DataFusion's Rust API has supported for years.
What changes are included in this PR?
This PR ships Phase 1 : column-name join plus joinOn with String-form predicates. By committing to SQL-string predicates here, it also closes the Phase-2 design question. A typed Expr builder is deliberately deferred.
New public Java enum org.apache.datafusion.JoinType mirroring upstream's 10-variant enum (INNER, LEFT, RIGHT, FULL, LEFT_SEMI, RIGHT_SEMI, LEFT_ANTI, RIGHT_ANTI, LEFT_MARK, RIGHT_MARK). Crosses JNI as a byte code, mirroring the existing Volatility precedent for UDFs.
Three new methods on DataFrame:
All three are non-consuming on the Java side: both left (the receiver) and right remain usable and must still be closed independently. Upstream's Rust join / join_on consume both, but the JNI layer clones the underlying Arc-backed DataFrame like every other transformation method (select / filter / withColumn / unnestColumns). This matches the established Java-side convention and supports the natural star-join pattern where the same fact table is joined to multiple dimensions:
Out of scope (for follow-ups):
Are these changes tested?
Yes, 18 new tests in core/src/test/java/org/apache/datafusion/DataFrameJoinTest.java
Are there any user-facing changes?
Yes, purely additive. New public API:
No API removals, no deprecations, no behavior change for existing callers. The native binary is unchanged in size (no new Cargo features or dependencies).