René's URL Explorer Experiment


Title: feat: typed DataFusionException hierarchy across the JNI boundary by LantaoJin · Pull Request #81 · apache/datafusion-java · GitHub

Open Graph Title: feat: typed DataFusionException hierarchy across the JNI boundary by LantaoJin · Pull Request #81 · apache/datafusion-java

X Title: feat: typed DataFusionException hierarchy across the JNI boundary by LantaoJin · Pull Request #81 · apache/datafusion-java

Description: Which issue does this PR close? Closes #79 . Rationale for this change Every error from the native side currently surfaces as a single java.lang.RuntimeException. try_unwrap_or_throw in native/src/errors.rs calls env.throw_new("java/lang/RuntimeException", message) for every Err(...) it sees, so a DataFusionError::Plan and a DataFusionError::ResourcesExhausted and a DataFusionError::IoError are indistinguishable on the Java side. Callers that want to retry on transient resource pressure but not on a malformed query plan have only the message string to discriminate on — fragile and brittle to upstream wording changes. This PR adds a typed Java exception hierarchy and routes each DataFusionError variant onto the matching subclass at the JNI layer, so callers can catch (PlanException) / catch (ResourcesExhaustedException) selectively without scraping messages. The hierarchy is shallow on purpose. Multiple Rust variants fold into one Java class when they're the same kind of problem from the caller's standpoint (e.g. IoError / ObjectStore / ParquetError / AvroError all surface as IoException). Variants with no clean caller-facing category — Internal, Substrait, Collection, plus any new variant a future DataFusion bump introduces — fall through to the parent DataFusionException. The mapping is the public contract; the underlying variant set is not. ArrowError gets per-variant treatment because it's a 21-variant grab bag that mixes IO with execution-time failures. Routing the whole ArrowError arm to a single class would put e.g. SELECT 1/0 (ArrowError::DivideByZero) under IoException, which is wrong from a caller's standpoint. A small classify_arrow helper splits the variants: IoError / IpcError go to IoException, SchemaError / ParseError go to PlanException, and the arithmetic / cast / compute variants go to ExecutionException. Sequenced before upstream #55 ("propagate Java stack traces from JVM upcalls into DataFusionError"), which is complementary: every subclass ships a (String, Throwable) constructor as the seam #55 plugs into for setting the original Java throwable as cause. What changes are included in this PR? Java side: new public class DataFusionException (extends RuntimeException) plus 6 subclasses — PlanException, ExecutionException, ResourcesExhaustedException, IoException, NotImplementedException, ConfigurationException. Each ships (String) and (String, Throwable) constructors. Native side: errors.rs downcasts the boxed error to DataFusionError, walks the cause chain via upstream's DataFusionError::find_root(), and routes the root variant through a classify() helper to the right Java class. The thrown message preserves the outer error's full chain so wrapping context isn't lost; only the class is picked from the inner variant. JniResult is unchanged (Box) — every ? site keeps working as-is. Rust panics surface as the parent class with a panic: prefix. find_root() matters because DataFusion can wrap a ResourcesExhausted / Plan / etc. inside an ArrowError::ExternalError(...) or a Context(...) chain (upstream documents this exact shape). Without find_root, those would land on the outer arm and be misclassified. ArrowError gets a dedicated classify_arrow helper because the enum mixes IO (IoError, IpcError) with execution-time variants (DivideByZero, ArithmeticOverflow, ComputeError, CastError, InvalidArgumentError, MemoryError, External, …) and schema-shaped variants (SchemaError, ParseError). Each lands on the matching Java class instead of all collapsing to IoException. Variants without a clean category (Internal, Substrait, Collection, future variants) fall through to the parent class. native/Cargo.toml adds rlib alongside cdylib to enable Rust unit tests that pin the find_root routing behavior on synthetic wrapper chains; the cdylib artifact the JVM loads is unchanged. Are these changes tested? Yes. 10 new Java tests + 7 new Rust unit tests. Are there any user-facing changes? No

Open Graph Description: Which issue does this PR close? Closes #79 . Rationale for this change Every error from the native side currently surfaces as a single java.lang.RuntimeException. try_unwrap_or_throw in native/sr...

