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

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


The following commit(s) were added to refs/heads/master by this push:
     new 75ddc9d35c3 Fixed the rest service When executing unsupported SQL, 
return null
75ddc9d35c3 is described below

commit 75ddc9d35c34f6d6d3d650cac73b63e1628530af
Author: CloudWise-Lukemiao <[email protected]>
AuthorDate: Thu Aug 8 16:08:03 2024 +0800

    Fixed the rest service When executing unsupported SQL, return null
---
 .../db/protocol/rest/v1/impl/RestApiServiceImpl.java   | 18 ++++++++++++++++--
 .../db/protocol/rest/v2/impl/RestApiServiceImpl.java   | 18 +++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
index 428f2c3baaa..df8b8464712 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
@@ -81,7 +81,14 @@ public class RestApiServiceImpl extends RestApiService {
 
       Statement statement =
           StatementGenerator.createStatement(sql.getSql(), 
ZoneId.systemDefault());
-
+      if (statement == null) {
+        return Response.ok()
+            .entity(
+                new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus()
+                    .code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
+                    .message("This operation type is not supported"))
+            .build();
+      }
       if (!ExecuteStatementHandler.validateStatement(statement)) {
         return Response.ok()
             .entity(
@@ -134,7 +141,14 @@ public class RestApiServiceImpl extends RestApiService {
 
       Statement statement =
           StatementGenerator.createStatement(sql.getSql(), 
ZoneId.systemDefault());
-
+      if (statement == null) {
+        return Response.ok()
+            .entity(
+                new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus()
+                    .code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
+                    .message("This operation type is not supported"))
+            .build();
+      }
       if (ExecuteStatementHandler.validateStatement(statement)) {
         return Response.ok()
             .entity(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
index 854fd7feb70..574f0520938 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
@@ -85,7 +85,14 @@ public class RestApiServiceImpl extends RestApiService {
 
       Statement statement =
           StatementGenerator.createStatement(sql.getSql(), 
ZoneId.systemDefault());
-
+      if (statement == null) {
+        return Response.ok()
+            .entity(
+                new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus()
+                    .code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
+                    .message("This operation type is not supported"))
+            .build();
+      }
       if (!ExecuteStatementHandler.validateStatement(statement)) {
         return Response.ok()
             .entity(
@@ -129,6 +136,15 @@ public class RestApiServiceImpl extends RestApiService {
       Statement statement =
           StatementGenerator.createStatement(sql.getSql(), 
ZoneId.systemDefault());
 
+      if (statement == null) {
+        return Response.ok()
+            .entity(
+                new org.apache.iotdb.db.protocol.rest.model.ExecutionStatus()
+                    .code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
+                    .message("This operation type is not supported"))
+            .build();
+      }
+
       if (ExecuteStatementHandler.validateStatement(statement)) {
         return Response.ok()
             .entity(

Reply via email to