Skip to content

build: exclude unused arrow-dataset native from shaded bundle - #746

Open
sezruby wants to merge 2 commits into
lance-format:mainfrom
sezruby:drop-arrow-dataset-native
Open

build: exclude unused arrow-dataset native from shaded bundle#746
sezruby wants to merge 2 commits into
lance-format:mainfrom
sezruby:drop-arrow-dataset-native

Conversation

@sezruby

@sezruby sezruby commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

Excludes the org.apache.arrow:arrow-dataset artifact (and its bundled arrow_dataset_jni native) from the shaded Spark bundles.

The Arrow Dataset native is currently packaged into every shaded bundle, but it is never used at runtime. Runtime data exchange with the native library goes through the Arrow C Data Interface (org.apache.arrow.c, from the separate arrow-c-data artifact). The arrow-dataset native adds roughly 50-77 MB uncompressed per platform to the published bundle.

Measured on the linux-x86-64 artifact, excluding it saved ~22 MB compressed / ~77 MB uncompressed, with no functional change.

Changes

  • Add <exclude>org.apache.arrow:arrow-dataset</exclude> to the maven-shade-plugin artifactSet excludes in each bundle module.
  • Drop arrow-dataset from the maven-dependency-plugin copy-dependencies includeArtifactIds packaging lists.
  • The arrow-dataset dependency declaration itself is left untouched so it remains available on the test classpath.

Why safe

  • The only reference to org.apache.arrow.dataset anywhere in the codebase is a single test (lance-spark-base_2.12/.../write/LanceBatchWriteTest.java); there are no references in any src/main.
  • src/main uses org.apache.arrow.c (the C Data Interface) for native interop.
  • arrow-dataset and arrow-c-data are separate Maven artifacts with separate native libraries, and arrow-c-data has no dependency on arrow-dataset — so removing the dataset native does not affect the C Data Interface path.
  • The arrow-dataset dependency is retained (not removed), so the existing test continues to compile and run.

@github-actions github-actions Bot added the chore Features related to test, build, style improvements label Aug 6, 2026
The arrow-dataset artifact (and its bundled native library) is copied and
shaded into every connector/bundle jar but is not used at runtime. Drop it
from the dependency-unpack includeArtifactIds across all modules and exclude
org.apache.arrow:arrow-dataset from the shade artifactSet in the bundles, so
the native library is no longer packaged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sezruby
sezruby force-pushed the drop-arrow-dataset-native branch from 332e86f to 6e658ea Compare August 17, 2026 21:43
@sezruby

sezruby commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main — this is now mergeable. The earlier conflict was mechanical: #741 added opentelemetry-api,opentelemetry-context to the same includeArtifactIds lines this PR edits. The rebase preserves those otel entries and only drops arrow-dataset from the dependency-unpack list, plus excludes org.apache.arrow:arrow-dataset from the shade artifactSet in the bundles, so the unused arrow-dataset native library is no longer packaged.

@hamersaw @fangbo would you have a chance to review?

@fangbo fangbo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gate recommendation: request changes.

The size reduction is worthwhile, but the bundle must retain the Arrow Dataset Java API that lance-core’s scanner links against. Keep those class files in the shaded and copied-JAR assemblies while filtering only the platform JNI binaries; that removes the unused payload without breaking Spark read paths.

Comment thread lance-spark-bundle-3.5_2.13/pom.xml Outdated
@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 18, 2026
Excluding the whole org.apache.arrow:arrow-dataset artifact breaks the
Spark read path: lance-core's org.lance.ipc.LanceScanner implements
org.apache.arrow.dataset.scanner.Scanner, so loading it fails with
NoClassDefFoundError once the arrow-dataset classes are gone.

Keep arrow-dataset in copy-dependencies across all modules and, in the
shaded bundles, strip only the unused arrow_dataset_jni native
(~50-77 MB/platform) via a shade filter while retaining the Java API
classes. Runtime native interop goes through the Arrow C Data Interface
(arrow-c-data), not this native.

Add failsafe integration tests on lance-spark-bundle-3.5_2.13 that run
against the shaded jar: assert the native is stripped and the API
classes are kept, that LanceScanner links, plus a real write/read smoke
in a child JVM proving the packaging is functionally correct.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sezruby

sezruby commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@fangbo thanks for the approval — this is still mergeable on latest main.

The functional checks are green: Test Spark 3.4–4.2 / Scala 2.12–2.13, Lint, Install, and Search Docker Test all pass. The red Integration Test checks are stale runs that were cancelled at the step timeout (~45 min) during the test-image docker build on Aug 20 — no test actually ran, so they are not a test or arrow-dataset runtime failure. This change is build-only: it just drops the unused arrow-dataset native from the shaded bundle.

Could you re-run the integration CI and merge once it is green? I don't have permission to re-trigger the run myself.

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

Labels

chore Features related to test, build, style improvements K-changes Latest Gatekeeper recommendation requests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants