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

fanng pushed a commit to branch branch-0.7
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-0.7 by this push:
     new 8ebc451f7 [#5424] fix(paimon): remove duplicate schema names for 
Paimon catalog JDBC backend (#5436)
8ebc451f7 is described below

commit 8ebc451f70b0094a96256052dfe467a9f9319f43
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Nov 4 19:21:27 2024 +0800

    [#5424] fix(paimon): remove duplicate schema names for Paimon catalog JDBC 
backend (#5436)
    
    ### What changes were proposed in this pull request?
    
    remove duplicate schema names after list schemas from Paimon
    
    ### Why are the changes needed?
    
    Fix: #5424
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    test in local env, create schema s1, create table t1, will get only one
    schema not two schemas
    
    Co-authored-by: FANNG <[email protected]>
---
 .../gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
 
b/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
index fbe6f4be4..12710a268 100644
--- 
a/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
+++ 
b/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
@@ -126,7 +126,10 @@ public class PaimonCatalogOperations implements 
CatalogOperations, SupportsSchem
    */
   @Override
   public NameIdentifier[] listSchemas(Namespace namespace) throws 
NoSuchCatalogException {
+    // Paimon JDBC catalog backend may produce duplicate schema names, remove 
the duplicate schema
+    // in Gravitino side util the bug is fixed in Paimon
     return paimonCatalogOps.listDatabases().stream()
+        .distinct()
         .map(paimonNamespace -> NameIdentifier.of(namespace, paimonNamespace))
         .toArray(NameIdentifier[]::new);
   }

Reply via email to