add spark-authorizer

This commit is contained in:
Kent Yao 2018-06-11 14:54:21 +08:00
parent cf1c659805
commit 444dfd11d3

View File

@ -32,6 +32,8 @@ import org.apache.spark.{KyuubiSparkUtil, SparkConf, SparkContext}
import org.apache.spark.KyuubiConf._
import org.apache.spark.KyuubiSparkUtil._
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.catalyst.rules.Rule
import org.apache.spark.ui.KyuubiServerTab
import yaooqinn.kyuubi.{KyuubiSQLException, Logging}
@ -202,6 +204,12 @@ class SparkSessionWithUGI(user: UserGroupInformation, conf: SparkConf) extends L
SparkSessionCacheManager.get.decrease(userName)
throw ute.getCause
}
val authRule =
ReflectUtils.findClass("org.apache.spark.sql.catalyst.optimizer.Authorizer", true)
if (authRule != null) {
_sparkSession.experimental.extraOptimizations ++=
Seq(authRule.asInstanceOf[Rule[LogicalPlan]])
}
}
}