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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 16521017add [fix](iceberg)Table operations are not supported for 
catalogs of the dlf type for 2.1 #50696 (#51112)
16521017add is described below

commit 16521017addd6e28c4ed84f6683fb7ff4402b237
Author: wuwenchi <wuwen...@selectdb.com>
AuthorDate: Fri May 23 13:33:10 2025 +0800

    [fix](iceberg)Table operations are not supported for catalogs of the dlf 
type for 2.1 #50696 (#51112)
    
    bp: #50696
---
 .../iceberg/IcebergDLFExternalCatalog.java         | 33 ++++++++++++++++++++++
 .../dlf/client/IcebergDLFExternalCatalogTest.java  | 14 +++++++++
 2 files changed, 47 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 d3f192754ab..048117bce53 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 @@ public class IcebergDLFExternalCatalog extends 
IcebergExternalCatalog {
         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 bbd39b7b71b..6c8c5d00e84 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,15 @@ public class IcebergDLFExternalCatalogTest {
         Assert.assertNotSame(dlfClientPool1, dlfClientPool2);
 
     }
+
+    @Test
+    public void testNotSupportOperation() {
+        HashMap<String, String> 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.truncateTable(null));
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to