From 27f15fd2541879c48bf46637a90e3bb52a706291 Mon Sep 17 00:00:00 2001 From: FANNG Date: Mon, 4 Nov 2024 17:48:48 +0800 Subject: [PATCH] [#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 --- .../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 fbe6f4be49d..12710a26878 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 void initialize( */ @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); }