Skip to content

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

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

Closed
wants to merge 2 commits into from

Conversation

vanzin
Copy link
Contributor

@vanzin vanzin commented Jul 1, 2016

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
Copy link

SparkQA commented Jul 1, 2016

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
Copy link
Contributor Author

vanzin commented Jul 2, 2016

retest this please

@SparkQA
Copy link

SparkQA commented Jul 2, 2016

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
Copy link
Contributor Author

vanzin commented Jul 2, 2016

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
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
Copy link

SparkQA commented Jul 5, 2016

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
Copy link
Contributor Author

vanzin commented Jul 5, 2016

@cloud-fan @yhuai

@vanzin
Copy link
Contributor Author

vanzin commented Jul 6, 2016

ping

@cloud-fan
Copy link
Contributor

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

@vanzin
Copy link
Contributor Author

vanzin commented Jul 11, 2016

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

@yhuai
Copy link
Contributor

yhuai commented Jul 11, 2016

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

baseClassLoader.loadClass(name)
} catch {
case _: ClassNotFoundException =>
super.loadClass(name, resolve)
Copy link
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
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
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
Copy link
Contributor

yhuai commented Jul 11, 2016

also cc @marmbrus

@vanzin
Copy link
Contributor Author

vanzin commented Jul 11, 2016

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
Copy link
Contributor

yhuai commented Jul 11, 2016

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