From c3598225e1d8e7d6d9535785af12bf7578fe67bd Mon Sep 17 00:00:00 2001 From: wangfei Date: Tue, 28 Oct 2014 09:46:30 -0700 Subject: [PATCH] reuse getCommandProcessor in hiveshim --- .../spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala | 3 ++- .../spark/sql/hive/thriftserver/SparkSQLCLIService.scala | 2 +- .../sql/hive/thriftserver/{Shim.scala => Shim12.scala} | 6 +----- .../sql/hive/thriftserver/{Shim.scala => Shim13.scala} | 6 +----- 4 files changed, 5 insertions(+), 12 deletions(-) rename sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/{Shim.scala => Shim12.scala} (98%) rename sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/{Shim.scala => Shim13.scala} (98%) diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala index 6d9de63348624..2cd02ae9269f5 100755 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala @@ -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" diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala index f0f7fe8cea122..a78311fc48635 100644 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala @@ -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) diff --git a/sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala b/sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim12.scala similarity index 98% rename from sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala rename to sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim12.scala index fcfc5c5541b8e..bbd727c686bbc 100644 --- a/sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala +++ b/sql/hive-thriftserver/v0.12.0/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim12.scala @@ -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) diff --git a/sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala b/sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala similarity index 98% rename from sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala rename to sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala index c05311dabda16..e59681bfbe43e 100644 --- a/sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim.scala +++ b/sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala @@ -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)