This is an automated email from the ASF dual-hosted git repository.

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d757a3  [KYUUBI #1963] Make plan only mode skippable for configuable 
plans
6d757a3 is described below

commit 6d757a3df954d84a88cdbc22372600610f8a192a
Author: SteNicholas <[email protected]>
AuthorDate: Thu Feb 24 12:46:34 2022 +0800

    [KYUUBI #1963] Make plan only mode skippable for configuable plans
    
    ### _Why are the changes needed?_
    
    Make plan only mode skippable for configuable plans.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #1967 from SteNicholas/KYUUBI-1963.
    
    Closes #1963
    
    e253aec6 [SteNicholas] [KYUUBI #1963] Make plan only mode skippable for 
configuable plans
    b5cff405 [SteNicholas] [KYUUBI #1963] Make plan only mode skippable for 
configuable plans
    
    Authored-by: SteNicholas <[email protected]>
    Signed-off-by: Kent Yao <[email protected]>
---
 docs/deployment/settings.md                        |  1 +
 .../flink/operation/FlinkSQLOperationManager.scala |  4 +--
 .../flink/operation/FlinkOperationSuite.scala      |  2 +-
 .../flink/operation/PlanOnlyOperationSuite.scala   | 14 ++++----
 .../engine/spark/operation/PlanOnlyStatement.scala | 21 ++++--------
 .../spark/operation/SparkSQLOperationManager.scala |  4 +--
 .../org/apache/kyuubi/config/KyuubiConf.scala      | 15 ++++++++-
 .../kyuubi/operation/PlanOnlyOperationSuite.scala  | 37 ++++++++++------------
 8 files changed, 50 insertions(+), 48 deletions(-)

diff --git a/docs/deployment/settings.md b/docs/deployment/settings.md
index 826bbc6..8516898 100644
--- a/docs/deployment/settings.md
+++ b/docs/deployment/settings.md
@@ -290,6 +290,7 @@ Key | Default | Meaning | Type | Since
 <code>kyuubi.operation.interrupt.on.cancel</code>|<div style='width: 
65pt;word-wrap: break-word;white-space: normal'>true</div>|<div style='width: 
170pt;word-wrap: break-word;white-space: normal'>When true, all running tasks 
will be interrupted if one cancels a query. When false, all running tasks will 
remain until finished.</div>|<div style='width: 30pt'>boolean</div>|<div 
style='width: 20pt'>1.2.0</div>
 <code>kyuubi.operation.language</code>|<div style='width: 65pt;word-wrap: 
break-word;white-space: normal'>SQL</div>|<div style='width: 170pt;word-wrap: 
break-word;white-space: normal'>Choose a programing language for the following 
inputs <ul><li>SQL: (Default) Run all following statements as SQL queries.</li> 
<li>SCALA: Run all following input a scala codes</li></ul></div>|<div 
style='width: 30pt'>string</div>|<div style='width: 20pt'>1.5.0</div>
 <code>kyuubi.operation.log.dir.root</code>|<div style='width: 65pt;word-wrap: 
break-word;white-space: normal'>server_operation_logs</div>|<div style='width: 
170pt;word-wrap: break-word;white-space: normal'>Root directory for query 
operation log at server-side.</div>|<div style='width: 30pt'>string</div>|<div 
style='width: 20pt'>1.4.0</div>
+<code>kyuubi.operation.plan.only.excludes</code>|<div style='width: 
65pt;word-wrap: break-word;white-space: 
normal'>ResetCommand,SetCommand,SetNamespaceCommand,UseStatement</div>|<div 
style='width: 170pt;word-wrap: break-word;white-space: normal'>Comma-separated 
list of query plan names, in the form of simple class names, i.e, for `set 
abc=xyz`, the value will be `SetCommand`. For those auxiliary plans, such as 
`switch databases`, `set properties`, or `create temporary view` e.t.c, which 
[...]
 <code>kyuubi.operation.plan.only.mode</code>|<div style='width: 
65pt;word-wrap: break-word;white-space: normal'>NONE</div>|<div style='width: 
170pt;word-wrap: break-word;white-space: normal'>Whether to perform the 
statement in a PARSE, ANALYZE, OPTIMIZE, PHYSICAL, EXECUTION only way without 
executing the query. When it is NONE, the statement will be fully 
executed</div>|<div style='width: 30pt'>string</div>|<div style='width: 
20pt'>1.4.0</div>
 <code>kyuubi.operation.query.timeout</code>|<div style='width: 65pt;word-wrap: 
break-word;white-space: normal'>&lt;undefined&gt;</div>|<div style='width: 
170pt;word-wrap: break-word;white-space: normal'>Timeout for query executions 
at server-side, take affect with client-side 
timeout(`java.sql.Statement.setQueryTimeout`) together, a running query will be 
cancelled automatically if timeout. It's off by default, which means only 
client-side take fully control whether the query should timeo [...]
 <code>kyuubi.operation.scheduler.pool</code>|<div style='width: 
65pt;word-wrap: break-word;white-space: normal'>&lt;undefined&gt;</div>|<div 
style='width: 170pt;word-wrap: break-word;white-space: normal'>The scheduler 
pool of job. Note that, this config should be used after change Spark config 
spark.scheduler.mode=FAIR.</div>|<div style='width: 30pt'>string</div>|<div 
style='width: 20pt'>1.1.1</div>
diff --git 
a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/FlinkSQLOperationManager.scala
 
b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/FlinkSQLOperationManager.scala
index d89a591..e8fe1c9 100644
--- 
a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/FlinkSQLOperationManager.scala
+++ 
b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/operation/FlinkSQLOperationManager.scala
@@ -31,7 +31,7 @@ import org.apache.kyuubi.session.Session
 
 class FlinkSQLOperationManager extends 
OperationManager("FlinkSQLOperationManager") {
 
-  private lazy val operationModeDefault = getConf.get(OPERATION_PLAN_ONLY)
+  private lazy val operationModeDefault = getConf.get(OPERATION_PLAN_ONLY_MODE)
 
   private lazy val resultMaxRowsDefault = getConf.get(ENGINE_FLINK_MAX_ROWS)
 
@@ -43,7 +43,7 @@ class FlinkSQLOperationManager extends 
OperationManager("FlinkSQLOperationManage
       queryTimeout: Long): Operation = {
     val flinkSession = session.asInstanceOf[FlinkSessionImpl]
     val mode = flinkSession.sessionContext.getConfigMap.getOrDefault(
-      OPERATION_PLAN_ONLY.key,
+      OPERATION_PLAN_ONLY_MODE.key,
       operationModeDefault)
     val resultMaxRows =
       flinkSession.normalizedConf.getOrElse(
diff --git 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
index 46e0977..7cd62bc 100644
--- 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
+++ 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala
@@ -36,7 +36,7 @@ import org.apache.kyuubi.service.ServiceState._
 
 class FlinkOperationSuite extends WithFlinkSQLEngine with HiveJDBCTestHelper {
   override def withKyuubiConf: Map[String, String] =
-    Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> NONE.toString)
+    Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> NONE.toString)
 
   override protected def jdbcUrl: String =
     s"jdbc:hive2://${engine.frontendServices.head.connectionUrl}/;"
diff --git 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/PlanOnlyOperationSuite.scala
 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/PlanOnlyOperationSuite.scala
index 1ed9651..6a4d90d 100644
--- 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/PlanOnlyOperationSuite.scala
+++ 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/PlanOnlyOperationSuite.scala
@@ -29,7 +29,7 @@ class PlanOnlyOperationSuite extends WithFlinkSQLEngine with 
HiveJDBCTestHelper
   override def withKyuubiConf: Map[String, String] =
     Map(
       KyuubiConf.ENGINE_SHARE_LEVEL.key -> "user",
-      KyuubiConf.OPERATION_PLAN_ONLY.key -> PARSE.toString,
+      KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> PARSE.toString,
       KyuubiConf.ENGINE_SHARE_LEVEL_SUBDOMAIN.key -> "plan-only")
 
   override protected def jdbcUrl: String =
@@ -42,7 +42,7 @@ class PlanOnlyOperationSuite extends WithFlinkSQLEngine with 
HiveJDBCTestHelper
   }
 
   test("Plan only operation with session conf") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
ANALYZE.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
ANALYZE.toString))(Map.empty) {
       withJdbcStatement() { statement =>
         val exceptionMsg = intercept[Exception](statement.executeQuery("select 
1")).getMessage
         assert(exceptionMsg.contains(
@@ -52,16 +52,17 @@ class PlanOnlyOperationSuite extends WithFlinkSQLEngine 
with HiveJDBCTestHelper
   }
 
   test("Plan only operation with set command") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
ANALYZE.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
ANALYZE.toString))(Map.empty) {
       withJdbcStatement() { statement =>
-        statement.execute(s"set ${KyuubiConf.OPERATION_PLAN_ONLY.key}=parse")
+        statement.execute(s"set 
${KyuubiConf.OPERATION_PLAN_ONLY_MODE.key}=$PARSE")
         testPlanOnlyStatementWithParseMode(statement)
       }
     }
   }
 
   test("Plan only operation with PHYSICAL mode") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
PHYSICAL.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
PHYSICAL.toString))(
+      Map.empty) {
       withJdbcStatement() { statement =>
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("Calc(select=[1 AS EXPR$0])") &&
@@ -71,7 +72,8 @@ class PlanOnlyOperationSuite extends WithFlinkSQLEngine with 
HiveJDBCTestHelper
   }
 
   test("Plan only operation with EXECUTION mode") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
EXECUTION.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
EXECUTION.toString))(
+      Map.empty) {
       withJdbcStatement() { statement =>
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("Calc(select=[1 AS EXPR$0])") &&
diff --git 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala
 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala
index a4abf88..3140994 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala
@@ -18,9 +18,9 @@
 package org.apache.kyuubi.engine.spark.operation
 
 import org.apache.spark.sql.Row
-import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
 import org.apache.spark.sql.types.StructType
 
+import org.apache.kyuubi.config.KyuubiConf.OPERATION_PLAN_ONLY_EXCLUDES
 import org.apache.kyuubi.config.KyuubiConf.OperationModes._
 import org.apache.kyuubi.operation.{ArrayFetchIterator, IterableFetchIterator, 
OperationType}
 import org.apache.kyuubi.operation.log.OperationLog
@@ -36,6 +36,10 @@ class PlanOnlyStatement(
   extends SparkOperation(OperationType.EXECUTE_STATEMENT, session) {
 
   private val operationLog: OperationLog = 
OperationLog.createOperationLog(session, getHandle)
+  private val planExcludes: Seq[String] = {
+    
spark.conf.getOption(OPERATION_PLAN_ONLY_EXCLUDES.key).map(_.split(",").map(_.trim).toSeq)
+      
.getOrElse(session.sessionManager.getConf.get(OPERATION_PLAN_ONLY_EXCLUDES))
+  }
   override def getOperationLog: Option[OperationLog] = Option(operationLog)
 
   override protected def resultSchema: StructType = {
@@ -46,24 +50,11 @@ class PlanOnlyStatement(
     } else result.schema
   }
 
-  private def shouldDirectRun(plan: LogicalPlan): Boolean = {
-    val className = plan.getClass.getSimpleName
-    className == "SetCommand" ||
-    className == "ResetCommand" ||
-    className == "UseStatement" ||
-    className == "SetNamespaceCommand" ||
-    className == "CacheTableStatement" ||
-    className == "CacheTableCommand" ||
-    className == "CacheTableAsSelect" ||
-    className == "CreateViewStatement" ||
-    className == "CreateViewCommand"
-  }
-
   override protected def runInternal(): Unit = {
     try {
       val parsed = spark.sessionState.sqlParser.parsePlan(statement)
       parsed match {
-        case cmd if shouldDirectRun(cmd) =>
+        case cmd if planExcludes.contains(cmd.getClass.getSimpleName) =>
           result = spark.sql(statement)
           iter = new ArrayFetchIterator(result.collect())
         case plan => mode match {
diff --git 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkSQLOperationManager.scala
 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkSQLOperationManager.scala
index c3f3b74..3abf3f2 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkSQLOperationManager.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkSQLOperationManager.scala
@@ -34,7 +34,7 @@ class SparkSQLOperationManager private (name: String) extends 
OperationManager(n
 
   def this() = this(classOf[SparkSQLOperationManager].getSimpleName)
 
-  private lazy val operationModeDefault = getConf.get(OPERATION_PLAN_ONLY)
+  private lazy val operationModeDefault = getConf.get(OPERATION_PLAN_ONLY_MODE)
   private lazy val operationIncrementalCollectDefault = 
getConf.get(OPERATION_INCREMENTAL_COLLECT)
   private lazy val operationLanguageDefault = getConf.get(OPERATION_LANGUAGE)
 
@@ -58,7 +58,7 @@ class SparkSQLOperationManager private (name: String) extends 
OperationManager(n
     val operation =
       OperationLanguages.withName(lang.toUpperCase(Locale.ROOT)) match {
         case OperationLanguages.SQL =>
-          val mode = spark.conf.get(OPERATION_PLAN_ONLY.key, 
operationModeDefault)
+          val mode = spark.conf.get(OPERATION_PLAN_ONLY_MODE.key, 
operationModeDefault)
           OperationModes.withName(mode.toUpperCase(Locale.ROOT)) match {
             case NONE =>
               val incrementalCollect = 
spark.conf.getOption(OPERATION_INCREMENTAL_COLLECT.key)
diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index a5de82e..53e3f93 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -1137,7 +1137,7 @@ object KyuubiConf {
     val PARSE, ANALYZE, OPTIMIZE, PHYSICAL, EXECUTION, NONE = Value
   }
 
-  val OPERATION_PLAN_ONLY: ConfigEntry[String] =
+  val OPERATION_PLAN_ONLY_MODE: ConfigEntry[String] =
     buildConf("operation.plan.only.mode")
       .doc("Whether to perform the statement in a PARSE, ANALYZE, OPTIMIZE, 
PHYSICAL, EXECUTION " +
         "only way without executing the query. When it is NONE, the statement 
will be fully " +
@@ -1148,6 +1148,19 @@ object KyuubiConf {
       .checkValues(OperationModes.values.map(_.toString))
       .createWithDefault(OperationModes.NONE.toString)
 
+  val OPERATION_PLAN_ONLY_EXCLUDES: ConfigEntry[Seq[String]] =
+    buildConf("operation.plan.only.excludes")
+      .doc("Comma-separated list of query plan names, in the form of simple 
class names, i.e, " +
+        "for `set abc=xyz`, the value will be `SetCommand`. For those 
auxiliary plans, such as " +
+        "`switch databases`, `set properties`, or `create temporary view` 
e.t.c, " +
+        "which are used for setup evaluating environments for analyzing actual 
queries, " +
+        "we can use this config to exclude them and let them take effect. " +
+        s"See also ${OPERATION_PLAN_ONLY_MODE.key}.")
+      .version("1.5.0")
+      .stringConf
+      .toSequence()
+      .createWithDefault(Seq("ResetCommand", "SetCommand", 
"SetNamespaceCommand", "UseStatement"))
+
   object OperationLanguages extends Enumeration {
     type OperationLanguage = Value
     val SQL, SCALA = Value
diff --git 
a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/PlanOnlyOperationSuite.scala
 
b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/PlanOnlyOperationSuite.scala
index 2c526d1..3e94a47 100644
--- 
a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/PlanOnlyOperationSuite.scala
+++ 
b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/PlanOnlyOperationSuite.scala
@@ -28,7 +28,7 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
   override protected val conf: KyuubiConf = {
     KyuubiConf()
       .set(KyuubiConf.ENGINE_SHARE_LEVEL, "user")
-      .set(KyuubiConf.OPERATION_PLAN_ONLY, OPTIMIZE.toString)
+      .set(KyuubiConf.OPERATION_PLAN_ONLY_MODE, OPTIMIZE.toString)
       .set(KyuubiConf.ENGINE_SHARE_LEVEL_SUBDOMAIN.key, "plan-only")
   }
 
@@ -42,7 +42,7 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
   }
 
   test("KYUUBI #1059: Plan only operation with session conf") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
ANALYZE.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
ANALYZE.toString))(Map.empty) {
       withJdbcStatement() { statement =>
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("Project") && 
operationPlan.contains("Filter"))
@@ -51,9 +51,9 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
   }
 
   test("KYUUBI #1059: Plan only operation with set command") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
ANALYZE.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
ANALYZE.toString))(Map.empty) {
       withJdbcStatement() { statement =>
-        statement.execute(s"set ${KyuubiConf.OPERATION_PLAN_ONLY.key}=$PARSE")
+        statement.execute(s"set 
${KyuubiConf.OPERATION_PLAN_ONLY_MODE.key}=$PARSE")
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("'Project"))
       }
@@ -61,7 +61,8 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
   }
 
   test("KYUUBI #1919: Plan only operation with PHYSICAL mode") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
PHYSICAL.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
PHYSICAL.toString))(
+      Map.empty) {
       withJdbcStatement() { statement =>
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("Project") && 
operationPlan.contains("Scan OneRowRelation"))
@@ -70,7 +71,8 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
   }
 
   test("KYUUBI #1919: Plan only operation with EXECUTION mode") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
EXECUTION.toString))(Map.empty) {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
EXECUTION.toString))(
+      Map.empty) {
       withJdbcStatement() { statement =>
         val operationPlan = getOperationPlanWithStatement(statement)
         assert(operationPlan.startsWith("*(1) Project") &&
@@ -79,29 +81,22 @@ class PlanOnlyOperationSuite extends WithKyuubiServer with 
HiveJDBCTestHelper {
     }
   }
 
-  test("KYUUBI #1920: Plan only operations with Usestatement or 
SetNamespaceCommand skiped") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
NONE.toString))(Map.empty) {
+  test("KYUUBI #1920: Plan only operations with UseStatement or 
SetNamespaceCommand") {
+    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY_MODE.key -> 
NONE.toString))(Map.empty) {
       withDatabases("test_database") { statement =>
         statement.execute("create database test_database")
-        statement.execute(s"set 
${KyuubiConf.OPERATION_PLAN_ONLY.key}=optimize")
+        statement.execute(s"set 
${KyuubiConf.OPERATION_PLAN_ONLY_MODE.key}=$OPTIMIZE")
         val result = statement.executeQuery("use test_database")
         assert(!result.next(), "In contrast to PlanOnly mode, it will returns 
an empty result")
       }
     }
   }
 
-  test("KYUUBI #1920: Plan only operations with CacheTable skiped") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
OPTIMIZE.toString))(Map.empty) {
-      withJdbcStatement() { statement =>
-        val result = statement.executeQuery("cache table cached_table as 
select 1")
-        assert(!result.next(), "In contrast to PlanOnly mode, it will returns 
an empty result")
-      }
-    }
-  }
-
-  test("KYUUBI #1920: Plan only operations with CreateViewStatement or 
CreateViewCommand skiped") {
-    withSessionConf()(Map(KyuubiConf.OPERATION_PLAN_ONLY.key -> 
OPTIMIZE.toString))(Map.empty) {
-      withJdbcStatement() { statement =>
+  test("KYUUBI #1920: Plan only operations with CreateViewStatement or 
CreateViewCommand") {
+    withSessionConf()(
+      Map(KyuubiConf.OPERATION_PLAN_ONLY_EXCLUDES.key -> 
"CreateViewStatement,CreateViewCommand"))(
+      Map.empty) {
+      withJdbcStatement("temp_view") { statement =>
         val result = statement.executeQuery("create temp view temp_view as 
select 1")
         assert(!result.next(), "In contrast to PlanOnly mode, it will returns 
an empty result")
       }

Reply via email to