René's URL Explorer Experiment


Title: fix(udf): pass batch row count to ScalarFunction.evaluate by LantaoJin · Pull Request #57 · apache/datafusion-java · GitHub

Open Graph Title: fix(udf): pass batch row count to ScalarFunction.evaluate by LantaoJin · Pull Request #57 · apache/datafusion-java

X Title: fix(udf): pass batch row count to ScalarFunction.evaluate by LantaoJin · Pull Request #57 · apache/datafusion-java

Description: Which issue does this PR close? Closes #56 . Rationale for this change ScalarFunction.evaluate(BufferAllocator, List) (introduced in #46) is the contract every Java-implemented scalar UDF must satisfy. It must return a FieldVector whose getValueCount() matches the batch row count DataFusion is driving through the operator tree. For UDFs with at least one argument, the body can read args.get(0).getValueCount() to learn how many rows to produce. For nullary UDFs -- zero arguments, e.g. analogs of random(), pi(), now() -- args is the empty list, and the body has no other channel to learn the row count. The native side already knows the value: ScalarFunctionArgs::number_rows is read at native/src/udf.rs:100, used to materialise scalar arg columns at :106. The Java bridge (JniBridge.invokeScalarUdf) receives it but only uses it after the fact, to validate the returned vector's length. It is never communicated to impl.evaluate(...). The result: any nullary UDF that DataFusion does not constant-fold (anything declared Volatility.VOLATILE, or STABLE calls in plans the optimizer cannot fold) trips the post-hoc row-count validation as soon as it runs over a batch with more than one row. What changes are included in this PR? ScalarFunction.evaluate(BufferAllocator allocator, List args, int rowCount) — adds a third parameter carrying the per-batch row count. Source-breaking signature change to a public interface. The repo is pre-release; only five existing implementations needed an unused-parameter update (four test UDFs in ScalarUdfTest, one in examples/AddOneExample). JniBridge.invokeScalarUdf (core/src/main/java/org/apache/datafusion/internal/JniBridge.java) now forwards the existing expectedRowCount parameter into impl.evaluate(...). Post-call validation against the same value is unchanged. No native-side change. The value was already on the wire. Are these changes tested? yes Are there any user-facing changes? Yes, a source-breaking signature change to ScalarFunction.evaluate. Implementations of the interface need to add an int rowCount parameter to their evaluate override. Bodies that ignore it remain identical otherwise. Before: public FieldVector evaluate(BufferAllocator allocator, List args) { // ... } After: public FieldVector evaluate(BufferAllocator allocator, List args, int rowCount) { // ... }

Open Graph Description: Which issue does this PR close? Closes #56 . Rationale for this change ScalarFunction.evaluate(BufferAllocator, List<FieldVector>) (introduced in #46) is the contract every Java-implemented...

