asfgit closed pull request #23356: [SPARK-26422][R] Support to disable Hive
support in SparkR even for Hadoop versions unsupported by Hive fork
URL: https://github.com/apache/spark/pull/23356
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala
b/sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala
index becb05cf72aba..e98cab8b56d13 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala
@@ -49,9 +49,17 @@ private[sql] object SQLUtils extends Logging {
sparkConfigMap: JMap[Object, Object],
enableHiveSupport: Boolean): SparkSession = {
val spark =
- if (SparkSession.hiveClassesArePresent && enableHiveSupport &&
+ if (enableHiveSupport &&
jsc.sc.conf.get(CATALOG_IMPLEMENTATION.key,
"hive").toLowerCase(Locale.ROOT) ==
- "hive") {
+ "hive" &&
+ // Note that the order of conditions here are on purpose.
+ // `SparkSession.hiveClassesArePresent` checks if Hive's `HiveConf`
is loadable or not;
+ // however, `HiveConf` itself has some static logic to check if
Hadoop version is
+ // supported or not, which throws an `IllegalArgumentException` if
unsupported.
+ // If this is checked first, there's no way to disable Hive support
in the case above.
+ // So, we intentionally check if Hive classes are loadable or not
only when
+ // Hive support is explicitly enabled by short-circuiting. See also
SPARK-26422.
+ SparkSession.hiveClassesArePresent) {
SparkSession.builder().sparkContext(withHiveExternalCatalog(jsc.sc)).getOrCreate()
} else {
if (enableHiveSupport) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]