From 07d87bce05d042c9fc1a045f7c3fb2c0babf2c48 Mon Sep 17 00:00:00 2001 From: Jingsong Date: Fri, 8 Mar 2024 11:17:24 +0800 Subject: [PATCH] [core] Fix warehouse path bug for JdbcCatalog --- .../java/org/apache/paimon/jdbc/JdbcCatalogFactory.java | 2 +- .../java/org/apache/paimon/jdbc/JdbcCatalogTest.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalogFactory.java b/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalogFactory.java index 1c791eb5e11e..ff438a8c8f85 100644 --- a/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalogFactory.java +++ b/paimon-core/src/main/java/org/apache/paimon/jdbc/JdbcCatalogFactory.java @@ -37,6 +37,6 @@ public String identifier() { @Override public Catalog create(FileIO fileIO, Path warehouse, CatalogContext context) { String catalogKey = context.options().get(JdbcCatalogOptions.CATALOG_KEY); - return new JdbcCatalog(fileIO, catalogKey, context.options().toMap(), warehouse.getName()); + return new JdbcCatalog(fileIO, catalogKey, context.options().toMap(), warehouse.toString()); } } diff --git a/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java b/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java index a9a225cf173f..5cc79fc85da3 100644 --- a/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/jdbc/JdbcCatalogTest.java @@ -42,10 +42,10 @@ public class JdbcCatalogTest extends CatalogTestBase { @BeforeEach public void setUp() throws Exception { super.setUp(); - catalog = initCatalog("test-jdbc-catalog", Maps.newHashMap()); + catalog = initCatalog(Maps.newHashMap()); } - private JdbcCatalog initCatalog(String storeKey, Map props) { + private JdbcCatalog initCatalog(Map props) { Map properties = Maps.newHashMap(); properties.put( CatalogOptions.URI.key(), @@ -56,8 +56,9 @@ private JdbcCatalog initCatalog(String storeKey, Map props) { properties.put(CatalogOptions.WAREHOUSE.key(), warehouse); properties.put(CatalogOptions.LOCK_ENABLED.key(), "true"); properties.putAll(props); - JdbcCatalog jdbcCatalog = new JdbcCatalog(fileIO, storeKey, properties, warehouse); - return jdbcCatalog; + JdbcCatalog catalog = new JdbcCatalog(fileIO, "test-jdbc-catalog", properties, warehouse); + assertThat(catalog.warehouse()).isEqualTo(warehouse); + return catalog; } @Test