Skip to content

Commit

Permalink
Revert "[SPARK-35321][SQL][3.1] Don't register Hive permanent functio…
Browse files Browse the repository at this point in the history
…ns when creating Hive client"

This reverts commit 6fbea6a.
  • Loading branch information
dongjoon-hyun committed May 8, 2021
1 parent 6fbea6a commit 53a93fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private[hive] class HiveClientImpl(
if (clientLoader.cachedHive != null) {
clientLoader.cachedHive.asInstanceOf[Hive]
} else {
val c = shim.getHive(conf)
val c = Hive.get(conf)
clientLoader.cachedHive = c
c
}
Expand Down Expand Up @@ -282,7 +282,7 @@ private[hive] class HiveClientImpl(
// Set the thread local metastore client to the client associated with this HiveClientImpl.
Hive.set(client)
// Replace conf in the thread local Hive with current conf
shim.getHive(conf)
Hive.get(conf)
// setCurrentSessionState will use the classLoader associated
// with the HiveConf in `state` to override the context class loader of the current
// thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ private[client] sealed abstract class Shim {

def getMSC(hive: Hive): IMetaStoreClient

def getHive(hiveConf: HiveConf): Hive

protected def findMethod(klass: Class[_], name: String, args: Class[_]*): Method = {
klass.getMethod(name, args: _*)
}
Expand All @@ -201,8 +199,6 @@ private[client] class Shim_v0_12 extends Shim with Logging {
getMSCMethod.invoke(hive).asInstanceOf[IMetaStoreClient]
}

override def getHive(hiveConf: HiveConf): Hive = Hive.get(hiveConf)

private lazy val startMethod =
findStaticMethod(
classOf[SessionState],
Expand Down Expand Up @@ -1293,13 +1289,6 @@ private[client] class Shim_v2_1 extends Shim_v2_0 {
override def alterPartitions(hive: Hive, tableName: String, newParts: JList[Partition]): Unit = {
alterPartitionsMethod.invoke(hive, tableName, newParts, environmentContextInAlterTable)
}

// HIVE-10319 introduced a new HMS thrift API `get_all_functions` which is used by
// `Hive.get` since version 2.1.0, when it loads all Hive permanent functions during
// initialization. This breaks compatibility with HMS server of lower versions.
// To mitigate here we use `Hive.getWithFastCheck` instead which skips loading the permanent
// functions and therefore avoids calling `get_all_functions`.
override def getHive(hiveConf: HiveConf): Hive = Hive.getWithFastCheck(hiveConf, false)
}

private[client] class Shim_v2_2 extends Shim_v2_1
Expand Down

0 comments on commit 53a93fc

Please sign in to comment.