X Description: Which issue does this PR close? Closes #79 . Rationale for this change Every error from the native side currently surfaces as a single java.lang.RuntimeException. try_unwrap_or_throw in native/sr...

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

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:767a2177-c50c-22e6-67b2-3b6efecdab58
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA65C:3ABDFB:2EF72A:40B6BD:6B046A94
html-safe-nonce5caf338b019ab48a50c1ecb30cb8a86a6ffa1619358eb6fc01488e97fa770651
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjVDOjNBQkRGQjoyRUY3MkE6NDBCNkJEOjZCMDQ2QTk0IiwidmlzaXRvcl9pZCI6IjE2NjQ2OTY4OTg3MjE5NjY3NDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb3658228eafc14f52490f94ff64454abf512d702f6608e6e308b83e7b5f15f84
hovercard-subject-tagpull_request:3721599508
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/81/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 #79 . Rationale for this change Every error from the native side currently surfaces as a single java.lang.RuntimeException. try_unwrap_or_throw in native/sr...
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/81/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-java%2Fpull%2F81%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%2F81%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/81/files
Reloadhttps://github.com/apache/datafusion-java/pull/81/files
Reloadhttps://github.com/apache/datafusion-java/pull/81/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
LantaoJin:feat/typed-exceptionshttps://github.com/LantaoJin/datafusion-java/tree/feat/typed-exceptions
Conversation 0 https://github.com/apache/datafusion-java/pull/81
Commits 1 https://github.com/apache/datafusion-java/pull/81/commits
Checks 1 https://github.com/apache/datafusion-java/pull/81/checks
Files changed https://github.com/apache/datafusion-java/pull/81/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/81/files
feat: typed DataFusionException hierarchy across the JNI boundary https://github.com/apache/datafusion-java/pull/81/files#top
Show all changes 1 commit https://github.com/apache/datafusion-java/pull/81/files
994f194 feat: typed DataFusionException hierarchy across the JNI boundary LantaoJin May 21, 2026 https://github.com/apache/datafusion-java/pull/81/commits/994f1942acc3aef786f8b7a22bbed7d1c21c6581
Clear filters https://github.com/apache/datafusion-java/pull/81/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/81/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/81/files
ConfigurationException.java https://github.com/apache/datafusion-java/pull/81/files#diff-14dc03be938dc6c10e5dbd53427f5190a7c2b9671708cfbbd2a59848ed947032
DataFusionException.java https://github.com/apache/datafusion-java/pull/81/files#diff-fe65b51a7c81d2544cdf8fac0e29ea3f06c3c36ceb73a3237125958aa8227e6f
ExecutionException.java https://github.com/apache/datafusion-java/pull/81/files#diff-b31b4decd6b3d43e7558058ab4b1421460eae7248faf03161a66c58a82eb3c8e
IoException.java https://github.com/apache/datafusion-java/pull/81/files#diff-d656871a044e3a4dfcc7d01d1b78dd6b4fcaf9fc0c2e7948a021a217059ff205
NotImplementedException.java https://github.com/apache/datafusion-java/pull/81/files#diff-3c318ccc51843bd262743e2da1dc0bafefeee968a38baaee59f1e391036ee44a
PlanException.java https://github.com/apache/datafusion-java/pull/81/files#diff-975e9fe6cef5f0b12f6756e4dcef904be25dff0e42f635fd160cbc78be28eedd
ResourcesExhaustedException.java https://github.com/apache/datafusion-java/pull/81/files#diff-22ae889c178c2e062d7a0a0a3be0c1907695012ea55eeef8c0467e2e7644887e
DataFusionExceptionTest.java https://github.com/apache/datafusion-java/pull/81/files#diff-df9ea75e1b2d8ded14b73c7e63d20269cc8a5dd7db64b4e6545a00596aa3c5e8
SessionContextTypedErrorTest.java https://github.com/apache/datafusion-java/pull/81/files#diff-e7617ac62c5401c69abbf171d3e24616cdde1c0e1a4942b61b11df60230f6216
Cargo.toml https://github.com/apache/datafusion-java/pull/81/files#diff-a1571d177cbc44d96f49c8f29b6340febcee141a0e26833931bcd78c5441fb55
errors.rs https://github.com/apache/datafusion-java/pull/81/files#diff-69e4ba2c475e7c1718d299d82907ff348fbca3827d6a3c175cc01d0750264511
core/src/main/java/org/apache/datafusion/ConfigurationException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-14dc03be938dc6c10e5dbd53427f5190a7c2b9671708cfbbd2a59848ed947032
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/ConfigurationException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/DataFusionException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-fe65b51a7c81d2544cdf8fac0e29ea3f06c3c36ceb73a3237125958aa8227e6f
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/DataFusionException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/ExecutionException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-b31b4decd6b3d43e7558058ab4b1421460eae7248faf03161a66c58a82eb3c8e
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/ExecutionException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/IoException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-d656871a044e3a4dfcc7d01d1b78dd6b4fcaf9fc0c2e7948a021a217059ff205
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/IoException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/NotImplementedException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-3c318ccc51843bd262743e2da1dc0bafefeee968a38baaee59f1e391036ee44a
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/NotImplementedException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/PlanException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-975e9fe6cef5f0b12f6756e4dcef904be25dff0e42f635fd160cbc78be28eedd
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/PlanException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/main/java/org/apache/datafusion/ResourcesExhaustedException.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-22ae889c178c2e062d7a0a0a3be0c1907695012ea55eeef8c0467e2e7644887e
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/main/java/org/apache/datafusion/ResourcesExhaustedException.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
core/src/test/java/org/apache/datafusion/DataFusionExceptionTest.javahttps://github.com/apache/datafusion-java/pull/81/files#diff-df9ea75e1b2d8ded14b73c7e63d20269cc8a5dd7db64b4e6545a00596aa3c5e8
View file https://github.com/LantaoJin/datafusion-java/blob/994f1942acc3aef786f8b7a22bbed7d1c21c6581/core/src/test/java/org/apache/datafusion/DataFusionExceptionTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/apache/datafusion-java/pull/81/{{ revealButtonHref }}
Please reload this pagehttps://github.com/apache/datafusion-java/pull/81/files
Please reload this pagehttps://github.com/apache/datafusion-java/pull/81/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.