Skip to content

[SPARK-26422][R] Support to disable Hive support in SparkR even for Hadoop versions unsupported by Hive fork #23356

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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

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

That is cool. But I think it is good to leave a comment here as there is no test for it.

Copy link
Member

Choose a reason for hiding this comment

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

+1

SparkSession.builder().sparkContext(withHiveExternalCatalog(jsc.sc)).getOrCreate()
} else {
if (enableHiveSupport) {
Expand Down