Skip to content

fix(build): bundle hive-exec in the utilities bundle under the shade-hive profile - #19800

Open
rangareddy wants to merge 1 commit into
apache:masterfrom
rangareddy:fix-16374-utilities-bundle-hive-exec
Open

fix(build): bundle hive-exec in the utilities bundle under the shade-hive profile#19800
rangareddy wants to merge 1 commit into
apache:masterfrom
rangareddy:fix-16374-utilities-bundle-hive-exec

Conversation

@rangareddy

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Closes #16374 (JIRA: HUDI-7321).

Building the utilities bundle with -Putilities-bundle-shade-hive produces a jar that fails at runtime with:

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat

Root cause. hudi-hadoop-mr is in the bundle's shade whitelist
(packaging/hudi-utilities-bundle/pom.xml:106), and HoodieParquetInputFormatBase:49 extends MapredParquetInputFormat, which lives in hive-exec. The bundle declared five hive artifacts -
hive-service, hive-service-rpc, hive-jdbc, hive-metastore, hive-common - and whitelisted the same
five. hive-exec was in neither list, and its managed scope is provided, which never propagates
transitively, so nothing could pull it in. The bundle therefore shipped subclasses whose superclass was
absent.

The reporter's workaround, "adding hive-exec resolved it", is the correct diagnosis.

Summary and Changelog

One file, packaging/hudi-utilities-bundle/pom.xml, +27:

  • Declares hive-exec at ${hive.exec.classifier} with scope=${utilities.bundle.hive.scope}, matching the
    hive artifacts alongside it. The core classifier is what the rest of the build uses: it carries Hive's own
    classes without Hive's shaded copies of third-party libraries, so it does not drag protobuf, guava and
    friends into the bundle (10.3 MB rather than 44.2 MB).
  • Adds <include>org.apache.hive:hive-exec</include> to the shade whitelist.

Scope defaults to provided (root pom), so the default bundle is unchanged and hive-exec is packaged
only under -Putilities-bundle-shade-hive.

The new dependency deliberately carries no local <exclusions>. The root pom's dependencyManagement
entry for hive-exec already excludes javax.mail, the jetty aggregate, pentaho, log4j 1.x, log4j2,
slf4j-log4j12 and hbase, several of which the enforcer bans outright. Declaring exclusions locally
replaces that managed set rather than adding to it, so an innocuous-looking local exclusion block would
quietly let the banned artifacts back in.

Verification

Built the bundle both ways, then loaded the class from the jar with a Hadoop-only classpath - which is
what a cluster running this bundle provides, and which is why the bundle has to carry hive itself:

MapredParquetInputFormat HoodieParquetInputFormat
before, -Putilities-bundle-shade-hive ClassNotFoundException NoClassDefFoundError: org/apache/hadoop/hive/ql/io/parquet/MapredParquetInputFormat
after, -Putilities-bundle-shade-hive resolves resolves

The "before" row is the reported failure, reproduced.

Jar contents and sizes:

baseline (master), -Putilities-bundle-shade-hive   101.4 MB   MapredParquetInputFormat: 0 entries
fixed,             -Putilities-bundle-shade-hive   111.6 MB   MapredParquetInputFormat: 1 entry
fixed,             default build (no profile)       90.4 MB   MapredParquetInputFormat: 0 entries

MapredParquetInputFormat lands under its original name; nothing is relocated under org.apache.hudi.
(0 entries under org/apache/hudi/org/apache/hadoop/hive/ql/), so Hive's own loading of
HoodieParquetInputFormat is unaffected.

Full build with checkstyle, RAT and enforcer enabled passes (BannedDependencies passed), and the shaded
jar contains nothing under org/apache/log4j, org/apache/logging/log4j, org/slf4j/impl,
org/apache/hadoop/hbase, org/pentaho or javax/mail.

Impact

Only the opt-in -Putilities-bundle-shade-hive build changes: that bundle grows by ~10 MB and becomes
self-contained for the Hive input formats it already ships. The default hudi-utilities-bundle is byte-for-byte
unaffected, since provided scope keeps hive-exec out and the whitelist entry has nothing to match.

Because org.apache.hadoop.hive.ql. is not in this bundle's relocation list, the profile's bundle now carries
Hive ql classes under their original names. That is the existing semantics of this profile - it exists to put
Hive inside the bundle - but it does mean the shaded jar can shadow a Hive install on a shared classpath.
Relocating hive.ql instead was considered and rejected: it would rewrite HoodieParquetInputFormatBase's
superclass and break Hive's own loading of HoodieParquetInputFormat.

Risk Level

low - opt-in profile only, default bundle unchanged, verified against the enforcer.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable
  • CI passes on my PR
…hive profile

Closes apache#16374 (HUDI-7321).

Building the utilities bundle with -Putilities-bundle-shade-hive produced a jar that fails
at runtime with:

  java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat

hudi-hadoop-mr is in the bundle's shade whitelist, and its HoodieParquetInputFormatBase
extends MapredParquetInputFormat, which lives in hive-exec. The bundle declared five hive
artifacts - hive-service, hive-service-rpc, hive-jdbc, hive-metastore, hive-common - and
whitelisted the same five. hive-exec was in neither list, and its managed scope is provided,
which never propagates transitively, so nothing could pull it in. The bundle therefore
shipped subclasses whose superclass was absent.

