You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2024/01/12 12:04:09 UTC

(kyuubi) branch master updated: [KYUUBI #5966] Error occurs on clicking on the Spark UI Kyuubi Query Engine tab

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

chengpan 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 57d531d56 [KYUUBI #5966] Error occurs on clicking on the Spark UI Kyuubi Query Engine tab
57d531d56 is described below

commit 57d531d56fe0892ce9eb14abe976a298f0944677
Author: Cheng Pan <pa...@gmail.com>
AuthorDate: Fri Jan 12 20:03:59 2024 +0800

    [KYUUBI #5966] Error occurs on clicking on the Spark UI Kyuubi Query Engine tab
    
    # :mag: Description
    
    ## Issue References 🔗
    
    This pull request fixes #5966
    
    Fix Kyuubi Query Engine tab error:StringIndexOutOfBoundsException: String index out of range: 7
    
    ## Describe Your Solution 🔧
    When the variables branch, revision, revisionTime, repoUrl are empty strings (""),assign them the default value "\<unknown\>".
    ## 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 📝
    
    - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #5967 from Emor-nj/KyuubiQueryEngineTab.
    
    Closes #5966
    
    0cee947b8 [Cheng Pan] Update kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
    5d8c030e2 [Cheng Pan] Update kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
    733a9af4b [Emor-nj] fix Kyuubi Query Engine tab error:StringIndexOutOfBoundsException: String index out of range: 7
    213493a6d [Emor-nj] fix Kyuubi Query Engine tab error:StringIndexOutOfBoundsException: String index out of range: 7
    
    Lead-authored-by: Cheng Pan <pa...@gmail.com>
    Co-authored-by: Emor-nj <em...@foxmail.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../src/main/scala/org/apache/kyuubi/package.scala | 32 ++++++++++++----------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
index e05ad9fbe..1ddefed0b 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/package.scala
@@ -43,20 +43,24 @@ package object kyuubi {
       Try(buildFileStream.close())
     }
 
-    val version: String = props.getProperty("kyuubi_version", unknown)
-    val java_version: String = props.getProperty("kyuubi_java_version", unknown)
-    val scala_version: String = props.getProperty("kyuubi_scala_version", unknown)
-    val spark_version: String = props.getProperty("kyuubi_spark_version", unknown)
-    val hive_version: String = props.getProperty("kyuubi_hive_version", unknown)
-    val hadoop_version: String = props.getProperty("kyuubi_hadoop_version", unknown)
-    val flink_version: String = props.getProperty("kyuubi_flink_version", unknown)
-    val trino_version: String = props.getProperty("kyuubi_trino_version", unknown)
-    val branch: String = props.getProperty("branch", unknown)
-    val revision: String = props.getProperty("revision", unknown)
-    val revisionTime: String = props.getProperty("revision_time", unknown)
-    val user: String = props.getProperty("user", unknown)
-    val repoUrl: String = props.getProperty("url", unknown)
-    val buildDate: String = props.getProperty("date", unknown)
+    private def getProperty(key: String, defaultValue: String = unknown): String = {
+      Option(props.getProperty(key, defaultValue)).filterNot(_.isEmpty).getOrElse(defaultValue)
+    }
+
+    val version: String = getProperty("kyuubi_version")
+    val java_version: String = getProperty("kyuubi_java_version")
+    val scala_version: String = getProperty("kyuubi_scala_version")
+    val spark_version: String = getProperty("kyuubi_spark_version")
+    val hive_version: String = getProperty("kyuubi_hive_version")
+    val hadoop_version: String = getProperty("kyuubi_hadoop_version")
+    val flink_version: String = getProperty("kyuubi_flink_version")
+    val trino_version: String = getProperty("kyuubi_trino_version")
+    val branch: String = getProperty("branch")
+    val revision: String = getProperty("revision")
+    val revisionTime: String = getProperty("revision_time")
+    val user: String = getProperty("user")
+    val repoUrl: String = getProperty("url")
+    val buildDate: String = getProperty("date")
   }
 
   val KYUUBI_VERSION: String = BuildInfo.version