当前位置: 首页>>代码示例>>Scala>>正文


Scala HiveSession类代码示例

本文整理汇总了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
  }
} 
开发者ID:palmer0914,项目名称:shark,代码行数:48,代码来源:SharkExecuteStatementOperation.scala

示例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
 }

} 
开发者ID:palmer0914,项目名称:shark,代码行数:20,代码来源:SharkOperationManager.scala


注:本文中的org.apache.hive.service.cli.session.HiveSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。