René's URL Explorer Experiment


Title: feat(udf)!: switch ScalarFunction.evaluate to ColumnarValue API (closes #62) by andygrove · Pull Request #64 · apache/datafusion-java · GitHub

Open Graph Title: feat(udf)!: switch ScalarFunction.evaluate to ColumnarValue API (closes #62) by andygrove · Pull Request #64 · apache/datafusion-java

X Title: feat(udf)!: switch ScalarFunction.evaluate to ColumnarValue API (closes #62) by andygrove · Pull Request #64 · apache/datafusion-java

Description: Which issue does this PR close? Closes #62. Rationale for this change DataFusion's Rust ScalarUDFImpl::invoke_with_args speaks ColumnarValue (Array or Scalar) rather than raw Arrow arrays. The Java binding previously materialised every scalar arg to a length-N array before crossing the JNI boundary, which lost the scalar-vs-array distinction and forced nullary UDFs to learn the batch row count by some out-of-band channel (the workaround proposed in PR #57). Aligning the Java API with the Rust enum eliminates the workaround: a nullary UDF can return ColumnarValue.scalar(...) and the framework broadcasts it, and a UDF that takes literals sees them as Scalars without per-row duplication. What changes are included in this PR? New ColumnarValue sealed interface (Array/Scalar records, factory enforcing length-1 invariant on scalars). New ScalarFunctionArgs record bundling List and rowCount. ScalarFunction.evaluate is now evaluate(BufferAllocator, ScalarFunctionArgs) -> ColumnarValue (source-breaking). JniBridge.invokeScalarUdf rewritten to ship two struct arrays (length-N Array args + length-1 Scalar args) plus a byte[] argKinds positional mask, returning a byte indicating the result variant. JNI signature is now (Lorg/apache/datafusion/ScalarFunction;JJJJ[BJJI)B. Native invoke_with_args no longer materialises scalars; it partitions args by ColumnarValue variant and reconstructs the result from the returned kind byte via ScalarValue::try_from_array. AddOneExample and docs/source/user-guide/scalar-udf.md updated; new "Returning a Scalar" section added to the user guide. How are these changes tested? make test — 135 tests pass (12 pre-existing skips). Existing ScalarUdfTest cases (AddOne, Concat, Square, error paths, volatility round-trip) adapted to the new signature, plus three new tests: nullaryScalarReturnUdf_overMultiRowQuery_broadcasts — a nullary java_pi returns ColumnarValue.scalar(...) and the framework expands it across rows, replacing the rowCount workaround. scalarLiteralArg_arrivesAsScalarColumnarValue — UDF asserts that a SQL literal arrives as ColumnarValue.Scalar (length 1), proving scalar-ness survives the FFI. udfReturningScalar_isBroadcastByFramework — explicit scalar-return path test. Also covered by cargo clippy --all-targets --workspace -- -D warnings (clean) and ./mvnw spotless:check (clean). Are there any user-facing changes? Yes — source-breaking signature change to ScalarFunction.evaluate. Implementations must: Before: public FieldVector evaluate(BufferAllocator allocator, List args) { IntVector in = (IntVector) args.get(0); // ... return out; } After: public ColumnarValue evaluate(BufferAllocator allocator, ScalarFunctionArgs args) { IntVector in = (IntVector) args.args().get(0).vector(); // ... return ColumnarValue.array(out); } Nullary or broadcast-style UDFs can return ColumnarValue.scalar(...) over a length-1 vector.

Open Graph Description: Which issue does this PR close? Closes #62. Rationale for this change DataFusion's Rust ScalarUDFImpl::invoke_with_args speaks ColumnarValue (Array or Scalar) rather than raw Arrow arrays. The ...

X Description: Which issue does this PR close? Closes #62. Rationale for this change DataFusion's Rust ScalarUDFImpl::invoke_with_args speaks ColumnarValue (Array or Scalar) rather than raw Arrow arrays. ...

Opengraph URL: https://github.com/apache/datafusion-java/pull/64

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:79afedd0-63ff-59f5-f7bd-120c2368fa41
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD31C:1E2FF8:3035:412B:6B046A48
html-safe-nonce2b49f802a0c74f4f1117fc2587839e41ee5ae8a4404afbf4ac4be558c00f5443
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzFDOjFFMkZGODozMDM1OjQxMkI6NkIwNDZBNDgiLCJ2aXNpdG9yX2lkIjoiNzMxNDc0MjMyMzgyMzUzNjcxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac41b5f6e81fca33ac222c41d8f0835fe06e20a55a8db275f8238a06ed115a7661
hovercard-subject-tagpull_request:3702700881
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/apache/datafusion-java/pull/64/files
twitter:imagehttps://avatars.githubusercontent.com/u/934084?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/934084?s=400&v=4
og:image:altWhich issue does this PR close? Closes #62. Rationale for this change DataFusion's Rust ScalarUDFImpl::invoke_with_args speaks ColumnarValue (Array or Scalar) rather than raw Arrow arrays. The ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/apache/datafusion-java git https://github.com/apache/datafusion-java.git
octolytics-dimension-user_id47359
octolytics-dimension-user_loginapache
octolytics-dimension-repository_id1237105117
octolytics-dimension-repository_nwoapache/datafusion-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1237105117
octolytics-dimension-repository_network_root_nwoapache/datafusion-java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/apache/datafusion-java/pull/64/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-java%2Fpull%2F64%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-java%2Fpull%2F64%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=apache%2Fdatafusion-java
Reloadhttps://github.com/apache/datafusion-java/pull/64/files
Reloadhttps://github.com/apache/datafusion-java/pull/64/files
Reloadhttps://github.com/apache/datafusion-java/pull/64/files
apachehttps://github.com/apache
datafusion-javahttps://github.com/apache/datafusion-java
Codehttps://github.com/apache/datafusion-java
Issues10 (10)https://github.com/apache/datafusion-java/issues
Pull requests10 (10)https://github.com/apache/datafusion-java/pulls
Discussionshttps://github.com/apache/datafusion-java/discussions
Actionshttps://github.com/apache/datafusion-java/actions
Security and qualityhttps://github.com/apache/datafusion-java/security
Insightshttps://github.com/apache/datafusion-java/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fapache%2Fdatafusion-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fapache%2Fdatafusion-java%2Fissues%2Fnew%2Fchoose
andygrovehttps://github.com/andygrove
apache:mainhttps://github.com/apache/datafusion-java/tree/main
andygrove:feat/columnar-value-udfhttps://github.com/andygrove/datafusion-java/tree/feat/columnar-value-udf
Conversation 3 https://github.com/apache/datafusion-java/pull/64
Commits 7 https://github.com/apache/datafusion-java/pull/64/commits
Checks 2 https://github.com/apache/datafusion-java/pull/64/checks
Files changed https://github.com/apache/datafusion-java/pull/64/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/64/files
feat(udf)!: switch ScalarFunction.evaluate to ColumnarValue API (closes #62) https://github.com/apache/datafusion-java/pull/64/files#top
Show all changes 7 commits https://github.com/apache/datafusion-java/pull/64/files
da80e36 feat(udf): add ColumnarValue sealed type for Array-or-Scalar values andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/da80e36a36de8e075925d6af012a34e2e574c101
289a0fa feat(udf): add ScalarFunctionArgs record bundling ColumnarValues and … andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/289a0fa8ee20291f26c10378375aeedc0bce3157
c60956e feat(udf)!: switch ScalarFunction.evaluate to ColumnarValue API andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/c60956e12438752bc9d4ce93bd143dbefd868272
632a7e0 feat(udf): preserve scalar-vs-array across JNI in invoke_with_args andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/632a7e0c7ef8852979f8df356f7f5eb65bc133c2
34248fd test(udf): cover scalar-input, scalar-output, and nullary-broadcast p… andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/34248fd3b7f31679d47a926f6165a6688457340c
60e0c38 docs(udf): update scalar UDF guide for ColumnarValue API andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/60e0c38a1561cbb43f1cdb65d9530e849ea3b591
7e1bb76 style: apply spotless and rustfmt andygrove May 18, 2026 https://github.com/apache/datafusion-java/pull/64/commits/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf
Clear filters https://github.com/apache/datafusion-java/pull/64/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/64/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/64/files
ColumnarValue.java https://github.com/apache/datafusion-java/pull/64/files#diff-a09abefab3f1472ad97f4db0c0f96a63a269fc30696ee74f07cadfd129d8e018
ScalarFunction.java https://github.com/apache/datafusion-java/pull/64/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
ScalarFunctionArgs.java https://github.com/apache/datafusion-java/pull/64/files#diff-91eba7154ba1dd365939d75b6fd0283c9a662644f1257e006ebd4031ee00713a
JniBridge.java https://github.com/apache/datafusion-java/pull/64/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
ColumnarValueTest.java https://github.com/apache/datafusion-java/pull/64/files#diff-fc17b8ef900b0eadfca135396015921f2a336a9d5cc672364a7cd0ee0ce2a19f
ScalarFunctionArgsTest.java https://github.com/apache/datafusion-java/pull/64/files#diff-e30113f9353197bf008d110748f5845b17ec705eb508acc81bb2bcf5963d5fec
ScalarUdfTest.java https://github.com/apache/datafusion-java/pull/64/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
scalar-udf.md https://github.com/apache/datafusion-java/pull/64/files#diff-0c0208f26eacc9b3a2c6e9c178bc140ab31ff32d4d097b4971bfda47674626e9
AddOneExample.java https://github.com/apache/datafusion-java/pull/64/files#diff-69812f77b37e69bcc057b6c77b21304b26cf9af77d2692a827e3ca28188e4222
lib.rs https://github.com/apache/datafusion-java/pull/64/files#diff-697685fba8d3d4a3a8a287bad6e1369e50e1c98bd878823415758c2a642cbb6e
udf.rs https://github.com/apache/datafusion-java/pull/64/files#diff-1c9a0800b6151fc16f2965eb70c73bcf80208567d7d14d2f6f28de9f59cdda8a
core/src/main/java/org/apache/datafusion/ColumnarValue.javahttps://github.com/apache/datafusion-java/pull/64/files#diff-a09abefab3f1472ad97f4db0c0f96a63a269fc30696ee74f07cadfd129d8e018
View file https://github.com/andygrove/datafusion-java/blob/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf/core/src/main/java/org/apache/datafusion/ColumnarValue.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/64/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/ScalarFunction.javahttps://github.com/apache/datafusion-java/pull/64/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
View file https://github.com/andygrove/datafusion-java/blob/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf/core/src/main/java/org/apache/datafusion/ScalarFunction.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/64/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/64/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
https://github.com/apache/datafusion-java/pull/64/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
https://github.com/apache/datafusion-java/pull/64/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
core/src/main/java/org/apache/datafusion/ScalarFunctionArgs.javahttps://github.com/apache/datafusion-java/pull/64/files#diff-91eba7154ba1dd365939d75b6fd0283c9a662644f1257e006ebd4031ee00713a
View file https://github.com/andygrove/datafusion-java/blob/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf/core/src/main/java/org/apache/datafusion/ScalarFunctionArgs.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/64/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/internal/JniBridge.javahttps://github.com/apache/datafusion-java/pull/64/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
View file https://github.com/andygrove/datafusion-java/blob/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf/core/src/main/java/org/apache/datafusion/internal/JniBridge.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/64/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/64/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
https://github.com/apache/datafusion-java/pull/64/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
https://github.com/apache/datafusion-java/pull/64/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
core/src/test/java/org/apache/datafusion/ColumnarValueTest.javahttps://github.com/apache/datafusion-java/pull/64/files#diff-fc17b8ef900b0eadfca135396015921f2a336a9d5cc672364a7cd0ee0ce2a19f
View file https://github.com/andygrove/datafusion-java/blob/7e1bb76b8d0bed4c92a5be04ecea94bb3c49a6bf/core/src/test/java/org/apache/datafusion/ColumnarValueTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/64/{{ revealButtonHref }}
Please reload this pagehttps://github.com/apache/datafusion-java/pull/64/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/64/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.