yaooqinn commented on PR #3216:
URL: 
https://github.com/apache/incubator-kyuubi/pull/3216#issuecomment-1211631711

   I suggest 
   - we implement it in `OperationModes` for reuse in different engines.
   - redirect unrecognized modes to NONE with a warning message, it has a 
deterministic behavior which does not rely on 
kyuubi.operation.plan.only.excludes
   
   ```scala
     object OperationModes extends Enumeration with Logging {
       type OperationMode = Value
       val PARSE, ANALYZE, OPTIMIZE, PHYSICAL, EXECUTION, NONE = Value
   
       def apply(mode: String): OperationMode = {
         mode.toUpperCase(Locale.ROOT) match {
           case "PARSE" => PARSE
           case "ANALYZE" => ANALYZE
           case "OPTIMIZE" => OPTIMIZE
           case "PHYSICAL" => PHYSICAL
           case "EXECUTION" => EXECUTION
           case "NONE" => NONE
           case other =>
             warn(s"Unsupported operation mode: $mode, using NONE instead")
             NONE
         }
       }
     }
   ```
   
   Accordingly in OperationManagers,
   ```scala
          case OperationLanguages.SQL =>
             val mode =
               OperationModes(spark.conf.get(OPERATION_PLAN_ONLY_MODE.key, 
operationModeDefault))
             mode match {
               case NONE =>
                 val incrementalCollect = 
spark.conf.getOption(OPERATION_INCREMENTAL_COLLECT.key)
                   
.map(_.toBoolean).getOrElse(operationIncrementalCollectDefault)
                 new ExecuteStatement(session, statement, runAsync, 
queryTimeout, incrementalCollect)
               case mode =>
                 new PlanOnlyStatement(session, statement, mode)
             }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to