This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch rc/1.3.3 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 6ffd18845d9191dfc843c727bdb4ededbb307116 Author: CloudWise-Lukemiao <[email protected]> AuthorDate: Thu Aug 8 16:08:03 2024 +0800 Fixed the rest service When executing unsupported SQL, return null (cherry picked from commit 75ddc9d35c34f6d6d3d650cac73b63e1628530af) --- .../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(