Declares hive-exec at ${hive.exec.classifier} (core) with scope ${utilities.bundle.hive.scope},
matching the hive artifacts alongside it, and adds it to the shade whitelist. The core
classifier carries Hive's own classes without Hive's shaded copies of third-party libraries.
Scope defaults to provided, so the default bundle is unchanged and hive-exec is packaged only
under -Putilities-bundle-shade-hive.

No local <exclusions> on the new dependency, deliberately: the root pom's dependencyManagement
entry for hive-exec already excludes javax.mail, the jetty aggregate, pentaho, log4j 1.x,
log4j2, slf4j-log4j12 and hbase, several of which the enforcer bans. Declaring exclusions
locally replaces that managed set rather than adding to it.

Verified by building the bundle both ways and loading the class from the jar with a
Hadoop-only classpath, which is what a cluster running this bundle provides:

  before, -Putilities-bundle-shade-hive
    MapredParquetInputFormat  -> ClassNotFoundException
    HoodieParquetInputFormat  -> NoClassDefFoundError: org/apache/hadoop/hive/ql/io/parquet/
                                 MapredParquetInputFormat
  after, -Putilities-bundle-shade-hive
    MapredParquetInputFormat  -> resolves
    HoodieParquetInputFormat  -> resolves

Jar contents: MapredParquetInputFormat goes from 0 to 1 entry under the profile and stays at 0
without it. Bundle grows 101.4 MB -> 111.6 MB under the profile; the default bundle is 90.4 MB
with zero hive-exec classes. Full build with checkstyle, RAT and enforcer enabled passes, and
the shaded jar contains nothing under org/apache/log4j, org/apache/logging/log4j,
org/slf4j/impl, org/apache/hadoop/hbase, org/pentaho or javax/mail.

Not changed: hudi-utilities-slim-bundle. It ships only hudi-utilities among the hudi
artifacts, not hudi-hadoop-mr, so it has no dangling superclass to fix, and bundling 10 MB of
hive-exec would defeat the point of a slim bundle. Its utilities-bundle-shade-hive profile is
however dead code - it sets utilities.bundle.hive.scope, which that pom never references, and
its hive relocations are inert because no hive artifact is ever packaged. Worth a follow-up.
@rangareddy
rangareddy marked this pull request as ready for review August 31, 2026 09:54
@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build
@github-actions github-actions Bot added the size:S PR with lines of changes in (10, 100] label Aug 31, 2026
@codecov-commenter

codecov-commenter commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.88%. Comparing base (6db0dde) to head (ecc2eab).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19800      +/-   ##
============================================
- Coverage     78.26%   75.88%   -2.39%     
+ Complexity    33806    32864     -942     
============================================
  Files          2541     2541              
  Lines        141586   141676      +90     
  Branches      17142    17253     +111     
============================================
- Hits         110815   107504    -3311     
- Misses        23052    26477    +3425     
+ Partials       7719     7695      -24     
Components Coverage Δ
hudi-common 83.06% <ø> (-0.55%) ⬇️
hudi-client 81.69% <ø> (-1.46%) ⬇️
hudi-flink 85.65% <ø> (-0.01%) ⬇️
hudi-spark-datasource 72.04% <ø> (-1.14%) ⬇️
hudi-utilities 55.10% <ø> (-19.42%) ⬇️
hudi-cli 15.06% <ø> (ø)
hudi-hadoop 69.23% <ø> (-1.36%) ⬇️
hudi-sync 75.54% <ø> (-0.03%) ⬇️
hudi-io 79.43% <ø> (-0.57%) ⬇️
hudi-timeline-service 77.57% <ø> (-5.88%) ⬇️
hudi-cloud 65.81% <ø> (ø)
hudi-kafka-connect 53.20% <ø> (ø)
Flag Coverage Δ
common-and-other-modules 51.45% <ø> (+0.02%) ⬆️
flink-integration-tests 48.82% <ø> (-0.04%) ⬇️
hadoop-mr-java-client 44.09% <ø> (-0.03%) ⬇️
integration-tests 13.51% <ø> (-0.01%) ⬇️
spark-client-hadoop-common 50.51% <ø> (+0.10%) ⬆️
spark-java-tests 48.63% <ø> (-3.57%) ⬇️
spark-scala-tests 46.86% <ø> (+0.02%) ⬆️
utilities 0.00% <ø> (-36.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 269 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hudi-agent hudi-agent 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.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for the contribution! This PR adds hive-exec (core classifier) to the utilities bundle's dependency list and shade whitelist so the bundled hudi-hadoop-mr input formats ship with their MapredParquetInputFormat superclass under the -Putilities-bundle-shade-hive profile. The change mirrors how every other module and bundle declares hive-exec (same classifier and scope property), the provided default keeps the standard bundle unchanged, and relying on the root pom's managed exclusions rather than local ones is the correct call. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.

cc @yihua

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

Labels

size:S PR with lines of changes in (10, 100]

4 participants