Skip to content

Commit

Permalink
reuse getCommandProcessor in hiveshim
Browse files Browse the repository at this point in the history
  • Loading branch information
scwf committed Oct 28, 2014
1 parent 52674a4 commit c359822
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import org.apache.hadoop.hive.shims.ShimLoader
import org.apache.thrift.transport.TSocket

import org.apache.spark.Logging
import org.apache.spark.sql.hive.thriftserver.HiveShim
import org.apache.spark.sql.hive.HiveShim
import org.apache.spark.sql.hive.thriftserver.HiveThriftServerShim

private[hive] object SparkSQLCLIDriver {
private var prompt = "spark-sql"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private[hive] class SparkSQLCLIService(hiveContext: HiveContext)
try {
HiveAuthFactory.loginFromKeytab(hiveConf)
sparkServiceUGI = ShimLoader.getHadoopShims.getUGIForConf(hiveConf)
HiveShim.setServerUserName(sparkServiceUGI, this)
HiveThriftServerShim.setServerUserName(sparkServiceUGI, this)
} catch {
case e @ (_: IOException | _: LoginException) =>
throw new ServiceException("Unable to login to kerberos with given principal/keytab", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ import org.apache.spark.sql.hive.thriftserver.ReflectionUtils._
/**
* A compatibility layer for interacting with Hive version 0.12.0.
*/
private[thriftserver] object HiveShim {
private[thriftserver] object HiveThriftServerShim {
val version = "0.12.0"

def setServerUserName(sparkServiceUGI: UserGroupInformation, sparkCliService:SparkSQLCLIService) = {
val serverUserName = ShimLoader.getHadoopShims.getShortUserName(sparkServiceUGI)
setSuperField(sparkCliService, "serverUserName", serverUserName)
}

def getCommandProcessor(cmd: Array[String], conf: HiveConf) = {
CommandProcessorFactory.get(cmd(0), conf)
}
}

private[hive] class SparkSQLDriver(val _context: HiveContext = SparkSQLEnv.hiveContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,12 @@ import org.apache.spark.sql.hive.thriftserver.ReflectionUtils._
/**
* A compatibility layer for interacting with Hive version 0.12.0.
*/
private[thriftserver] object HiveShim {
private[thriftserver] object HiveThriftServerShim {
val version = "0.13.1"

def setServerUserName(sparkServiceUGI: UserGroupInformation, sparkCliService:SparkSQLCLIService) = {
setSuperField(sparkCliService, "serviceUGI", sparkServiceUGI)
}

def getCommandProcessor(cmd: Array[String], conf: HiveConf) = {
CommandProcessorFactory.get(cmd, conf)
}
}

private[hive] class SparkSQLDriver(val _context: HiveContext = SparkSQLEnv.hiveContext)
Expand Down

0 comments on commit c359822

Please sign in to comment.