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

ulyssesyou 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 a6ba642  [KYUUBI #2260] The running query will not update the duration 
of the page
a6ba642 is described below

commit a6ba6420bee8f39d4b29c19e0c060ed5de9bfa99
Author: sychen <[email protected]>
AuthorDate: Sat Apr 2 17:52:43 2022 +0800

    [KYUUBI #2260] The running query will not update the duration of the page
    
    ### _Why are the changes needed?_
    close https://github.com/apache/incubator-kyuubi/issues/2260
    
    The default value of completedTime is 0, and the calculation of duration 
only considers the case where completedTime is -1.
    
    org.apache.kyuubi.operation.AbstractOperation
    ```scala
    protected var completedTime: Long = _
    ````
    
    org.apache.kyuubi.engine.spark.events.SparkOperationEvent
    ```scala
      def duration: Long = {
        if (completeTime == -1L) {
          System.currentTimeMillis - createTime
        } else {
          completeTime - createTime
        }
      }
    ```
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [x] 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 #2261 from cxzl25/KYUUBI-2260.
    
    Closes #2260
    
    86d1150a [sychen] duration
    
    Authored-by: sychen <[email protected]>
    Signed-off-by: ulysses-you <[email protected]>
---
 .../org/apache/kyuubi/engine/spark/events/SparkOperationEvent.scala     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/events/SparkOperationEvent.scala
 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/events/SparkOperationEvent.scala
index 22eb8ac..319e1c0 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/events/SparkOperationEvent.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/events/SparkOperationEvent.scala
@@ -65,7 +65,7 @@ case class SparkOperationEvent(
     ("day", Utils.getDateFromTimestamp(createTime)) :: Nil
 
   def duration: Long = {
-    if (completeTime == -1L) {
+    if (completeTime <= 0L) {
       System.currentTimeMillis - createTime
     } else {
       completeTime - createTime

Reply via email to