本文整理汇总了Scala中org.apache.hive.service.cli.session.HiveSession类的典型用法代码示例。如果您正苦于以下问题:Scala HiveSession类的具体用法?Scala HiveSession怎么用?Scala HiveSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HiveSession类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: SharkExecuteStatementOperation
//设置package包名称以及导入依赖的类
package shark.server
import java.lang.reflect.Constructor
import java.util.{Map => JMap}
import org.apache.hive.service.cli.session.HiveSession
object SharkExecuteStatementOperation {
def newExecuteStatementOperation(parentSession: HiveSession,
statement: String,
confOverlay: JMap[String, String])
: Any = {
val tokens = statement.trim().split("\\s+")
val command = tokens{0}.toLowerCase
command match {
case "set" => {
val ctor = accessCtor("org.apache.hive.service.cli.operation.SetOperation")
ctor.newInstance(parentSession, statement, confOverlay)
}
case "dfs" => {
val ctor = accessCtor("org.apache.hive.service.cli.operation.DfsOperation")
ctor.newInstance(parentSession, statement, confOverlay)
}
case "add" => {
val ctor = accessCtor("org.apache.hive.service.cli.operation.AddResourceOperation")
ctor.newInstance(parentSession, statement, confOverlay)
}
case "delete" => {
val ctor = accessCtor("org.apache.hive.service.cli.operation.DeleteResourceOperation")
ctor.newInstance(parentSession, statement, confOverlay)
}
case _ => {
new SharkSQLOperation(parentSession, statement, confOverlay)
}
}
}
def accessCtor(className : String) : Constructor[_] = {
val setClass = Class.forName(className)
val setConst =
setClass.getDeclaredConstructor(
classOf[HiveSession],
classOf[String],
classOf[JMap[String, String]])
setConst.setAccessible(true)
setConst
}
}
示例2: SharkOperationManager
//设置package包名称以及导入依赖的类
package shark.server
import java.util.{Map => JMap}
import org.apache.hive.service.cli.operation.{ExecuteStatementOperation, OperationManager}
import org.apache.hive.service.cli.session.HiveSession
class SharkOperationManager extends OperationManager {
override def newExecuteStatementOperation(parentSession: HiveSession,
statement: String, confOverlay:
JMap[String, String])
: ExecuteStatementOperation = {
val executeStatementOperation = SharkExecuteStatementOperation
.newExecuteStatementOperation(parentSession, statement, confOverlay)
val castOp = executeStatementOperation.asInstanceOf[ExecuteStatementOperation]
addOperation(castOp)
castOp
}
}