You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ya...@apache.org on 2021/09/16 08:02:00 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #1113] Fix error fetching results after run PlanOnlyStatement

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 b6de06c  [KYUUBI #1113] Fix error fetching results after run PlanOnlyStatement
b6de06c is described below

commit b6de06c5cc1d516188d0e5df1e393c93a7480772
Author: timothy65535 <ti...@163.com>
AuthorDate: Thu Sep 16 15:59:14 2021 +0800

    [KYUUBI #1113] Fix error fetching results after run PlanOnlyStatement
    
    <!--
    Thanks for sending a pull request!
    
    Here are some tips for you:
      1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
      2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
      3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
    -->
    
    ### _Why are the changes needed?_
    <!--
    Please clarify why the changes are needed. For instance,
      1. If you add a feature, you can talk about the use case of it.
      2. If you fix a bug, you can clarify why it is a bug.
    -->
    
    **RUN QUERY**
    ```
    set kyuubi.operation.plan.only.mode=ANALYZE;
    select 1;
    ```
    
    **ERROR MSG**
    ```
    2021-09-16 15:19:57.278 INFO operation.PlanOnlyStatement: Processing anonymous's query[015cbe32-c872-407c-b6a8-d3be6b43d745]: INITIALIZED_STATE -> RUNNING_STATE, statement: set kyuubi.operation.plan.only.mode=ANALYZE
    2021-09-16 15:19:57.293 INFO operation.PlanOnlyStatement: Processing anonymous's query[015cbe32-c872-407c-b6a8-d3be6b43d745]: RUNNING_STATE -> FINISHED_STATE, statement: set kyuubi.operation.plan.only.mode=ANALYZE, time taken: 0.015 seconds
    2021-09-16 15:19:57.309 WARN spark.SparkThriftFrontendService: Error fetching results:
    org.apache.kyuubi.KyuubiSQLException: OperationHandle [type=EXECUTE_STATEMENT, identifier: 015cbe32-c872-407c-b6a8-d3be6b43d745] failed to generate operation log
    	at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:69)
    	at org.apache.kyuubi.operation.OperationManager.$anonfun$getOperationLogRowSet$2(OperationManager.scala:125)
    	at scala.Option.getOrElse(Option.scala:189)
    	at org.apache.kyuubi.operation.OperationManager.getOperationLogRowSet(OperationManager.scala:125)
    	at org.apache.kyuubi.session.AbstractSession.fetchResults(AbstractSession.scala:193)
    	at org.apache.kyuubi.service.AbstractBackendService.fetchResults(AbstractBackendService.scala:164)
    	at org.apache.kyuubi.service.ThriftFrontendService.FetchResults(ThriftFrontendService.scala:479)
    	at org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults.getResult(TCLIService.java:1837)
    	at org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults.getResult(TCLIService.java:1822)
    	at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38)
    	at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
    	at org.apache.kyuubi.service.authentication.TSetIpAddressProcessor.process(TSetIpAddressProcessor.scala:36)
    	at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:310)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:748)
    2021-09-16 15:19:57.313 WARN spark.SparkThriftFrontendService: Error fetching results:
    org.apache.kyuubi.KyuubiSQLException: OperationHandle [type=EXECUTE_STATEMENT, identifier: 015cbe32-c872-407c-b6a8-d3be6b43d745] failed to generate operation log
    	at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:69)
    	at org.apache.kyuubi.operation.OperationManager.$anonfun$getOperationLogRowSet$2(OperationManager.scala:125)
    	at scala.Option.getOrElse(Option.scala:189)
    	at org.apache.kyuubi.operation.OperationManager.getOperationLogRowSet(OperationManager.scala:125)
    	at org.apache.kyuubi.session.AbstractSession.fetchResults(AbstractSession.scala:193)
    	at org.apache.kyuubi.service.AbstractBackendService.fetchResults(AbstractBackendService.scala:164)
    	at org.apache.kyuubi.service.ThriftFrontendService.FetchResults(ThriftFrontendService.scala:479)
    	at org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults.getResult(TCLIService.java:1837)
    	at org.apache.hive.service.rpc.thrift.TCLIService$Processor$FetchResults.getResult(TCLIService.java:1822)
    	at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38)
    	at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
    	at org.apache.kyuubi.service.authentication.TSetIpAddressProcessor.process(TSetIpAddressProcessor.scala:36)
    	at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:310)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:748)
    ```
    
    ### _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.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #1114 from timothy65535/ky-1113.
    
    Closes #1113
    
    e8409d12 [timothy65535] [KYUUBI #1113] Fix error fetching results after run PlanOnlyStatement
    
    Authored-by: timothy65535 <ti...@163.com>
    Signed-off-by: Kent Yao <ya...@apache.org>
---
 .../org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala | 5 +++++
 1 file changed, 5 insertions(+)

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 26c6f59..07b8cf9 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
@@ -24,6 +24,7 @@ import org.apache.spark.sql.types.StructType
 import org.apache.kyuubi.config.KyuubiConf.OperationModes.{ANALYZE, OperationMode, OPTIMIZE, PARSE}
 import org.apache.kyuubi.engine.spark.{ArrayFetchIterator, IterableFetchIterator}
 import org.apache.kyuubi.operation.OperationType
+import org.apache.kyuubi.operation.log.OperationLog
 import org.apache.kyuubi.session.Session
 
 /**
@@ -36,6 +37,10 @@ class PlanOnlyStatement(
     mode: OperationMode)
   extends SparkOperation(spark, OperationType.EXECUTE_STATEMENT, session) {
 
+  private val operationLog: OperationLog =
+    OperationLog.createOperationLog(session.handle, getHandle)
+  override def getOperationLog: Option[OperationLog] = Option(operationLog)
+
   override protected def resultSchema: StructType = if (result == null) {
     new StructType().add("plan", "string")
   } else {