本文整理汇总了Scala中org.apache.hadoop.hive.ql.metadata.HiveException类的典型用法代码示例。如果您正苦于以下问题:Scala HiveException类的具体用法?Scala HiveException怎么用?Scala HiveException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HiveException类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: MultipleUtils
//设置package包名称以及导入依赖的类
package com.gmail.katezer.bigdata.utils
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException
import org.apache.hadoop.hive.ql.metadata.HiveException
import org.apache.spark.sql.execution.QueryExecutionException
import org.apache.spark.sql.hive.HiveContext
object MultipleUtils {
def getFirstArg(args: Array[String]): String = args.isEmpty match {
case true => throw new IllegalArgumentException("First argument on launching the job is required and must be the date of the file in YYYYMMDD format")
case false => args.head
}
def getSecondArg(args: Array[String]): Boolean = args.isEmpty match {
case true => throw new IllegalArgumentException("First argument on launching the job is required and must be the date of the file in YYYYMMDD format")
case false =>
args.tail.isEmpty match {
case true => false
case false => args.tail.head match {
case "local" => true
case _ => false
}
}
}
def executeAndIgnoreHiveError(hc: HiveContext, query: String): Unit = {
try {
hc.sql(query)
} catch {
case _ : QueryExecutionException | _ : HiveException | _: NoSuchObjectException => // expected, do nothing
case e: Exception => throw e
}
}
}