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

haonan pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 882f98bd6dc [To dev/1.3] Correct error messages when encountered 
IllegalPathException (#15549)
882f98bd6dc is described below

commit 882f98bd6dc2aa3d40300305efc8b0d412ed5fa4
Author: libo <[email protected]>
AuthorDate: Thu May 22 09:21:08 2025 +0800

    [To dev/1.3] Correct error messages when encountered IllegalPathException 
(#15549)
---
 .../java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java  | 11 ++++++++++-
 .../plan/analyze/cache/partition/PartitionCache.java          |  7 ++++++-
 .../java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java    |  3 +++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
index 8a792aacc38..09a3a295112 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
@@ -225,7 +225,7 @@ public class IoTDBSetConfigurationIT {
         statement.execute("INSERT INTO root.fail(timestamp, s1) VALUES (1, 
1)");
       } catch (SQLException e) {
         assertEquals(
-            "509: root.fail is not a legal path, because it is no longer than 
default sg level: 3",
+            "509: An error occurred when executing 
getDeviceToDatabase():root.fail is not a legal path, because it is no longer 
than default sg level: 3",
             e.getMessage());
       }
 
@@ -257,6 +257,15 @@ public class IoTDBSetConfigurationIT {
       // the default value should take effect
       Assert.assertEquals("root.a", databases.getString(1));
       assertFalse(databases.next());
+
+      // create timeseries with an illegal path
+      try {
+        statement.execute("CREATE TIMESERIES root.db1.s3 WITH datatype=INT32");
+      } catch (SQLException e) {
+        assertEquals(
+            "509: An error occurred when executing 
getDeviceToDatabase():root.db1 is not a legal path, because it is no longer 
than default sg level: 3",
+            e.getMessage());
+      }
     }
   }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
index 6d60597ffe8..e7235f98619 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java
@@ -29,6 +29,7 @@ import org.apache.iotdb.commons.client.IClientManager;
 import org.apache.iotdb.commons.client.exception.ClientManagerException;
 import org.apache.iotdb.commons.consensus.ConfigRegionId;
 import org.apache.iotdb.commons.exception.IoTDBException;
+import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.partition.DataPartitionQueryParam;
@@ -382,7 +383,11 @@ public class PartitionCache {
             throw new StatementAnalyzeException("Failed to get database Map");
           }
         }
-      } catch (TException | MetadataException | ClientManagerException e) {
+      } catch (MetadataException e) {
+        throw new IoTDBRuntimeException(
+            "An error occurred when executing getDeviceToDatabase():" + 
e.getMessage(),
+            e.getErrorCode());
+      } catch (TException | ClientManagerException e) {
         throw new StatementAnalyzeException(
             "An error occurred when executing getDeviceToDatabase():" + 
e.getMessage(), e);
       }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index 7e6740b94a4..430448a14d8 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.db.utils;
 
 import org.apache.iotdb.common.rpc.thrift.TSStatus;
 import org.apache.iotdb.commons.exception.IoTDBException;
+import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
 import org.apache.iotdb.db.exception.BatchProcessException;
 import org.apache.iotdb.db.exception.QueryInBatchStatementException;
 import org.apache.iotdb.db.exception.StorageGroupNotReadyException;
@@ -145,6 +146,8 @@ public class ErrorHandlingUtils {
           TSStatusCode.QUERY_NOT_ALLOWED, INFO_NOT_ALLOWED_IN_BATCH_ERROR + 
rootCause.getMessage());
     } else if (t instanceof IoTDBException) {
       return RpcUtils.getStatus(((IoTDBException) t).getErrorCode(), 
rootCause.getMessage());
+    } else if (t instanceof IoTDBRuntimeException) {
+      return RpcUtils.getStatus(((IoTDBRuntimeException) t).getErrorCode(), 
rootCause.getMessage());
     } else if (t instanceof TsFileRuntimeException) {
       return RpcUtils.getStatus(TSStatusCode.TSFILE_PROCESSOR_ERROR, 
rootCause.getMessage());
     } else if (t instanceof SemanticException) {

Reply via email to