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

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


The following commit(s) were added to refs/heads/master by this push:
     new 55f1db3c1 [KYUUBI #6359] [REST] Return more fields within 
session/batch data
55f1db3c1 is described below

commit 55f1db3c146550938fadbcaddc5e92f089ed0029
Author: Wang, Fei <[email protected]>
AuthorDate: Wed May 8 09:30:53 2024 -0700

    [KYUUBI #6359] [REST] Return more fields within session/batch data
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Return `sessionName` and `totalOperations` within `SessionData`.
    Return `appStartTime` with list batches.
    
    ## Types of changes :bookmark:
    
    - [ ] Bugfix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior Without This Pull Request :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### Related Unit Tests
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [x] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6359 from turboFei/total_op.
    
    Closes #6359
    
    5fb3fb8e4 [Wang, Fei] fix compile
    fc3970595 [Wang, Fei] comments
    0e7ff009e [Wang, Fei] return app time
    bb4b64902 [Wang, Fei] dto
    
    Authored-by: Wang, Fei <[email protected]>
    Signed-off-by: Wang, Fei <[email protected]>
---
 .../kyuubi/client/api/v1/dto/SessionData.java      | 24 +++++++++++++++++++++-
 .../org/apache/kyuubi/server/api/ApiUtils.scala    |  4 +++-
 .../server/metadata/jdbc/JDBCMetadataStore.scala   |  3 +++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
index 30a4eb515..a1bc90a56 100644
--- 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
+++ 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
@@ -36,6 +36,8 @@ public class SessionData {
   private String sessionType;
   private String kyuubiInstance;
   private String engineId;
+  private String sessionName;
+  private Integer totalOperations;
 
   public SessionData() {}
 
@@ -51,7 +53,9 @@ public class SessionData {
       String exception,
       String sessionType,
       String kyuubiInstance,
-      String engineId) {
+      String engineId,
+      String sessionName,
+      Integer totalOperations) {
     this.identifier = identifier;
     this.remoteId = remoteId;
     this.user = user;
@@ -64,6 +68,8 @@ public class SessionData {
     this.sessionType = sessionType;
     this.kyuubiInstance = kyuubiInstance;
     this.engineId = engineId;
+    this.sessionName = sessionName;
+    this.totalOperations = totalOperations;
   }
 
   public String getIdentifier() {
@@ -165,6 +171,22 @@ public class SessionData {
     this.engineId = engineId;
   }
 
+  public String getSessionName() {
+    return sessionName;
+  }
+
+  public void setSessionName(String sessionName) {
+    this.sessionName = sessionName;
+  }
+
+  public Integer getTotalOperations() {
+    return totalOperations;
+  }
+
+  public void setTotalOperations(Integer totalOperations) {
+    this.totalOperations = totalOperations;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
index 494421608..ccd3ebe93 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
@@ -64,7 +64,9 @@ object ApiUtils extends Logging {
       sessionEvent.flatMap(_.exception).map(Utils.prettyPrint).getOrElse(""),
       session.sessionType.toString,
       session.connectionUrl,
-      sessionEvent.map(_.engineId).getOrElse(""))
+      sessionEvent.map(_.engineId).getOrElse(""),
+      session.name.getOrElse(""),
+      sessionEvent.map(_.totalOperations).getOrElse(0): Int)
   }
 
   private def operationProgress(operation: KyuubiOperation): OperationProgress 
= {
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala
index 0f1878a9e..cb6671ade 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala
@@ -432,6 +432,7 @@ class JDBCMetadataStore(conf: KyuubiConf) extends 
MetadataStore with Logging {
         val createTime = resultSet.getLong("create_time")
         val engineType = resultSet.getString("engine_type")
         val clusterManager = Option(resultSet.getString("cluster_manager"))
+        val engineOpenTime = resultSet.getLong("engine_open_time")
         val engineId = resultSet.getString("engine_id")
         val engineName = resultSet.getString("engine_name")
         val engineUrl = resultSet.getString("engine_url")
@@ -456,6 +457,7 @@ class JDBCMetadataStore(conf: KyuubiConf) extends 
MetadataStore with Logging {
           createTime = createTime,
           engineType = engineType,
           clusterManager = clusterManager,
+          engineOpenTime = engineOpenTime,
           engineId = engineId,
           engineName = engineName,
           engineUrl = engineUrl,
@@ -594,6 +596,7 @@ object JDBCMetadataStore {
     "create_time",
     "engine_type",
     "cluster_manager",
+    "engine_open_time",
     "engine_id",
     "engine_name",
     "engine_url",

Reply via email to