This is an automated email from the ASF dual-hosted git repository.
rong 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 775f169afd7 Pipe: result of show pipes statement is incorrect when it
contains back quoted pipe names (#11944)
775f169afd7 is described below
commit 775f169afd7b10cdd315a0a96266cf58cca16fbd
Author: Xuan Ronaldo <[email protected]>
AuthorDate: Mon Jan 29 14:47:51 2024 +0800
Pipe: result of show pipes statement is incorrect when it contains back
quoted pipe names (#11944)
---
.../java/org/apache/iotdb/pipe/it/IoTDBPipeSyntaxIT.java | 3 ++-
.../execution/config/executor/ClusterConfigTaskExecutor.java | 3 +--
.../apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/IoTDBPipeSyntaxIT.java
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/IoTDBPipeSyntaxIT.java
index fe0be803332..da485c8b9a8 100644
---
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/IoTDBPipeSyntaxIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/IoTDBPipeSyntaxIT.java
@@ -58,6 +58,7 @@ public class IoTDBPipeSyntaxIT extends AbstractPipeDualIT {
(SyncConfigNodeIServiceClient)
senderEnv.getLeaderConfigNodeConnection()) {
List<String> validPipeNames = Arrays.asList("Pipe_1", "null", "`33`",
"`root`", "中文", "with");
+ List<String> expectedPipeNames = Arrays.asList("Pipe_1", "null", "33",
"root", "中文", "with");
for (String pipeName : validPipeNames) {
try (Connection connection = senderEnv.getConnection();
Statement statement = connection.createStatement()) {
@@ -77,7 +78,7 @@ public class IoTDBPipeSyntaxIT extends AbstractPipeDualIT {
}
List<TShowPipeInfo> showPipeResult = client.showPipe(new
TShowPipeReq()).pipeInfoList;
- for (String pipeName : validPipeNames) {
+ for (String pipeName : expectedPipeNames) {
Assert.assertTrue(
showPipeResult.stream()
.anyMatch((o) -> o.id.equals(pipeName) &&
o.state.equals("RUNNING")));
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index df3a9b72ac1..9dbc37e1a8c 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -203,7 +203,6 @@ import org.apache.iotdb.udf.api.UDTF;
import com.google.common.util.concurrent.SettableFuture;
import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
@@ -1719,7 +1718,7 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
try (ConfigNodeClient configNodeClient =
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
TShowPipeReq tShowPipeReq = new TShowPipeReq();
- if (!StringUtils.isEmpty(showPipesStatement.getPipeName())) {
+ if (showPipesStatement.getPipeName() != null) {
tShowPipeReq.setPipeName(showPipesStatement.getPipeName());
}
if (showPipesStatement.getWhereClause()) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
index 9099112b8bf..d91b5053e56 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
@@ -908,7 +908,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
@Override
public Statement
visitCreatePipePlugin(IoTDBSqlParser.CreatePipePluginContext ctx) {
return new CreatePipePluginStatement(
- ctx.pluginName.getText(),
+ parseIdentifier(ctx.pluginName.getText()),
parseStringLiteral(ctx.className.getText()),
parseAndValidateURI(ctx.uriClause()));
}
@@ -916,7 +916,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
// Drop PipePlugin
=====================================================================
@Override
public Statement visitDropPipePlugin(IoTDBSqlParser.DropPipePluginContext
ctx) {
- return new DropPipePluginStatement(ctx.pluginName.getText());
+ return new
DropPipePluginStatement(parseIdentifier(ctx.pluginName.getText()));
}
// Show PipePlugins
=====================================================================
@@ -3589,7 +3589,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
new CreatePipeStatement(StatementType.CREATE_PIPE);
if (ctx.pipeName != null) {
- createPipeStatement.setPipeName(ctx.pipeName.getText());
+ createPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
} else {
throw new SemanticException(
"Not support for this sql in CREATEPIPE, please enter pipe name.");
@@ -3652,7 +3652,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
final DropPipeStatement dropPipeStatement = new
DropPipeStatement(StatementType.DROP_PIPE);
if (ctx.pipeName != null) {
- dropPipeStatement.setPipeName(ctx.pipeName.getText());
+ dropPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
} else {
throw new SemanticException("Not support for this sql in DROP PIPE,
please enter pipename.");
}
@@ -3665,7 +3665,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
final StartPipeStatement startPipeStatement = new
StartPipeStatement(StatementType.START_PIPE);
if (ctx.pipeName != null) {
- startPipeStatement.setPipeName(ctx.pipeName.getText());
+ startPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
} else {
throw new SemanticException("Not support for this sql in START PIPE,
please enter pipename.");
}
@@ -3678,7 +3678,7 @@ public class ASTVisitor extends
IoTDBSqlParserBaseVisitor<Statement> {
final StopPipeStatement stopPipeStatement = new
StopPipeStatement(StatementType.STOP_PIPE);
if (ctx.pipeName != null) {
- stopPipeStatement.setPipeName(ctx.pipeName.getText());
+ stopPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
} else {
throw new SemanticException("Not support for this sql in STOP PIPE,
please enter pipename.");
}