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

nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-paimon-webui.git


The following commit(s) were added to refs/heads/main by this push:
     new da370d7  [Improvement] Removes useless code of backend (#102)
da370d7 is described below

commit da370d7907bb4aa6dc7dd4bd51753825c22bab55
Author: s7monk <[email protected]>
AuthorDate: Wed Nov 29 11:17:51 2023 +0800

    [Improvement] Removes useless code of backend (#102)
---
 .../paimon/web/api/catalog/CatalogCreator.java     |  46 --
 .../paimon/web/api/common/CatalogEntity.java       | 110 ----
 .../apache/paimon/web/api/common/OperatorKind.java |  40 --
 .../apache/paimon/web/api/common/WriteMode.java    |  35 --
 .../paimon/web/api/database/DatabaseManager.java   |  45 --
 .../paimon/web/api/table/AlterTableEntity.java     | 137 -----
 .../apache/paimon/web/api/table/TableManager.java  | 637 ---------------------
 .../paimon/web/api/table/TableOptionExtractor.java |  70 ---
 .../paimon/web/api/catalog/CatalogCreatorTest.java |  40 --
 .../web/api/database/DatabaseManagerTest.java      |  94 ---
 .../paimon/web/api/table/TableManagerTest.java     | 222 -------
 .../web/common/utils/ParameterValidationUtil.java  |  35 --
 .../server/service/impl/MetadataServiceImpl.java   |  14 +-
 13 files changed, 4 insertions(+), 1521 deletions(-)

diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/catalog/CatalogCreator.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/catalog/CatalogCreator.java
deleted file mode 100644
index 5710a23..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/catalog/CatalogCreator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.catalog;
-
-import org.apache.paimon.catalog.Catalog;
-import org.apache.paimon.catalog.CatalogContext;
-import org.apache.paimon.catalog.CatalogFactory;
-import org.apache.paimon.fs.Path;
-import org.apache.paimon.options.Options;
-import org.apache.paimon.web.api.common.CatalogProperties;
-import org.apache.paimon.web.api.common.MetastoreType;
-
-/** paimon catalog creator. */
-public class CatalogCreator {
-
-    public static Catalog createFilesystemCatalog(String path) {
-        CatalogContext context = CatalogContext.create(new Path(path));
-        return CatalogFactory.createCatalog(context);
-    }
-
-    public static Catalog createHiveCatalog(String warehouse, String uri, 
String hiveConfDir) {
-        Options options = new Options();
-        options.set(CatalogProperties.WAREHOUSE, warehouse);
-        options.set(CatalogProperties.METASTORE, 
MetastoreType.HIVE.toString());
-        options.set(CatalogProperties.URI, uri);
-        options.set(CatalogProperties.HIVE_CONF_DIR, hiveConfDir);
-        CatalogContext context = CatalogContext.create(options);
-        return CatalogFactory.createCatalog(context);
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/CatalogEntity.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/CatalogEntity.java
deleted file mode 100644
index f7601ee..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/CatalogEntity.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.common;
-
-import javax.annotation.Nullable;
-
-/** catalog entity. */
-public class CatalogEntity {
-
-    private final Long catalogId;
-
-    private final String warehouse;
-
-    private final String metastoreType;
-
-    private final String uri;
-
-    private final String hiveConfDir;
-
-    public CatalogEntity(
-            Long catalogId,
-            String warehouse,
-            String metastoreType,
-            String uri,
-            String hiveConfDir) {
-        this.catalogId = catalogId;
-        this.warehouse = warehouse;
-        this.metastoreType = metastoreType;
-        this.uri = uri;
-        this.hiveConfDir = hiveConfDir;
-    }
-
-    public Long getCatalogId() {
-        return catalogId;
-    }
-
-    public String getWarehouse() {
-        return warehouse;
-    }
-
-    public String getMetastoreType() {
-        return metastoreType;
-    }
-
-    public String getUri() {
-        return uri;
-    }
-
-    public String getHiveConfDir() {
-        return hiveConfDir;
-    }
-
-    public static CatalogEntity.Builder builder() {
-        return new Builder();
-    }
-
-    /** The builder for CatalogEntity. */
-    public static final class Builder {
-        private Long catalogId;
-        private String warehouse;
-        private String metastoreType;
-        @Nullable private String uri;
-        @Nullable private String hiveConfDir;
-
-        public Builder catalogId(Long catalogId) {
-            this.catalogId = catalogId;
-            return this;
-        }
-
-        public Builder warehouse(String warehouse) {
-            this.warehouse = warehouse;
-            return this;
-        }
-
-        public Builder metastoreType(String metastoreType) {
-            this.metastoreType = metastoreType;
-            return this;
-        }
-
-        public Builder uri(String uri) {
-            this.uri = uri;
-            return this;
-        }
-
-        public Builder hiveConfDir(String hiveConfDir) {
-            this.hiveConfDir = hiveConfDir;
-            return this;
-        }
-
-        public CatalogEntity build() {
-            return new CatalogEntity(catalogId, warehouse, metastoreType, uri, 
hiveConfDir);
-        }
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/OperatorKind.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/OperatorKind.java
deleted file mode 100644
index f979ce8..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/OperatorKind.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.common;
-
-/** Enum of operator kind. */
-public enum OperatorKind {
-    ADD_COLUMN("add"),
-    RENAME_COLUMN("rename"),
-    DROP_COLUMN("drop"),
-    UPDATE_COLUMN_COMMENT("update_comment"),
-    UPDATE_COLUMN_TYPE("update_type"),
-    UPDATE_COLUMN_POSITION("update_position"),
-    UPDATE_COLUMN_NULLABILITY("update_nullability");
-
-    private final String value;
-
-    OperatorKind(String value) {
-        this.value = value;
-    }
-
-    public String value() {
-        return value;
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/WriteMode.java 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/WriteMode.java
deleted file mode 100644
index a6a2ce4..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/common/WriteMode.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.common;
-
-/** Enum of write mode. */
-public enum WriteMode {
-    STREAM("stream"),
-    BATCH("batch");
-
-    private final String value;
-
-    WriteMode(String value) {
-        this.value = value;
-    }
-
-    public String getValue() {
-        return value;
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/database/DatabaseManager.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/database/DatabaseManager.java
deleted file mode 100644
index d4f8de6..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/database/DatabaseManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.database;
-
-import org.apache.paimon.catalog.Catalog;
-
-import java.util.List;
-
-/** paimon database manager. */
-public class DatabaseManager {
-
-    public static void createDatabase(Catalog catalog, String name)
-            throws Catalog.DatabaseAlreadyExistException {
-        catalog.createDatabase(name, false);
-    }
-
-    public static boolean databaseExists(Catalog catalog, String name) {
-        return catalog.databaseExists(name);
-    }
-
-    public static List<String> listDatabase(Catalog catalog) {
-        return catalog.listDatabases();
-    }
-
-    public static void dropDatabase(Catalog catalog, String name)
-            throws Catalog.DatabaseNotEmptyException, 
Catalog.DatabaseNotExistException {
-        catalog.dropDatabase(name, false, true);
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/AlterTableEntity.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/AlterTableEntity.java
deleted file mode 100644
index 9508d00..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/AlterTableEntity.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.table;
-
-import org.apache.paimon.schema.SchemaChange;
-import org.apache.paimon.types.DataType;
-import org.apache.paimon.web.api.common.OperatorKind;
-
-import javax.annotation.Nullable;
-
-/** alter table entity. */
-public class AlterTableEntity {
-
-    private final String columnName;
-    private final DataType type;
-    private final String comment;
-    private final String newColumn;
-    private final boolean isNullable;
-    private final SchemaChange.Move move;
-    private final OperatorKind kind;
-
-    public AlterTableEntity(
-            String columnName,
-            DataType type,
-            String comment,
-            String newColumn,
-            boolean isNullable,
-            SchemaChange.Move move,
-            OperatorKind kind) {
-        this.columnName = columnName;
-        this.type = type;
-        this.comment = comment;
-        this.newColumn = newColumn;
-        this.isNullable = isNullable;
-        this.move = move;
-        this.kind = kind;
-    }
-
-    public String getColumnName() {
-        return columnName;
-    }
-
-    public DataType getType() {
-        return type;
-    }
-
-    public String getComment() {
-        return comment;
-    }
-
-    public String getNewColumn() {
-        return newColumn;
-    }
-
-    public boolean isNullable() {
-        return isNullable;
-    }
-
-    public SchemaChange.Move getMove() {
-        return move;
-    }
-
-    public OperatorKind getKind() {
-        return kind;
-    }
-
-    public static AlterTableEntity.Builder builder() {
-        return new Builder();
-    }
-
-    /** The builder for AlterTableEntity. */
-    public static class Builder {
-        private String columnName;
-        @Nullable private DataType type;
-        @Nullable private String comment;
-        @Nullable private String newColumn;
-        @Nullable private boolean isNullable;
-        @Nullable private SchemaChange.Move move;
-        private OperatorKind kind;
-
-        public Builder columnName(String columnName) {
-            this.columnName = columnName;
-            return this;
-        }
-
-        public Builder type(DataType type) {
-            this.type = type;
-            return this;
-        }
-
-        public Builder comment(String comment) {
-            this.comment = comment;
-            return this;
-        }
-
-        public Builder newColumn(String newColumn) {
-            this.newColumn = newColumn;
-            return this;
-        }
-
-        public Builder nullable(boolean isNullable) {
-            this.isNullable = isNullable;
-            return this;
-        }
-
-        public Builder move(SchemaChange.Move move) {
-            this.move = move;
-            return this;
-        }
-
-        public Builder kind(OperatorKind kind) {
-            this.kind = kind;
-            return this;
-        }
-
-        public AlterTableEntity build() {
-            return new AlterTableEntity(
-                    columnName, type, comment, newColumn, isNullable, move, 
kind);
-        }
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableManager.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableManager.java
deleted file mode 100644
index 24f1384..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableManager.java
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.table;
-
-import org.apache.paimon.catalog.Catalog;
-import org.apache.paimon.catalog.CatalogContext;
-import org.apache.paimon.catalog.FileSystemCatalog;
-import org.apache.paimon.catalog.Identifier;
-import org.apache.paimon.data.GenericRow;
-import org.apache.paimon.data.InternalRow;
-import org.apache.paimon.fs.FileIO;
-import org.apache.paimon.fs.Path;
-import org.apache.paimon.hive.HiveCatalog;
-import org.apache.paimon.options.Options;
-import org.apache.paimon.reader.RecordReader;
-import org.apache.paimon.schema.Schema;
-import org.apache.paimon.schema.SchemaChange;
-import org.apache.paimon.table.Table;
-import org.apache.paimon.table.sink.BatchTableCommit;
-import org.apache.paimon.table.sink.BatchTableWrite;
-import org.apache.paimon.table.sink.BatchWriteBuilder;
-import org.apache.paimon.table.sink.CommitMessage;
-import org.apache.paimon.table.sink.StreamWriteBuilder;
-import org.apache.paimon.table.sink.TableWrite;
-import org.apache.paimon.table.sink.WriteBuilder;
-import org.apache.paimon.table.source.ReadBuilder;
-import org.apache.paimon.table.source.Split;
-import org.apache.paimon.table.source.TableRead;
-import org.apache.paimon.utils.SnapshotManager;
-import org.apache.paimon.web.api.common.CatalogEntity;
-import org.apache.paimon.web.api.common.CatalogProperties;
-import org.apache.paimon.web.api.common.MetastoreType;
-import org.apache.paimon.web.api.common.OperatorKind;
-import org.apache.paimon.web.api.common.WriteMode;
-import org.apache.paimon.web.api.table.metadata.ColumnMetadata;
-import org.apache.paimon.web.api.table.metadata.ConsumerTableMetadata;
-import org.apache.paimon.web.api.table.metadata.FileTableMetadata;
-import org.apache.paimon.web.api.table.metadata.ManifestTableMetadata;
-import org.apache.paimon.web.api.table.metadata.OptionTableMetadata;
-import org.apache.paimon.web.api.table.metadata.SchemaTableMetadata;
-import org.apache.paimon.web.api.table.metadata.SnapshotTableMetadata;
-import org.apache.paimon.web.api.table.metadata.TableMetadata;
-import org.apache.paimon.web.api.table.metadata.TagTableMetadata;
-import org.apache.paimon.web.common.annotation.VisibleForTesting;
-import org.apache.paimon.web.common.utils.ParameterValidationUtil;
-
-import com.google.common.collect.ImmutableList;
-
-import javax.annotation.Nullable;
-
-import java.io.IOException;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** paimon table manager. */
-public class TableManager {
-
-    private static final String SNAPSHOTS = "snapshots";
-    private static final String SCHEMAS = "schemas";
-    private static final String OPTIONS = "options";
-    private static final String MANIFESTS = "manifests";
-    private static final String FILES = "files";
-    private static final String CONSUMER = "consumers";
-    private static final String TAGS = "tags";
-
-    public static void createTable(
-            Catalog catalog, String dbName, String tableName, TableMetadata 
tableMetadata)
-            throws Catalog.TableAlreadyExistException, 
Catalog.DatabaseNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Schema.Builder schemaBuilder =
-                Schema.newBuilder()
-                        .partitionKeys(
-                                tableMetadata.partitionKeys() == null
-                                        ? ImmutableList.of()
-                                        : 
ImmutableList.copyOf(tableMetadata.partitionKeys()))
-                        .primaryKey(
-                                tableMetadata.primaryKeys() == null
-                                        ? ImmutableList.of()
-                                        : 
ImmutableList.copyOf(tableMetadata.primaryKeys()))
-                        .comment(tableMetadata.comment() == null ? "" : 
tableMetadata.comment())
-                        .options(handleOptions(tableMetadata.options()));
-
-        for (ColumnMetadata column : tableMetadata.columns()) {
-            schemaBuilder.column(column.name(), column.type(), 
column.description());
-        }
-
-        Schema schema = schemaBuilder.build();
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-
-        catalog.createTable(identifier, schema, false);
-    }
-
-    public static boolean tableExists(Catalog catalog, String dbName, String 
tableName) {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-        return catalog.tableExists(identifier);
-    }
-
-    public static Table getTable(Catalog catalog, String dbName, String 
tableName)
-            throws Catalog.TableNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-        return catalog.getTable(identifier);
-    }
-
-    public static List<String> listTables(Catalog catalog, String dbName)
-            throws Catalog.DatabaseNotExistException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"));
-        return catalog.listTables(dbName);
-    }
-
-    public static void dropTable(Catalog catalog, String dbName, String 
tableName)
-            throws Catalog.TableNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-        catalog.dropTable(identifier, false);
-    }
-
-    public static void renameTable(Catalog catalog, String dbName, String 
fromTable, String toTable)
-            throws Catalog.TableAlreadyExistException, 
Catalog.TableNotExistException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(fromTable, () -> "From table name"),
-                new SimpleEntry<>(toTable, () -> "To table name"));
-
-        Identifier fromTableIdentifier = Identifier.create(dbName, fromTable);
-        Identifier toTableIdentifier = Identifier.create(dbName, toTable);
-        catalog.renameTable(fromTableIdentifier, toTableIdentifier, false);
-    }
-
-    public static void setOptions(
-            Catalog catalog, String dbName, String tableName, Map<String, 
String> options)
-            throws Catalog.ColumnAlreadyExistException, 
Catalog.TableNotExistException,
-                    Catalog.ColumnNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-
-        List<SchemaChange> schemaChanges = new ArrayList<>();
-
-        Map<String, String> filteredOptions = handleOptions(options);
-        for (String key : filteredOptions.keySet()) {
-            SchemaChange addOption = SchemaChange.setOption(key, 
filteredOptions.get(key));
-            schemaChanges.add(addOption);
-        }
-
-        catalog.alterTable(identifier, schemaChanges, false);
-    }
-
-    public static void removeOptions(
-            Catalog catalog, String dbName, String tableName, Map<String, 
String> options)
-            throws Catalog.ColumnAlreadyExistException, 
Catalog.TableNotExistException,
-                    Catalog.ColumnNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-
-        List<SchemaChange> schemaChanges = new ArrayList<>();
-
-        Map<String, String> filteredOptions = handleOptions(options);
-        for (String key : filteredOptions.keySet()) {
-            SchemaChange addOption = SchemaChange.removeOption(key);
-            schemaChanges.add(addOption);
-        }
-
-        catalog.alterTable(identifier, schemaChanges, false);
-    }
-
-    private static SchemaChange addColumn(AlterTableEntity entity) {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(entity.getType(), () -> "Column type"));
-        return SchemaChange.addColumn(
-                entity.getColumnName(), entity.getType(), entity.getComment());
-    }
-
-    private static SchemaChange renameColumn(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(entity.getNewColumn(), () -> "New column 
name"),
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-        validateColumnExistence(catalog, dbName, tableName, 
entity.getColumnName());
-        return SchemaChange.renameColumn(entity.getColumnName(), 
entity.getNewColumn());
-    }
-
-    private static SchemaChange dropColumn(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-        validateColumnExistence(catalog, dbName, tableName, 
entity.getColumnName());
-        return SchemaChange.dropColumn(entity.getColumnName());
-    }
-
-    private static SchemaChange updateColumnComment(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-        validateColumnExistence(catalog, dbName, tableName, 
entity.getColumnName());
-        return SchemaChange.updateColumnComment(entity.getColumnName(), 
entity.getComment());
-    }
-
-    private static SchemaChange updateColumnType(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(entity.getType(), () -> "Column type"),
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-        validateColumnExistence(catalog, dbName, tableName, 
entity.getColumnName());
-        return SchemaChange.updateColumnType(entity.getColumnName(), 
entity.getType());
-    }
-
-    private static SchemaChange updateColumnPosition(AlterTableEntity entity) {
-        ParameterValidationUtil.checkNotNull(new 
SimpleEntry<>(entity.getMove(), () -> "Move"));
-        return SchemaChange.updateColumnPosition(entity.getMove());
-    }
-
-    private static SchemaChange updateColumnNullability(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(entity.getColumnName(), () -> "Column name"),
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-        validateColumnExistence(catalog, dbName, tableName, 
entity.getColumnName());
-        return SchemaChange.updateColumnNullability(entity.getColumnName(), 
entity.isNullable());
-    }
-
-    private static SchemaChange performAlterTableAction(
-            Catalog catalog, String dbName, String tableName, AlterTableEntity 
entity)
-            throws Catalog.TableNotExistException, IOException {
-        OperatorKind kind = entity.getKind();
-
-        switch (kind) {
-            case ADD_COLUMN:
-                return addColumn(entity);
-            case RENAME_COLUMN:
-                return renameColumn(catalog, dbName, tableName, entity);
-            case DROP_COLUMN:
-                return dropColumn(catalog, dbName, tableName, entity);
-            case UPDATE_COLUMN_COMMENT:
-                return updateColumnComment(catalog, dbName, tableName, entity);
-            case UPDATE_COLUMN_TYPE:
-                return updateColumnType(catalog, dbName, tableName, entity);
-            case UPDATE_COLUMN_POSITION:
-                return updateColumnPosition(entity);
-            case UPDATE_COLUMN_NULLABILITY:
-                return updateColumnNullability(catalog, dbName, tableName, 
entity);
-            default:
-                return null;
-        }
-    }
-
-    public static void alterTable(
-            Catalog catalog, String dbName, String tableName, 
List<AlterTableEntity> entities)
-            throws Catalog.TableNotExistException, IOException, 
Catalog.ColumnAlreadyExistException,
-                    Catalog.ColumnNotExistException {
-        checkNotNull(catalog, dbName, tableName);
-
-        Identifier identifier = Identifier.create(dbName, tableName);
-
-        List<SchemaChange> schemaChanges = new ArrayList<>();
-
-        for (AlterTableEntity entity : entities) {
-            SchemaChange schemaChange = performAlterTableAction(catalog, 
dbName, tableName, entity);
-            schemaChanges.add(schemaChange);
-        }
-
-        catalog.alterTable(identifier, schemaChanges, false);
-    }
-
-    @VisibleForTesting
-    private static SchemaTableMetadata getLatestSchema(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        List<SchemaTableMetadata> schemas = listSchemas(catalog, dbName, 
tableName);
-        return schemas.stream()
-                
.max(Comparator.comparingLong(SchemaTableMetadata::getSchemaId))
-                .orElse(null);
-    }
-
-    public static List<SnapshotTableMetadata> listSnapshots(
-            Catalog catalog, CatalogEntity catalogEntity, String dbName, 
String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<SnapshotTableMetadata> snapshots = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + 
SNAPSHOTS + "`");
-
-        SnapshotManager snapshotManager =
-                getSnapshotManager(catalog, catalogEntity, dbName, tableName);
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    SnapshotTableMetadata snapshotTableMetadata =
-                            SnapshotTableMetadata.builder()
-                                    .snapshotId(row.getLong(1))
-                                    .schemaId(row.getLong(2))
-                                    .commitUser(row.getString(3).toString())
-                                    .commitIdentifier(row.getLong(4))
-                                    .commitKind(row.getString(5).toString())
-                                    .commitTime(row.getTimestamp(6, 
3).toLocalDateTime())
-                                    .totalRecordCount(row.getLong(7))
-                                    .deltaRecordCount(row.getLong(8))
-                                    .changelogRecordCount(row.getLong(9))
-                                    .watermark(row.getLong(10))
-                                    .snapshotPath(
-                                            
snapshotManager.snapshotPath(row.getLong(1)).toString())
-                                    .build();
-                    snapshots.add(snapshotTableMetadata);
-                });
-
-        return snapshots;
-    }
-
-    public static List<SchemaTableMetadata> listSchemas(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<SchemaTableMetadata> schemas = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + 
SCHEMAS + "`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    SchemaTableMetadata schemaTableMetadata =
-                            SchemaTableMetadata.builder()
-                                    .schemaId(row.getLong(1))
-                                    .fields(row.getString(2).toString())
-                                    .partitionKeys(row.getString(3).toString())
-                                    .primaryKeys(row.getString(4).toString())
-                                    .options(row.getString(5).toString())
-                                    .comment(row.getString(6).toString())
-                                    .build();
-                    schemas.add(schemaTableMetadata);
-                });
-
-        return schemas;
-    }
-
-    public static List<OptionTableMetadata> listOptions(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<OptionTableMetadata> options = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + 
OPTIONS + "`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    OptionTableMetadata optionsTableMetadata =
-                            new OptionTableMetadata(
-                                    row.getString(1).toString(), 
row.getString(2).toString());
-                    options.add(optionsTableMetadata);
-                });
-
-        return options;
-    }
-
-    public static List<ManifestTableMetadata> listManifests(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<ManifestTableMetadata> manifests = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + 
MANIFESTS + "`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    ManifestTableMetadata manifestTableMetadata =
-                            ManifestTableMetadata.builder()
-                                    .fileName(row.getString(1).toString())
-                                    .fileSize(row.getLong(2))
-                                    .numAddedFiles(row.getLong(3))
-                                    .numDeletedFiles(row.getLong(4))
-                                    .schemaId(row.getLong(5))
-                                    .build();
-                    manifests.add(manifestTableMetadata);
-                });
-
-        return manifests;
-    }
-
-    public static List<FileTableMetadata> listFiles(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<FileTableMetadata> files = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + FILES 
+ "`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    FileTableMetadata fileTableMetadata =
-                            FileTableMetadata.builder()
-                                    .partition(row.getString(1).toString())
-                                    .bucket(row.getInt(2))
-                                    .filePath(row.getString(3).toString())
-                                    .fileFormat(row.getString(4).toString())
-                                    .schemaId(row.getLong(5))
-                                    .level(row.getInt(6))
-                                    .fileSizeInBytes(row.getLong(7))
-                                    .minKey(row.getString(8).toString())
-                                    .maxKey(row.getString(9).toString())
-                                    
.nullValueCounts(row.getString(10).toString())
-                                    
.minValueStats(row.getString(11).toString())
-                                    
.maxValueStats(row.getString(12).toString())
-                                    .creationTime(row.getTimestamp(13, 
6).toLocalDateTime())
-                                    .build();
-                    files.add(fileTableMetadata);
-                });
-
-        return files;
-    }
-
-    public static List<ConsumerTableMetadata> listConsumers(
-            Catalog catalog, String dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<ConsumerTableMetadata> consumers = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + 
CONSUMER + "`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-
-        reader.forEachRemaining(
-                row -> {
-                    ConsumerTableMetadata consumerTableMetadata =
-                            new 
ConsumerTableMetadata(row.getString(1).toString(), row.getLong(2));
-                    consumers.add(consumerTableMetadata);
-                });
-        return consumers;
-    }
-
-    public static List<TagTableMetadata> listTags(Catalog catalog, String 
dbName, String tableName)
-            throws Catalog.TableNotExistException, IOException {
-        checkNotNull(catalog, dbName, tableName);
-
-        List<TagTableMetadata> tags = new ArrayList<>();
-
-        Table table = getTable(catalog, dbName, "`" + tableName + "$" + TAGS + 
"`");
-
-        RecordReader<InternalRow> reader = getReader(table);
-        reader.forEachRemaining(
-                row -> {
-                    TagTableMetadata tagTableMetadata =
-                            TagTableMetadata.builder()
-                                    .tagName(row.getString(1).toString())
-                                    .snapshotId(row.getLong(2))
-                                    .schemaId(row.getLong(3))
-                                    .createTime(row.getTimestamp(4, 
3).toLocalDateTime())
-                                    .recordCount(row.getLong(5))
-                                    .build();
-                    tags.add(tagTableMetadata);
-                });
-
-        return tags;
-    }
-
-    @VisibleForTesting
-    private static SnapshotManager getSnapshotManager(
-            Catalog catalog, CatalogEntity catalogEntity, String dbName, 
String tableName)
-            throws IOException {
-        String warehouse = catalogEntity.getWarehouse();
-
-        FileIO fileIO =
-                FileIO.get(
-                        new Path(warehouse),
-                        CatalogContext.create(buildOptions(catalog, 
catalogEntity)));
-
-        String tablePath = warehouse + "/" + dbName + ".db" + "/" + tableName;
-        return new SnapshotManager(fileIO, new Path(tablePath));
-    }
-
-    private static Options buildOptions(Catalog catalog, CatalogEntity 
catalogEntity) {
-        Options options = new Options();
-        if (catalog instanceof FileSystemCatalog) {
-            options.set(CatalogProperties.WAREHOUSE, 
catalogEntity.getWarehouse());
-        } else if (catalog instanceof HiveCatalog) {
-            options.set(CatalogProperties.WAREHOUSE, 
catalogEntity.getWarehouse());
-            options.set(CatalogProperties.METASTORE, 
MetastoreType.HIVE.toString());
-            options.set(CatalogProperties.URI, catalogEntity.getUri());
-            options.set(CatalogProperties.HIVE_CONF_DIR, 
catalogEntity.getHiveConfDir());
-        }
-        return options;
-    }
-
-    @VisibleForTesting
-    private static RecordReader<InternalRow> getReader(Table table) {
-        ReadBuilder readBuilder = table.newReadBuilder();
-        List<Split> splits = readBuilder.newScan().plan().splits();
-        TableRead tableRead = readBuilder.newRead();
-        try {
-            return tableRead.createReader(splits);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @VisibleForTesting
-    private static WriteBuilder getWriteBuilder(
-            Table table, String writeMode, @Nullable Map<String, String> 
staticPartition) {
-        if (writeMode.equals(WriteMode.BATCH.getValue())) {
-            return table.newBatchWriteBuilder().withOverwrite(staticPartition);
-        } else {
-            return table.newStreamWriteBuilder();
-        }
-    }
-
-    public static TableWrite getBatchTableWriter(
-            Table table, @Nullable Map<String, String> staticPartition) {
-        BatchWriteBuilder writeBuilder =
-                (BatchWriteBuilder)
-                        getWriteBuilder(table, WriteMode.BATCH.getValue(), 
staticPartition);
-        return writeBuilder.newWrite();
-    }
-
-    public static TableWrite getStreamTableWriter(Table table) {
-        StreamWriteBuilder writeBuilder =
-                (StreamWriteBuilder) getWriteBuilder(table, 
WriteMode.STREAM.getValue(), null);
-        return writeBuilder.newWrite();
-    }
-
-    public static void batchWrite(
-            List<GenericRow> records,
-            Catalog catalog,
-            String dbName,
-            String tableName,
-            @Nullable Map<String, String> staticPartition)
-            throws Exception {
-        checkNotNull(catalog, dbName, tableName);
-
-        BatchWriteBuilder writeBuilder =
-                (BatchWriteBuilder)
-                        getWriteBuilder(
-                                getTable(catalog, dbName, tableName),
-                                WriteMode.BATCH.getValue(),
-                                staticPartition);
-
-        List<CommitMessage> commitMessages;
-        try (BatchTableWrite writer = writeBuilder.newWrite()) {
-
-            for (GenericRow record : records) {
-                writer.write(record);
-            }
-
-            commitMessages = writer.prepareCommit();
-        }
-
-        try (BatchTableCommit commit = writeBuilder.newCommit()) {
-            commit.commit(commitMessages);
-        }
-    }
-
-    private static void checkNotNull(Catalog catalog, String dbName, String 
tableName) {
-        ParameterValidationUtil.checkNotNull(
-                new SimpleEntry<>(catalog, () -> "Catalog"),
-                new SimpleEntry<>(dbName, () -> "Database name"),
-                new SimpleEntry<>(tableName, () -> "Table name"));
-    }
-
-    private static void validateColumnExistence(
-            Catalog catalog, String dbName, String tableName, String 
columnName)
-            throws Catalog.TableNotExistException, IOException {
-        SchemaTableMetadata latestSchema = getLatestSchema(catalog, dbName, 
tableName);
-        if (!latestSchema.getFields().contains(columnName)) {
-            throw new RuntimeException("Column not found: " + columnName);
-        }
-    }
-
-    private static Map<String, String> handleOptions(Map<String, String> 
options) {
-        List<String> keys = TableOptionExtractor.keys();
-        Map<String, String> filteredOptions = new HashMap<>();
-
-        for (String key : options.keySet()) {
-            if (keys.contains(key)) {
-                filteredOptions.put(key, options.get(key));
-            }
-        }
-
-        return filteredOptions;
-    }
-}
diff --git 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableOptionExtractor.java
 
b/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableOptionExtractor.java
deleted file mode 100644
index 972bd45..0000000
--- 
a/paimon-web-api/src/main/java/org/apache/paimon/web/api/table/TableOptionExtractor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.table;
-
-import org.apache.paimon.CoreOptions;
-import org.apache.paimon.options.ConfigOption;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
-/** table option extractor. */
-public class TableOptionExtractor {
-
-    public static List<String> keys() {
-        List<OptionWithMetaInfo> optionWithMetaInfos = 
extractConfigOptions(CoreOptions.class);
-        List<String> keys = new ArrayList<>();
-        for (OptionWithMetaInfo optionWithMetaInfo : optionWithMetaInfos) {
-            keys.add(optionWithMetaInfo.option.key());
-        }
-        return keys;
-    }
-
-    public static List<OptionWithMetaInfo> extractConfigOptions(Class<?> 
clazz) {
-        try {
-            List<OptionWithMetaInfo> configOptions = new ArrayList<>(8);
-            Field[] fields = clazz.getFields();
-            for (Field field : fields) {
-                if (isConfigOption(field)) {
-                    configOptions.add(
-                            new OptionWithMetaInfo((ConfigOption<?>) 
field.get(null), field));
-                }
-            }
-            return configOptions;
-        } catch (Exception e) {
-            throw new RuntimeException(
-                    "Failed to extract config options from class " + clazz + 
'.', e);
-        }
-    }
-
-    private static boolean isConfigOption(Field field) {
-        return field.getType().equals(ConfigOption.class);
-    }
-
-    static class OptionWithMetaInfo {
-        final ConfigOption<?> option;
-        final Field field;
-
-        public OptionWithMetaInfo(ConfigOption<?> option, Field field) {
-            this.option = option;
-            this.field = field;
-        }
-    }
-}
diff --git 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/catalog/CatalogCreatorTest.java
 
b/paimon-web-api/src/test/java/org/apache/paimon/web/api/catalog/CatalogCreatorTest.java
deleted file mode 100644
index 11e6982..0000000
--- 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/catalog/CatalogCreatorTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.catalog;
-
-import org.apache.paimon.catalog.Catalog;
-import org.apache.paimon.catalog.FileSystemCatalog;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/** The test class of catalog creator in {@link CatalogCreator}. */
-public class CatalogCreatorTest {
-
-    @TempDir java.nio.file.Path tempFile;
-
-    @Test
-    public void testCreateFileSystemCatalog() {
-        String warehouse = tempFile.toUri().toString();
-        Catalog catalog = CatalogCreator.createFilesystemCatalog(warehouse);
-        assertThat(catalog).isInstanceOf(FileSystemCatalog.class);
-    }
-}
diff --git 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/database/DatabaseManagerTest.java
 
b/paimon-web-api/src/test/java/org/apache/paimon/web/api/database/DatabaseManagerTest.java
deleted file mode 100644
index 095f5a5..0000000
--- 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/database/DatabaseManagerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.database;
-
-import org.apache.paimon.catalog.Catalog;
-import org.apache.paimon.web.api.catalog.CatalogCreator;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-
-/** The test class of database manager in {@link DatabaseManager}. */
-public class DatabaseManagerTest {
-
-    @TempDir java.nio.file.Path tempFile;
-    Catalog catalog;
-
-    @BeforeEach
-    public void setUp() {
-        String warehouse = tempFile.toUri().toString();
-        catalog = CatalogCreator.createFilesystemCatalog(warehouse);
-    }
-
-    @AfterEach
-    public void tearDown() throws Exception {
-        if (catalog != null) {
-            catalog.close();
-        }
-    }
-
-    @Test
-    public void testDatabaseExists() throws 
Catalog.DatabaseAlreadyExistException {
-        DatabaseManager.createDatabase(catalog, "db_01");
-        boolean exists = DatabaseManager.databaseExists(catalog, "db_01");
-        assertThat(exists).isTrue();
-    }
-
-    @Test
-    public void testCreateDatabase() throws 
Catalog.DatabaseAlreadyExistException {
-        DatabaseManager.createDatabase(catalog, "db_01");
-        boolean exists = catalog.databaseExists("db_01");
-        assertThat(exists).isTrue();
-
-        //  Create database throws DatabaseAlreadyExistException when database 
already exists
-        assertThatExceptionOfType(Catalog.DatabaseAlreadyExistException.class)
-                .isThrownBy(() -> catalog.createDatabase("db_01", false))
-                .withMessage("Database db_01 already exists.");
-    }
-
-    @Test
-    public void testDropDatabase() throws Exception {
-        DatabaseManager.createDatabase(catalog, "db_01");
-        DatabaseManager.dropDatabase(catalog, "db_01");
-        boolean exists = catalog.databaseExists("db_01");
-        assertThat(exists).isFalse();
-
-        // Drop database throws DatabaseNotExistException when database does 
not exist
-        assertThatExceptionOfType(Catalog.DatabaseNotExistException.class)
-                .isThrownBy(() -> DatabaseManager.dropDatabase(catalog, 
"db_04"))
-                .withMessage("Database db_04 does not exist.");
-    }
-
-    @Test
-    public void testListDatabase() throws 
Catalog.DatabaseAlreadyExistException {
-        DatabaseManager.createDatabase(catalog, "db_01");
-        DatabaseManager.createDatabase(catalog, "db_02");
-        DatabaseManager.createDatabase(catalog, "db_03");
-
-        List<String> dbs = DatabaseManager.listDatabase(catalog);
-        assertThat(dbs).contains("db_01", "db_02", "db_03");
-    }
-}
diff --git 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/table/TableManagerTest.java
 
b/paimon-web-api/src/test/java/org/apache/paimon/web/api/table/TableManagerTest.java
deleted file mode 100644
index 19853dd..0000000
--- 
a/paimon-web-api/src/test/java/org/apache/paimon/web/api/table/TableManagerTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.api.table;
-
-import org.apache.paimon.catalog.Catalog;
-import org.apache.paimon.table.Table;
-import org.apache.paimon.types.DataTypes;
-import org.apache.paimon.web.api.catalog.CatalogCreator;
-import org.apache.paimon.web.api.database.DatabaseManager;
-import org.apache.paimon.web.api.table.metadata.ColumnMetadata;
-import org.apache.paimon.web.api.table.metadata.TableMetadata;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-
-/** The test class of table manager in {@link TableManager}. */
-public class TableManagerTest {
-
-    @TempDir java.nio.file.Path tempFile;
-    Catalog catalog;
-    private static final String DB_NAME = "test_db";
-    private static final String TABLE_NAME = "test_table";
-    private static final String DEFAULT_TABLE = "default_table";
-
-    @BeforeEach
-    public void setUp() throws Exception {
-        String warehouse = tempFile.toUri().toString();
-        catalog = CatalogCreator.createFilesystemCatalog(warehouse);
-        DatabaseManager.createDatabase(catalog, DB_NAME);
-        TableManager.createTable(
-                catalog,
-                DB_NAME,
-                DEFAULT_TABLE,
-                new TableMetadata(
-                        Lists.newArrayList(new ColumnMetadata("id", 
DataTypes.STRING(), "")),
-                        ImmutableList.of(),
-                        ImmutableList.of(),
-                        ImmutableMap.of(),
-                        ""));
-    }
-
-    @AfterEach
-    public void tearDown() throws Exception {
-        if (catalog != null) {
-            catalog.close();
-        }
-    }
-
-    @Test
-    public void testTableExists() {
-        boolean exists = TableManager.tableExists(catalog, DB_NAME, 
TABLE_NAME);
-        assertThat(exists).isFalse();
-        assertThat(TableManager.tableExists(catalog, DB_NAME, 
DEFAULT_TABLE)).isTrue();
-    }
-
-    @Test
-    public void testCreateTable()
-            throws Catalog.TableAlreadyExistException, 
Catalog.DatabaseNotExistException {
-        ArrayList<ColumnMetadata> columns =
-                Lists.newArrayList(
-                        new ColumnMetadata("id", DataTypes.BIGINT()),
-                        new ColumnMetadata("name", DataTypes.STRING()),
-                        new ColumnMetadata("age", DataTypes.INT()),
-                        new ColumnMetadata("birth", DataTypes.DATE()));
-
-        ArrayList<String> primaryKeys = Lists.newArrayList("id", "birth");
-
-        ArrayList<String> partitionKeys = Lists.newArrayList("birth");
-
-        Map<String, String> options =
-                ImmutableMap.of(
-                        "bucket", "4",
-                        "changelog-producer", "input");
-
-        TableMetadata tableMetadata =
-                TableMetadata.builder()
-                        .columns(columns)
-                        .partitionKeys(partitionKeys)
-                        .primaryKeys(primaryKeys)
-                        .options(options)
-                        .build();
-
-        TableManager.createTable(catalog, DB_NAME, TABLE_NAME, tableMetadata);
-        boolean exists = TableManager.tableExists(catalog, DB_NAME, 
TABLE_NAME);
-        assertThat(exists).isTrue();
-
-        // Create table throws Exception when table is system table
-        assertThatExceptionOfType(IllegalArgumentException.class)
-                .isThrownBy(
-                        () ->
-                                TableManager.createTable(
-                                        catalog, DB_NAME, "$system_table", 
tableMetadata))
-                .withMessage(
-                        "Cannot 'createTable' for system table 
'Identifier{database='test_db', table='$system_table'}', please use data 
table.");
-
-        // Create table throws DatabaseNotExistException when database does 
not exist
-        assertThatExceptionOfType(Catalog.DatabaseNotExistException.class)
-                .isThrownBy(
-                        () -> TableManager.createTable(catalog, "db_01", 
TABLE_NAME, tableMetadata))
-                .withMessage("Database db_01 does not exist.");
-
-        // Create table throws TableAlreadyExistException when table already 
exists and
-        // ignoreIfExists is false
-        assertThatExceptionOfType(Catalog.TableAlreadyExistException.class)
-                .isThrownBy(
-                        () -> TableManager.createTable(catalog, DB_NAME, 
TABLE_NAME, tableMetadata))
-                .withMessage("Table test_db.test_table already exists.");
-    }
-
-    @Test
-    public void testGetTable() throws Catalog.TableNotExistException {
-        Table table = TableManager.getTable(catalog, DB_NAME, DEFAULT_TABLE);
-        assertThat(table).isInstanceOf(Table.class);
-
-        // Get table throws TableNotExistException when table does not exist
-        assertThatExceptionOfType(Catalog.TableNotExistException.class)
-                .isThrownBy(() -> TableManager.getTable(catalog, DB_NAME, 
TABLE_NAME))
-                .withMessage("Table test_db.test_table does not exist.");
-    }
-
-    @Test
-    public void testListTables() throws Catalog.DatabaseNotExistException {
-        List<String> tables = TableManager.listTables(catalog, DB_NAME);
-        assertThat(tables).contains("default_table");
-
-        // List tables throws DatabaseNotExistException when database does not 
exist
-        assertThatExceptionOfType(Catalog.DatabaseNotExistException.class)
-                .isThrownBy(() -> TableManager.listTables(catalog, "db_01"))
-                .withMessage("Database db_01 does not exist.");
-    }
-
-    @Test
-    public void testDropTable() throws Exception {
-        TableManager.createTable(
-                catalog,
-                DB_NAME,
-                "tb_01",
-                new TableMetadata(
-                        Lists.newArrayList(new ColumnMetadata("id", 
DataTypes.STRING(), "")),
-                        ImmutableList.of(),
-                        ImmutableList.of(),
-                        ImmutableMap.of(),
-                        ""));
-        assertThat(TableManager.tableExists(catalog, DB_NAME, 
"tb_01")).isTrue();
-
-        TableManager.dropTable(catalog, DB_NAME, "tb_01");
-        assertThat(TableManager.tableExists(catalog, DB_NAME, 
"tb_01")).isFalse();
-
-        // Drop table throws TableNotExistException when table does not exist
-        assertThatExceptionOfType(Catalog.TableNotExistException.class)
-                .isThrownBy(() -> TableManager.dropTable(catalog, DB_NAME, 
"tb_02"))
-                .withMessage("Table test_db.tb_02 does not exist.");
-    }
-
-    @Test
-    public void testRenameTable() throws Exception {
-        TableManager.createTable(
-                catalog,
-                DB_NAME,
-                "tb_01",
-                new TableMetadata(
-                        Lists.newArrayList(new ColumnMetadata("id", 
DataTypes.STRING(), "")),
-                        ImmutableList.of(),
-                        ImmutableList.of(),
-                        ImmutableMap.of(),
-                        ""));
-
-        TableManager.renameTable(catalog, DB_NAME, "tb_01", "tb_02");
-        assertThat(TableManager.tableExists(catalog, DB_NAME, 
"tb_01")).isFalse();
-        assertThat(TableManager.tableExists(catalog, DB_NAME, 
"tb_02")).isTrue();
-
-        // Rename table throws TableNotExistException when fromTable does not 
exist
-        assertThatExceptionOfType(Catalog.TableNotExistException.class)
-                .isThrownBy(() -> TableManager.renameTable(catalog, DB_NAME, 
"tb_01", "table_04"))
-                .withMessage("Table test_db.tb_01 does not exist.");
-
-        // Rename table throws TableAlreadyExistException when toTable already 
exists
-        TableManager.createTable(
-                catalog,
-                DB_NAME,
-                "tb_03",
-                new TableMetadata(
-                        Lists.newArrayList(new ColumnMetadata("id", 
DataTypes.STRING(), "")),
-                        ImmutableList.of(),
-                        ImmutableList.of(),
-                        ImmutableMap.of(),
-                        ""));
-
-        assertThatExceptionOfType(Catalog.TableAlreadyExistException.class)
-                .isThrownBy(
-                        () -> TableManager.renameTable(catalog, DB_NAME, 
"tb_03", "default_table"))
-                .withMessage("Table test_db.default_table already exists.");
-    }
-}
diff --git 
a/paimon-web-common/src/main/java/org/apache/paimon/web/common/utils/ParameterValidationUtil.java
 
b/paimon-web-common/src/main/java/org/apache/paimon/web/common/utils/ParameterValidationUtil.java
deleted file mode 100644
index 1436f9b..0000000
--- 
a/paimon-web-common/src/main/java/org/apache/paimon/web/common/utils/ParameterValidationUtil.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.paimon.web.common.utils;
-
-import java.util.Map;
-import java.util.function.Supplier;
-
-/** parameter validation util. */
-public class ParameterValidationUtil {
-
-    @SafeVarargs
-    public static void checkNotNull(Map.Entry<Object, Supplier<String>>... 
entries) {
-        for (Map.Entry<Object, Supplier<String>> entry : entries) {
-            if (entry.getKey() == null) {
-                throw new IllegalArgumentException(entry.getValue().get() + " 
can not be null.");
-            }
-        }
-    }
-}
diff --git 
a/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
 
b/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
index b5124bd..bed521c 100644
--- 
a/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
+++ 
b/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
@@ -18,12 +18,11 @@
 
 package org.apache.paimon.web.server.service.impl;
 
-import org.apache.paimon.catalog.Catalog;
 import org.apache.paimon.data.InternalRow;
 import org.apache.paimon.reader.RecordReader;
 import org.apache.paimon.table.Table;
 import org.apache.paimon.table.source.ReadBuilder;
-import org.apache.paimon.web.api.table.TableManager;
+import org.apache.paimon.web.api.catalog.PaimonService;
 import org.apache.paimon.web.server.constant.MetadataConstant;
 import org.apache.paimon.web.server.data.dto.MetadataDTO;
 import org.apache.paimon.web.server.data.model.CatalogInfo;
@@ -182,14 +181,9 @@ public class MetadataServiceImpl implements 
MetadataService {
                         Wrappers.lambdaQuery(CatalogInfo.class)
                                 .eq(CatalogInfo::getId, dto.getCatalogId())
                                 .select(i -> true));
-        Catalog catalog = 
PaimonServiceUtils.getPaimonService(catalogInfo).catalog();
-        try {
-            Table table = TableManager.getTable(catalog, 
dto.getDatabaseName(), dto.getTableName());
-            this.reader = getReader(table);
-        } catch (Catalog.TableNotExistException e) {
-            throw new RuntimeException(
-                    String.format("Table [%s] not exists", 
dto.getTableName()), e);
-        }
+        PaimonService paimonService = 
PaimonServiceUtils.getPaimonService(catalogInfo);
+        Table table = paimonService.getTable(dto.getDatabaseName(), 
dto.getTableName());
+        this.reader = getReader(table);
     }
 
     private List<MetadataOptionModel> formatOptions(String jsonOption) {

Reply via email to