Skip to content

[GLUTEN-12394][CORE] Consolidate JniLibLoader.load() as a thin delegate of loadAndCreateLink()#12520

Merged
jackylee-ch merged 2 commits into
apache:mainfrom
PerumalsamyR:consolidate-jnilibloader-load
Jul 16, 2026
Merged

[GLUTEN-12394][CORE] Consolidate JniLibLoader.load() as a thin delegate of loadAndCreateLink()#12520
jackylee-ch merged 2 commits into
apache:mainfrom
PerumalsamyR:consolidate-jnilibloader-load

Conversation

@PerumalsamyR

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

After #12393, JniLibLoader.load(libPath) and JniLibLoader.loadAndCreateLink(libPath, null) are behaviorally identical: same already-loaded dedup check, same extraction to the work dir, same load call, same logging, same exception wrapping. The only difference is the linkName argument, and loadWithLink already skips the symlink branch when linkName == null.

This PR removes the duplication by making load() a one-line delegate of loadAndCreateLink(libPath, null), so there is a single copy of the loading sequence to evolve, and updates the Javadoc of both methods accordingly.

No behavior change.

Fixes #12394

How was this patch tested?

Existing JniLibLoaderTest passes (mvn test -pl gluten-core -Pspark-3.5 -Dtest=JniLibLoaderTest).

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code

…te of loadAndCreateLink()

After apache#12393, load(libPath) and loadAndCreateLink(libPath, null) are
behaviorally identical: same dedup check, same extraction to workDir,
same load call, same logging. Keep one copy of that sequence by making
load() delegate to loadAndCreateLink() with a null link name.

Fixes apache#12394
Copilot AI review requested due to automatic review settings July 15, 2026 08:07
@github-actions github-actions Bot added the CORE works for Gluten Core label Jul 15, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces duplication in JniLibLoader by making load(String libPath) delegate directly to loadAndCreateLink(libPath, null), consolidating the native library extraction/load sequence in one place and aligning the Javadocs with the new structure.

Changes:

  • Refactor JniLibLoader.load() into a one-line delegate to loadAndCreateLink(..., null).
  • Update Javadoc for load() and loadAndCreateLink() to reflect the shared contract and clarify null behavior for linkName.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gluten-core/src/main/java/org/apache/gluten/jni/JniLibLoader.java
@jackylee-ch

Copy link
Copy Markdown
Contributor

@PerumalsamyR Thanks for your first PR. Basically looks good to me, Thanks.

I left a comment, PTAL.

Copilot AI review requested due to automatic review settings July 15, 2026 08:26
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jackylee-ch jackylee-ch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@jackylee-ch jackylee-ch merged commit 49ef3fd into apache:main Jul 16, 2026
94 of 95 checks passed
@jackylee-ch

Copy link
Copy Markdown
Contributor

@PerumalsamyR Thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate JniLibLoader.load() as a thin delegate of loadAndCreateLink()

3 participants