Skip to content

[SPARK-16349][sql] Fall back to isolated class loader when classes not found.#14020

Closed
vanzin wants to merge 2 commits into
apache:masterfrom
vanzin:SPARK-16349
Closed

[SPARK-16349][sql] Fall back to isolated class loader when classes not found.#14020
vanzin wants to merge 2 commits into
apache:masterfrom
vanzin:SPARK-16349

Conversation

@vanzin

@vanzin vanzin commented Jul 1, 2016

Copy link
Copy Markdown
Contributor

Some Hadoop classes needed by the Hive metastore client jars are not present
in Spark's packaging (for example, "org/apache/hadoop/mapred/MRVersion"). So
if the parent class loader fails to find a class, try to load it from the
isolated class loader, in case it's available there.

Tested by setting spark.sql.hive.metastore.jars to local paths with Hive/Hadoop
libraries and verifying that Spark can talk to the metastore.

…t found.

Some Hadoop classes needed by the Hive metastore client jars are not present
in Spark's packaging (for example, "org/apache/hadoop/mapred/MRVersion"). So
if the parent class loader fails to find a class, try to load it from the
isolated class loader, in case it's available there.

I also took the opportunity to remove the HIVE_EXECUTION_VERSION constant since
it's not used anywhere.

Tested by setting spark.sql.hive.metastore.jars to local paths with Hive/Hadoop
libraries and verifying that Spark can talk to the metastore.
@SparkQA

SparkQA commented Jul 1, 2016

Copy link
Copy Markdown

Test build #61640 has finished for PR 14020 at commit 693939c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin

vanzin commented Jul 2, 2016

Copy link
Copy Markdown
Contributor Author

retest this please

@SparkQA

SparkQA commented Jul 2, 2016

Copy link
Copy Markdown

Test build #61645 has finished for PR 14020 at commit 693939c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin

vanzin commented Jul 2, 2016

Copy link
Copy Markdown
Contributor Author

Might be a legitimate test failure, will look later.

@@ -264,7 +270,7 @@ private[hive] class IsolatedClientLoader(
throw new ClassNotFoundException(
s"$cnf when creating Hive client using classpath: ${execJars.mkString(", ")}\n" +
"Please make sure that jars for your version of hive and hadoop are included in the " +

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.

Just a nitpick...should 'hive' be Hive as the line above + Hadoop?

@SparkQA

SparkQA commented Jul 5, 2016

Copy link
Copy Markdown

Test build #61768 has finished for PR 14020 at commit 68f5a23.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin

vanzin commented Jul 5, 2016

Copy link
Copy Markdown
Contributor Author

@cloud-fan @yhuai

@vanzin

vanzin commented Jul 6, 2016

Copy link
Copy Markdown
Contributor Author

ping

@cloud-fan

Copy link
Copy Markdown
Contributor

I'm not familiar with this part, cc @liancheng to take a look

@vanzin

vanzin commented Jul 11, 2016

Copy link
Copy Markdown
Contributor Author

I'll leave this open until EOD then push the change.

@yhuai

yhuai commented Jul 11, 2016

Copy link
Copy Markdown
Contributor

Will putting that jar in Spark's classpath work? Seems so?

baseClassLoader.loadClass(name)
} catch {
case _: ClassNotFoundException =>
super.loadClass(name, resolve)

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.

Which classloader does this call delegate to?

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.

This will delegate to the loader using the user-provided jars from the metastore jars configuration.

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.

ah, ok. Sounds good.

@yhuai

yhuai commented Jul 11, 2016

Copy link
Copy Markdown
Contributor

also cc @marmbrus

@vanzin

vanzin commented Jul 11, 2016

Copy link
Copy Markdown
Contributor Author

Will putting that jar in Spark's classpath work? Seems so?

Yes but the whole point of the configuration is to not pollute Spark's class loader.

@yhuai

yhuai commented Jul 11, 2016

Copy link
Copy Markdown
Contributor

lgtm. Merging to master

@asfgit asfgit closed this in b4fbe14 Jul 11, 2016
zzcclp added a commit to zzcclp/spark that referenced this pull request Jul 12, 2016
@vanzin vanzin deleted the SPARK-16349 branch July 12, 2016 19:54
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