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

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 048882aff [core] Refactor AbstractCatalog to make 
metastoreClientFactory public (#4472)
048882aff is described below

commit 048882aff69fc05c7d5a14461d3bb0809482a557
Author: yuzelin <[email protected]>
AuthorDate: Thu Nov 7 15:42:14 2024 +0800

    [core] Refactor AbstractCatalog to make metastoreClientFactory public 
(#4472)
---
 .../org/apache/paimon/catalog/AbstractCatalog.java     | 18 +++++-------------
 .../main/java/org/apache/paimon/hive/HiveCatalog.java  |  7 +------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java 
b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
index 8e885b95c..c5cea0c21 100644
--- a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
@@ -399,27 +399,19 @@ public abstract class AbstractCatalog implements Catalog {
 
     protected Table getDataOrFormatTable(Identifier identifier) throws 
TableNotExistException {
         Preconditions.checkArgument(identifier.getSystemTableName() == null);
+        TableSchema tableSchema = getDataTableSchema(identifier);
         return FileStoreTableFactory.create(
                 fileIO,
                 getTableLocation(identifier),
-                getDataTableSchema(identifier),
+                tableSchema,
                 new CatalogEnvironment(
                         identifier,
                         Lock.factory(
                                 lockFactory().orElse(null), 
lockContext().orElse(null), identifier),
-                        metastoreClientFactory(identifier).orElse(null),
+                        metastoreClientFactory(identifier, 
tableSchema).orElse(null),
                         lineageMetaFactory));
     }
 
-    protected CatalogEnvironment catalogEnvironment(Identifier identifier)
-            throws TableNotExistException {
-        return new CatalogEnvironment(
-                identifier,
-                Lock.factory(lockFactory().orElse(null), 
lockContext().orElse(null), identifier),
-                metastoreClientFactory(identifier).orElse(null),
-                lineageMetaFactory);
-    }
-
     /**
      * Create a {@link FormatTable} identified by the given {@link Identifier}.
      *
@@ -462,8 +454,8 @@ public abstract class AbstractCatalog implements Catalog {
             throws TableNotExistException;
 
     /** Get metastore client factory for the table specified by {@code 
identifier}. */
-    protected Optional<MetastoreClient.Factory> 
metastoreClientFactory(Identifier identifier)
-            throws TableNotExistException {
+    public Optional<MetastoreClient.Factory> metastoreClientFactory(
+            Identifier identifier, TableSchema schema) {
         return Optional.empty();
     }
 
diff --git 
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
 
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
index 7c9bbde95..a1950c374 100644
--- 
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
+++ 
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
@@ -191,12 +191,7 @@ public class HiveCatalog extends AbstractCatalog {
     }
 
     @Override
-    public Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier 
identifier)
-            throws TableNotExistException {
-        return metastoreClientFactory(identifier, 
getDataTableSchema(identifier));
-    }
-
-    private Optional<MetastoreClient.Factory> metastoreClientFactory(
+    public Optional<MetastoreClient.Factory> metastoreClientFactory(
             Identifier identifier, TableSchema schema) {
         Identifier tableIdentifier =
                 new Identifier(identifier.getDatabaseName(), 
identifier.getTableName());

Reply via email to