Skip to content

SPARK-1314: Use SPARK_HIVE to determine if we include Hive in packaging - #237

Closed
aarondav wants to merge 4 commits into
apache:masterfrom
aarondav:master
Closed

SPARK-1314: Use SPARK_HIVE to determine if we include Hive in packaging#237
aarondav wants to merge 4 commits into
apache:masterfrom
aarondav:master

Conversation

@aarondav

Copy link
Copy Markdown
Contributor

Previously, we based our decision regarding including datanucleus jars based on the existence of a spark-hive-assembly jar, which was incidentally built whenever "sbt assembly" is run. This means that a typical and previously supported pathway would start using hive jars.

This patch has the following features/bug fixes:

  • Use of SPARK_HIVE (default false) to determine if we should include Hive in the assembly jar.
  • Analagous feature in Maven with -Phive (previously, there was no support for adding Hive to any of our jars produced by Maven)
  • assemble-deps fixed since we no longer use a different ASSEMBLY_DIR
  • avoid adding log message in compute-classpath.sh to the classpath :)

Still TODO before mergeable:

  • We need to download the datanucleus jars outside of sbt. Perhaps we can have spark-class download them if SPARK_HIVE is set similar to how sbt downloads itself.
  • Spark SQL documentation updates.

Comment thread pom.xml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hive requires derby in the compile scope via a transitive dependency on hive-metastore, and this setting was overriding that. This does not seem to be pulled in from non-hive assembly jars.

@aarondav

Copy link
Copy Markdown
Contributor Author

@marmbrus @pwendell Please take a look, my build-foo is not strong.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/13466/

Comment thread sql/hive/pom.xml Outdated

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.

should the version number be declared in the parent pom and then the dependency added here? Btw one reason why this might be getting messed up is that we intentionally exclude jackson from a bunch of dependencies. So maybe we are actually excluding it when pulling in Avro.

@pwendell

Copy link
Copy Markdown
Contributor

Thanks Aaron - looks good. From what I can tell you've just copied the model used for ganglia and previously YARN.

The only ugliness is that SPARK_HIVE is now needed at runtime to determine whether to include the Datanucleus jars. And this is conflated with the setting at compile-time which has a different meaning. This is a bit unfortunate - is there no better way here? We could have the assembly name be different if Hive is included, but that's sort of ugly too. We could also just include the datanucleus jars on the classpath if they are present. The only downside is that if someone did a build for hive, then did a normal build, they would still include it. But in that case maybe it's just okay to include them - it's not a widely used library.

@pwendell

Copy link
Copy Markdown
Contributor

We could also include them and log a message like "Including Datanucleus jars needed for Hive" and then if someone happens to not want them (they previously did a Hive assembly) then they'd know what was going on.

@marmbrus

Copy link
Copy Markdown
Contributor

One other option is to have a file flag like we do for RELEASE that is used in addition to the env var.

@aarondav

Copy link
Copy Markdown
Contributor Author

One issue with the "including datanucleus if it exists" approach is that we need to at some point download datanucleus for the user. Right now sbt does that via lib_managed, but there's no pathway to getting the datanucleus jars from maven, so we may need an external script that's run in spark-class. This would require the same type of runtime option as we have now, or a file flag.

@pwendell

Copy link
Copy Markdown
Contributor

Ah sorry I didn't read your description. Indeed, this wouldn't work for maven. Having a file flag seems potentially complicated if someone does multiple builds some with and some without hive.

Comment thread project/SparkBuild.scala Outdated

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.

Any reason we still need a separate hive assembly target ? If hive will be a part of the normal assembly jar (based on maybeHive) then these rules should be moved into assemblyProjSettings ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, removed!

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@aarondav

aarondav commented Apr 5, 2014

Copy link
Copy Markdown
Contributor Author

Alright, I changed up the solution by having Maven also download the datanucleus jars into lib_managed/jars/ (unlike SBT, Maven will only download these jars, and only when building Spark with Hive). Now we will include datanucleus on the classpath if they're present in lib_managed and the Spark assembly includes Hive (by looking up with the "jar" command).

@AmplabJenkins

Copy link
Copy Markdown

Build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Build started.

@AmplabJenkins

Copy link
Copy Markdown

Build finished.

@AmplabJenkins

Copy link
Copy Markdown

Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/13809/

aarondav added 3 commits April 5, 2014 17:30
Previously, we based our decision regarding including datanucleus jars
based on the existence of a spark-hive-assembly jar, which was incididentally
built whenever "sbt assembly" is run. This means that a typical and
previously supported pathway would start using hive jars.

This patch has the following features/bug fixes:

- Use of SPARK_HIVE (default false) to determine if we should include Hive
  in the assembly jar.
- Analagous feature in Maven with -Phive.
- assemble-deps fixed since we no longer use a different ASSEMBLY_DIR

Still TODO before mergeable:
- We need to download the datanucleus jars outside of sbt. Perhaps we can have
  spark-class download them if SPARK_HIVE is set similar to how sbt downloads
  itself.
- Spark SQL documentation updates.
@aarondav

aarondav commented Apr 6, 2014

Copy link
Copy Markdown
Contributor Author

Also fixes SPARK-1309.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/13811/

Comment thread bin/compute-classpath.sh

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.

Are you sure this is valid? I seem to remember the maven and sbt builds name the assembly jar differently (?) If this is the right way to do it would it make sense to make the check in the if statement consistent with this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

maven doesn't build assemble-deps, as far as I know

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.

That is correct. Maven doesn't build assemble-deps right now, so its fine to keep this sbt specific. It raises the question if/how we should add assemble-deps to the maven build, but thats a whole different issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It may actually be not too hard to add assemble-deps to Maven if we have a build that inherits from "assembly" and simply excludes Spark's groupId. Though, packaging the Maven assembly is roughly 5x faster than SBT.

Comment thread bin/compute-classpath.sh Outdated

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.

also an extra space after tvf unless it's intentional?

@pwendell

pwendell commented Apr 6, 2014

Copy link
Copy Markdown
Contributor

I tested this in maven and sbt builds. Seemed to work for me!

@aarondav aarondav changed the title [WIP] SPARK-1314: Use SPARK_HIVE to determine if we include Hive in packaging SPARK-1314: Use SPARK_HIVE to determine if we include Hive in packaging Apr 6, 2014
@aarondav

aarondav commented Apr 6, 2014

Copy link
Copy Markdown
Contributor Author

Addressed comments and removed WIP.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/13821/

@pwendell

pwendell commented Apr 6, 2014

Copy link
Copy Markdown
Contributor

LGTM

@pwendell

pwendell commented Apr 7, 2014

Copy link
Copy Markdown
Contributor

Thanks a lot for looking at this Aaron, I've merged it.

@asfgit asfgit closed this in 4106558 Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants