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

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b3e562802 [spark] Add log for creating default database when not 
exist (#5999)
1b3e562802 is described below

commit 1b3e5628022529741b5a9d4e70f27ce32ee47785
Author: Zouxxyy <[email protected]>
AuthorDate: Fri Aug 1 10:14:20 2025 +0800

    [spark] Add log for creating default database when not exist (#5999)
---
 .../src/main/java/org/apache/paimon/spark/SparkCatalog.java        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java
 
b/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java
index 94657d4a8d..1f32e04903 100644
--- 
a/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java
+++ 
b/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java
@@ -37,6 +37,7 @@ import org.apache.paimon.table.FormatTable;
 import org.apache.paimon.table.FormatTableOptions;
 import org.apache.paimon.types.DataField;
 import org.apache.paimon.types.DataType;
+import org.apache.paimon.utils.ExceptionUtils;
 import org.apache.paimon.utils.TypeUtils;
 
 import org.apache.spark.sql.PaimonSparkSession$;
@@ -121,8 +122,12 @@ public class SparkCatalog extends SparkBaseCatalog
         this.defaultDatabase =
                 options.getOrDefault(DEFAULT_DATABASE.key(), 
DEFAULT_DATABASE.defaultValue());
         try {
-            catalog.getDatabase(defaultNamespace()[0]);
+            catalog.getDatabase(defaultDatabase);
         } catch (Catalog.DatabaseNotExistException e) {
+            LOG.warn(
+                    "Default database '{}' does not exist, caused by: {}, 
start to create it",
+                    defaultDatabase,
+                    ExceptionUtils.stringifyException(e));
             try {
                 createNamespace(defaultNamespace(), new HashMap<>());
             } catch (NamespaceAlreadyExistsException ignored) {

Reply via email to