This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new a44d8972094 branch-3.0: [fix](iceberg)Fill in the detailed error
information #45285 (#45337)
a44d8972094 is described below
commit a44d89720943968b62b8cfcabc934c45e2ec401e
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Dec 14 19:15:52 2024 -0800
branch-3.0: [fix](iceberg)Fill in the detailed error information #45285
(#45337)
Cherry-picked from #45285
Co-authored-by: wuwenchi <[email protected]>
---
.../datasource/iceberg/IcebergMetadataOps.java | 3 ++-
.../datasource/iceberg/CreateIcebergTableTest.java | 26 ++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java
index 970814b7acd..440a671afe5 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java
@@ -160,7 +160,8 @@ public class IcebergMetadataOps implements
ExternalMetadataOps {
return null;
});
} catch (Exception e) {
- throw new DdlException("Failed to drop database: " +
stmt.getDbName() + " ,error message is: ", e);
+ throw new DdlException(
+ "Failed to drop database: " + stmt.getDbName() + ", error
message is: " + e.getMessage(), e);
}
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
index 1c780d63c9c..439f6f2aa7d 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
@@ -21,6 +21,8 @@ import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.CreateDbStmt;
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DbName;
+import org.apache.doris.analysis.DropDbStmt;
+import org.apache.doris.common.DdlException;
import org.apache.doris.common.UserException;
import org.apache.doris.datasource.CatalogFactory;
import org.apache.doris.nereids.parser.NereidsParser;
@@ -201,4 +203,28 @@ public class CreateIcebergTableTest {
String s = "test_tb_" + UUID.randomUUID();
return s.replaceAll("-", "");
}
+
+ @Test
+ public void testDropDB() {
+ String dbName = "db_to_delete";
+ CreateDbStmt createDBStmt = new CreateDbStmt(false, new
DbName("iceberg", dbName), new HashMap<>());
+ DropDbStmt dropDbStmt = new DropDbStmt(false, new DbName("iceberg",
dbName), false);
+ DropDbStmt dropDbStmt2 = new DropDbStmt(false, new DbName("iceberg",
"not_exists"), false);
+ try {
+ // create db success
+ ops.createDb(createDBStmt);
+ // drop db success
+ ops.dropDb(dropDbStmt);
+ } catch (Throwable t) {
+ Assert.fail();
+ }
+
+ try {
+ ops.dropDb(dropDbStmt2);
+ Assert.fail();
+ } catch (Throwable t) {
+ Assert.assertTrue(t instanceof DdlException);
+ Assert.assertTrue(t.getMessage().contains("database doesn't
exist"));
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]