X Description: Which issue does this PR close? Closes #56 . Rationale for this change ScalarFunction.evaluate(BufferAllocator, List&lt;FieldVector&gt;) (introduced in #46) is the contract every Java-imp...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4

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:43e5d35d-886a-0979-5f59-8bd842802fe7
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE610:1E3B91:465EDA:608FAD:6B046F37
html-safe-noncef4fe4beeb6e485289e47c1d52301d37f5730bb4e57e8996678f862f5ff6b1880
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjEwOjFFM0I5MTo0NjVFREE6NjA4RkFEOjZCMDQ2RjM3IiwidmlzaXRvcl9pZCI6IjY2OTE0Mjc0ODEyMzAyNzQzNTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac89840211f356a66ce8e52965072937115a46ac865d8a967e7f3b79365c8e5f90
hovercard-subject-tagpull_request:3700052446
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/57/files
twitter:imagehttps://avatars.githubusercontent.com/u/1853780?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1853780?s=400&v=4
og:image:altWhich issue does this PR close? Closes #56 . Rationale for this change ScalarFunction.evaluate(BufferAllocator, List<FieldVector>) (introduced in #46) is the contract every Java-implemented...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f
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
releasecfb5f24c6e01d85f70804652a5107e5cac03a161
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/apache/datafusion-java/pull/57/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-java%2Fpull%2F57%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%2F57%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/57/files
Reloadhttps://github.com/apache/datafusion-java/pull/57/files
Reloadhttps://github.com/apache/datafusion-java/pull/57/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
LantaoJinhttps://github.com/LantaoJin
apache:mainhttps://github.com/apache/datafusion-java/tree/main
LantaoJin:fix/udf-nullary-row-counthttps://github.com/LantaoJin/datafusion-java/tree/fix/udf-nullary-row-count
Conversation 1 https://github.com/apache/datafusion-java/pull/57
Commits 1 https://github.com/apache/datafusion-java/pull/57/commits
Checks 0 https://github.com/apache/datafusion-java/pull/57/checks
Files changed https://github.com/apache/datafusion-java/pull/57/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/57/files
fix(udf): pass batch row count to ScalarFunction.evaluate https://github.com/apache/datafusion-java/pull/57/files#top
Show all changes 1 commit https://github.com/apache/datafusion-java/pull/57/files
38f006b fix(udf): pass batch row count to ScalarFunction.evaluate LantaoJin May 18, 2026 https://github.com/apache/datafusion-java/pull/57/commits/38f006ba4864a7f438bf87e98793d388905ad031
Clear filters https://github.com/apache/datafusion-java/pull/57/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/57/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/57/files
ScalarFunction.java https://github.com/apache/datafusion-java/pull/57/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
JniBridge.java https://github.com/apache/datafusion-java/pull/57/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
ScalarUdfTest.java https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
AddOneExample.java https://github.com/apache/datafusion-java/pull/57/files#diff-69812f77b37e69bcc057b6c77b21304b26cf9af77d2692a827e3ca28188e4222
core/src/main/java/org/apache/datafusion/ScalarFunction.javahttps://github.com/apache/datafusion-java/pull/57/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
View file https://github.com/LantaoJin/datafusion-java/blob/38f006ba4864a7f438bf87e98793d388905ad031/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/57/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/57/files#diff-bd89b23d6028824ee8aa496782bd8683b521588c78f471de76829dd3a74aadd3
core/src/main/java/org/apache/datafusion/internal/JniBridge.javahttps://github.com/apache/datafusion-java/pull/57/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
View file https://github.com/LantaoJin/datafusion-java/blob/38f006ba4864a7f438bf87e98793d388905ad031/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/57/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/57/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
https://github.com/apache/datafusion-java/pull/57/files#diff-d8782084eee38e7e495ad13caf3a16d2c19b6eb7a1c290c9423e4d7224a5f2f3
core/src/test/java/org/apache/datafusion/ScalarUdfTest.javahttps://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
View file https://github.com/LantaoJin/datafusion-java/blob/38f006ba4864a7f438bf87e98793d388905ad031/core/src/test/java/org/apache/datafusion/ScalarUdfTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/57/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
https://github.com/apache/datafusion-java/pull/57/files#diff-44b18e4a141ffd448eb762005708913dfd7d6209335637e5fdf6291a63410b26
examples/src/main/java/org/apache/datafusion/examples/AddOneExample.javahttps://github.com/apache/datafusion-java/pull/57/files#diff-69812f77b37e69bcc057b6c77b21304b26cf9af77d2692a827e3ca28188e4222
View file https://github.com/LantaoJin/datafusion-java/blob/38f006ba4864a7f438bf87e98793d388905ad031/examples/src/main/java/org/apache/datafusion/examples/AddOneExample.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/57/{{ revealButtonHref }}
https://github.com/apache/datafusion-java/pull/57/files#diff-69812f77b37e69bcc057b6c77b21304b26cf9af77d2692a827e3ca28188e4222
https://github.com/apache/datafusion-java/pull/57/files#diff-69812f77b37e69bcc057b6c77b21304b26cf9af77d2692a827e3ca28188e4222
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.