From df46bc75ee90d14d7851989fcce71018f1b80a8a Mon Sep 17 00:00:00 2001 From: wuwenchi Date: Thu, 15 May 2025 19:35:40 +0800 Subject: [PATCH 1/3] fix --- .../iceberg/IcebergDLFExternalCatalog.java | 32 +++++++++++++++++++ .../client/IcebergDLFExternalCatalogTest.java | 12 +++++++ 2 files changed, 44 insertions(+) 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..b05d04ebdff619 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,6 +17,13 @@ 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; @@ -45,4 +52,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..a700a36937f612 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 @@ -38,4 +38,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)); + } } From 825df39e6c0768eeb5ffffb50a4d38e65bb96cb5 Mon Sep 17 00:00:00 2001 From: wuwenchi Date: Wed, 21 May 2025 15:28:56 +0800 Subject: [PATCH 2/3] fix --- .../doris/datasource/iceberg/IcebergDLFExternalCatalog.java | 1 + .../iceberg/dlf/client/IcebergDLFExternalCatalogTest.java | 3 +++ 2 files changed, 4 insertions(+) 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 b05d04ebdff619..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 @@ -28,6 +28,7 @@ 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; 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 a700a36937f612..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; From d7cb78bef3e1fd4318f12a3d2cc1b24b75c2c7d7 Mon Sep 17 00:00:00 2001 From: wuwenchi Date: Wed, 21 May 2025 15:30:29 +0800 Subject: [PATCH 3/3] fix --- .../iceberg/dlf/client/IcebergDLFExternalCatalogTest.java | 1 - 1 file changed, 1 deletion(-) 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 b14f5a217b3ff5..6c8c5d00e842ab 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 @@ -50,7 +50,6 @@ public void testNotSupportOperation() { 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)); } }