You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2025/10/23 23:58:18 UTC

(kyuubi) branch master updated: [KYUUBI #7229] Fix countMetadata if the params is empty

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 e8bbf5204a [KYUUBI #7229] Fix countMetadata if the params is empty
e8bbf5204a is described below

commit e8bbf5204ad9c875ca863a30168b4604491ec182
Author: Wang, Fei <fw...@ebay.com>
AuthorDate: Thu Oct 23 16:58:09 2025 -0700

    [KYUUBI #7229] Fix countMetadata if the params is empty
    
    ### Why are the changes needed?
    
    Without this PR.
    It will meet issue if the params is empty.
    ```
    jdbcMetadataStore.countMetadata(MetadataFilter())
    ```
    <img width="1443" height="742" alt="image" src="https://github.com/user-attachments/assets/e099c469-7468-4d6a-90e8-e20ba144316b" />
    
    <img width="877" height="160" alt="image" src="https://github.com/user-attachments/assets/1773d395-87f7-4108-ac6c-21c2ca04ca71" />
    
    ### How was this patch tested?
    
    UT.
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #7229 from turboFei/fix_typo.
    
    Closes #7229
    
    c1794feff [Wang, Fei] Fix countMetadata if the params is empty
    
    Authored-by: Wang, Fei <fw...@ebay.com>
    Signed-off-by: Wang, Fei <fw...@ebay.com>
---
 .../org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStore.scala      | 2 +-
 .../org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStoreSuite.scala | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

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 62395fd644..b7630895ce 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
@@ -280,7 +280,7 @@ class JDBCMetadataStore(conf: KyuubiConf) extends MetadataStore with Logging {
     queryBuilder.append(s" ${assembleWhereClause(filter, params)}")
     val query = queryBuilder.toString
     JdbcUtils.executeQueryWithRowMapper(query) { stmt =>
-      setStatementParams(stmt, params)
+      setStatementParams(stmt, params: _*)
     } { resultSet =>
       resultSet.getInt(1)
     }.head
diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStoreSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStoreSuite.scala
index 713739d5f5..49f3b48728 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStoreSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/metadata/jdbc/JDBCMetadataStoreSuite.scala
@@ -224,6 +224,7 @@ class JDBCMetadataStoreSuite extends KyuubiFunSuite {
     jdbcMetadataStore.updateMetadata(newBatchState)
 
     assert(jdbcMetadataStore.getMetadata(batchId) == newBatchState)
+    assert(jdbcMetadataStore.countMetadata(MetadataFilter()) > 0)
 
     assert(jdbcMetadataStore.getMetadataList(
       MetadataFilter(