Skip to content

HIVE-23980: Shade Guava from hive-exec in Hive 2.3 #1356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 1, 2020

Conversation

viirya
Copy link
Member

@viirya viirya commented Aug 4, 2020

What changes were proposed in this pull request?

This PR proposes to shade Guava from hive-exec in Hive 2.3 branch.

Why are the changes needed?

When trying to upgrade Guava in Spark, found the following error. A Guava method became package-private since Guava version 20. So there is incompatibility with Guava versions > 19.0.

sbt.ForkMain$ForkError: sbt.ForkMain$ForkError: java.lang.IllegalAccessError: tried to access method com.google.common.collect.Iterators.emptyIterator()Lcom/google/common/collect/UnmodifiableIterator; from class org.apache.hadoop.hive.ql.exec.FetchOperator
	at org.apache.hadoop.hive.ql.exec.FetchOperator.<init>(FetchOperator.java:108)
	at org.apache.hadoop.hive.ql.exec.FetchTask.initialize(FetchTask.java:87)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:541)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1317)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1457)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227)

This is a problem for downstream clients. Hive project noticed that problem too in HIVE-22126, however that only targets 4.0.0. It'd be nicer if we can also shade Guava from current Hive versions, e.g. Hive 2.3 line.

Does this PR introduce any user-facing change?

Yes. Guava will be shaded from hive-exec.

How was this patch tested?

Built Hive locally and checked jar content.

@viirya
Copy link
Member Author

viirya commented Aug 4, 2020

cc @sunchao

sunchao
sunchao previously approved these changes Aug 5, 2020
Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

LGTM

@viirya
Copy link
Member Author

viirya commented Aug 6, 2020

@sunchao Do you know how to trigger the tests?

@viirya
Copy link
Member Author

viirya commented Aug 18, 2020

@sunchao Thanks for merging it in branch-2. Does this also need to be merged? Or just close it?

@sunchao
Copy link
Member

sunchao commented Aug 18, 2020

@viirya sorry for the delay - I've cherry-picked the change to branch-2.3 as well so you can just close this.

@viirya
Copy link
Member Author

viirya commented Aug 18, 2020

Ok, thanks @sunchao

@viirya
Copy link
Member Author

viirya commented Sep 24, 2020

Thanks @sunchao for adding jenkins file to branch-2.3. Re-open this.

@sunchao sunchao dismissed their stale review November 17, 2020 18:01

Reverting the previous approval since it has some issue

@viirya
Copy link
Member Author

viirya commented Nov 18, 2020

@sunchao The CI test results look much better now. Seems to me the failed tests are not related to shading guava.

@sunchao
Copy link
Member

sunchao commented Nov 18, 2020

Thanks @viirya . Yes agree they do not look like related. I re-triggered CI just to be sure.

@viirya
Copy link
Member Author

viirya commented Nov 30, 2020

Internally we test this patch and pass all Spark tests. I think it gives us more confidence to have this.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

Thanks @viirya ! the new PR looks almost good to me except one nit.

Also comparing to the original patch, we don't have changes to HiveRelDecorrelator, HiveAggregate and HiveSubQueryRemoveRule. This is unnecessary because we've shaded Guava within hive-exec? (some of the APIs like operandJ do not exist in the Calcite version used by branch-2.3 also).

@viirya
Copy link
Member Author

viirya commented Nov 30, 2020

Thanks @viirya ! the new PR looks almost good to me except one nit.

Also comparing to the original patch, we don't have changes to HiveRelDecorrelator, HiveAggregate and HiveSubQueryRemoveRule. This is unnecessary because we've shaded Guava within hive-exec? (some of the APIs like operandJ do not exist in the Calcite version used by branch-2.3 also).

The change to HiveAggregate just to remove unused parameter groupSets in deriveRowType. Not related to shading guava, so I don't apply it.

The change from operand to operandJ in HiveSubQueryRemoveRule and HiveRelDecorrelator, cannot apply to branch-2.3 because operandJ is not in calcite 1.10.0. The API was add since calcite 1.17.0 (https://github.com/apache/calcite/commit/d59b639d/).

@sunchao
Copy link
Member

sunchao commented Dec 1, 2020

Yes, my main question is whether it is safe to skip the changes on HiveSubQueryRemoveRule and HiveRelDecorrelator. It looks fine to me since we've already shaded calcite within hive/ql.

@viirya
Copy link
Member Author

viirya commented Dec 1, 2020

Yes, my main question is whether it is safe to skip the changes on HiveSubQueryRemoveRule and HiveRelDecorrelator. It looks fine to me since we've already shaded calcite within hive/ql.

Yeah, it should be fine. Calcite uses guava API so shading guava causes no method error if we don't include calcite in shaded jar of hive/ql.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

Thanks again @viirya . This LGTM.

@viirya
Copy link
Member Author

viirya commented Dec 1, 2020

Thank you @sunchao. I think this is ready to go, or we need to wait for a couple days?

@sunchao sunchao merged commit 2b3d4c9 into apache:branch-2.3 Dec 1, 2020
@sunchao
Copy link
Member

sunchao commented Dec 1, 2020

Merged to branch-2.3 and branch-2. Thanks @viirya .

@viirya
Copy link
Member Author

viirya commented Dec 1, 2020

Thank you @sunchao

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

Successfully merging this pull request may close these issues.

3 participants