feat(dataframe): add select/filter/count/show methods#19
Merged
andygrove merged 7 commits intoMay 13, 2026
Merged
Conversation
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.
Summary
Adds four transformation/action methods to
org.apache.datafusion.DataFrame, expanding the Java surface beyondsql→collect:Callers can now chain small queries in Java without round-tripping through SQL strings for every step:
Design notes
DataFrame::select_columns/filter/count/showall takeselfby value, so each new JNI fn clones the borrowedDataFrame(cheap:Arc<SessionState>+LogicalPlan) and operates on the clone. The caller's original JavaDataFramestays usable for further operations. This is intentionally different fromcollect(), which still consumes its receiver because it ships the actual execution stream out.filterparsing. UsesDataFrame::parse_sql_exprso the predicate is parsed against the DataFrame's own schema.show()output. Goes to native stdout via DataFusion's printer (same behavior as the Rust / Python APIs). This collides with Surefire's forked-JVM IPC stream and produces aCorrupted channelwarning during tests — non-fatal, BUILD SUCCESS — but worth addressing in a follow-up (Surefire forkNode extension or aformatString()companion method).sql/collectshape. A future async refactor would touch all ofDataFrameandSessionContexttogether.Out of scope
sort,join,aggregate,limit,distinct,withColumn, typedExpr/ColumnAPI, async/CompletableFutureoverloads. All can land in follow-ups using the same pattern.Testing
12 new tests in
DataFrameTransformationsTestcover:VALUEStables.DataFramestill usable afterselect/filter/count/show.filter().select().count().IllegalStateExceptionafterclose()and aftercollect().RuntimeExceptionon invalid column / malformed predicate.filter(...).count()matchesSELECT COUNT(*) ... WHERE ...(guarded byAssumptions.assumeTrueon file presence — skipped when TPC-H data is absent, as it is on CI).make testruns both the existing 13 tests and the 12 new ones — all 25 pass.cargo clippy --all-targets -- -D warningsis clean../mvnw spotless:checkand./mvnw apache-rat:checkare clean.