diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergDLFExternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergDLFExternalCatalog.java index d3f192754ab4db..048117bce53505 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergDLFExternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergDLFExternalCatalog.java @@ -17,10 +17,18 @@ package org.apache.doris.datasource.iceberg; +import org.apache.doris.analysis.CreateDbStmt; +import org.apache.doris.analysis.CreateTableStmt; +import org.apache.doris.analysis.DropDbStmt; +import org.apache.doris.analysis.DropTableStmt; +import org.apache.doris.analysis.TruncateTableStmt; +import org.apache.doris.common.DdlException; +import org.apache.doris.common.UserException; import org.apache.doris.datasource.CatalogProperty; import org.apache.doris.datasource.iceberg.dlf.DLFCatalog; import org.apache.doris.datasource.property.PropertyConverter; import org.apache.doris.datasource.property.constants.HMSProperties; +import org.apache.doris.nereids.exceptions.NotSupportedException; import java.util.Map; @@ -45,4 +53,29 @@ protected void initCatalog() { dlfCatalog.initialize(catalogName, catalogProperties); catalog = dlfCatalog; } + + @Override + public void createDb(CreateDbStmt stmt) throws DdlException { + throw new NotSupportedException("iceberg catalog with dlf type not supports 'create database'"); + } + + @Override + public void dropDb(DropDbStmt stmt) throws DdlException { + throw new NotSupportedException("iceberg catalog with dlf type not supports 'drop database'"); + } + + @Override + public boolean createTable(CreateTableStmt stmt) throws UserException { + throw new NotSupportedException("iceberg catalog with dlf type not supports 'create table'"); + } + + @Override + public void dropTable(DropTableStmt stmt) throws DdlException { + throw new NotSupportedException("iceberg catalog with dlf type not supports 'drop table'"); + } + + @Override + public void truncateTable(TruncateTableStmt stmt) throws DdlException { + throw new NotSupportedException("iceberg catalog with dlf type not supports 'truncate table'"); + } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/dlf/client/IcebergDLFExternalCatalogTest.java b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/dlf/client/IcebergDLFExternalCatalogTest.java index bbd39b7b71bfc0..b14f5a217b3ff5 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/dlf/client/IcebergDLFExternalCatalogTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/dlf/client/IcebergDLFExternalCatalogTest.java @@ -17,6 +17,9 @@ package org.apache.doris.datasource.iceberg.dlf.client; +import org.apache.doris.datasource.iceberg.IcebergDLFExternalCatalog; +import org.apache.doris.nereids.exceptions.NotSupportedException; + import org.apache.hadoop.conf.Configuration; import org.junit.Assert; import org.junit.Test; @@ -38,4 +41,16 @@ public void testDatabaseList() { Assert.assertNotSame(dlfClientPool1, dlfClientPool2); } + + @Test + public void testNotSupportOperation() { + HashMap props = new HashMap<>(); + IcebergDLFExternalCatalog catalog = new IcebergDLFExternalCatalog(1, "test", "test", props, "test"); + Assert.assertThrows(NotSupportedException.class, () -> catalog.createDb(null)); + Assert.assertThrows(NotSupportedException.class, () -> catalog.dropDb(null)); + Assert.assertThrows(NotSupportedException.class, () -> catalog.createTable(null)); + Assert.assertThrows(NotSupportedException.class, () -> catalog.dropTable(null)); + Assert.assertThrows(NotSupportedException.class, () -> catalog.dropTable(null)); + Assert.assertThrows(NotSupportedException.class, () -> catalog.truncateTable(null)); + } }