This is an automated email from the ASF dual-hosted git repository.
fanng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 452d97ed2 [#5424] fix(paimon): remove duplicate schema names for
Paimon catalog JDBC backend (#5434)
452d97ed2 is described below
commit 452d97ed2ee110506404dcb234d985cbb6d98a29
Author: FANNG <[email protected]>
AuthorDate: Mon Nov 4 17:48:48 2024 +0800
[#5424] fix(paimon): remove duplicate schema names for Paimon catalog JDBC
backend (#5434)
### 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
---
.../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);
}