This is an automated email from the ASF dual-hosted git repository.
jiangtian 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 db02437f00f PipePlugin: Optimized the errorCode && Fixed the
case-sensitive semantic (#16851)
db02437f00f is described below
commit db02437f00f3f1f4807347ab30317ed114cee3e4
Author: Caideyipi <[email protected]>
AuthorDate: Wed Dec 3 14:54:45 2025 +0800
PipePlugin: Optimized the errorCode && Fixed the case-sensitive semantic
(#16851)
* fix
* fix
---
.../treemodel/auto/basic/IoTDBPipeSyntaxIT.java | 61 ++++++++++++++++++++++
.../config/executor/ClusterConfigTaskExecutor.java | 12 +++--
2 files changed, 69 insertions(+), 4 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java
index e925e9e4428..610a7b974fd 100644
---
a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java
@@ -37,6 +37,7 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
+import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
@@ -757,4 +758,64 @@ public class IoTDBPipeSyntaxIT extends
AbstractPipeDualTreeModelAutoIT {
fail(e.getMessage());
}
}
+
+ @Test
+ public void testPipePluginValidation() {
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement()) {
+ try {
+ statement.execute(
+ "create pipePlugin TestProcessor as
'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI 'xxx'");
+ fail();
+ } catch (final SQLException e) {
+ Assert.assertEquals(
+ "701: Untrusted uri xxx, current trusted_uri_pattern is file:.*",
e.getMessage());
+ }
+ try {
+ statement.execute(
+ "create pipePlugin TestProcessor as
'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI 'file:.*'");
+ fail();
+ } catch (final SQLException e) {
+ Assert.assertEquals("701: URI is not hierarchical", e.getMessage());
+ }
+ try {
+ statement.execute(
+ String.format(
+ "create pipePlugin TestProcessor as
'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI '%s'",
+ new File(
+ System.getProperty("user.dir")
+ + File.separator
+ + "target"
+ + File.separator
+ + "test-classes"
+ + File.separator)
+ .toURI()
+ + "PipePlugin.jar"));
+ fail();
+ } catch (final SQLException e) {
+ Assert.assertEquals(
+ "1603: Failed to get executable for PipePlugin TestProcessor,
please check the URI.",
+ e.getMessage());
+ }
+ try {
+ statement.execute("drop pipePlugin test_processor");
+ fail();
+ } catch (final SQLException e) {
+ Assert.assertEquals(
+ "1601: Failed to drop pipe plugin TEST_PROCESSOR. Failures:
TEST_PROCESSOR does not exist.",
+ e.getMessage());
+ }
+ try {
+ statement.execute("drop pipePlugin `Do-Nothing-Sink`");
+ fail();
+ } catch (final SQLException e) {
+ Assert.assertEquals(
+ "1601: Failed to drop PipePlugin [DO-NOTHING-SINK], the PipePlugin
is a built-in PipePlugin",
+ e.getMessage());
+ }
+ } catch (final SQLException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
}
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 fbda4390909..d0f7c7f99d7 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
@@ -994,7 +994,11 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
// Set md5 of the jar file
jarMd5 =
DigestUtils.md5Hex(Files.newInputStream(Paths.get(libRoot)));
}
- } catch (final IOException | URISyntaxException e) {
+ } catch (final URISyntaxException | IllegalArgumentException e) {
+ future.setException(
+ new IoTDBException(e.getMessage(),
TSStatusCode.SEMANTIC_ERROR.getStatusCode()));
+ return future;
+ } catch (final IOException e) {
LOGGER.warn(
"Failed to get executable for PipePlugin({}) using URI: {}.",
createPipePluginStatement.getPluginName(),
@@ -1002,9 +1006,9 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
e);
future.setException(
new IoTDBException(
- "Failed to get executable for PipePlugin"
+ "Failed to get executable for PipePlugin "
+ createPipePluginStatement.getPluginName()
- + "', please check the URI.",
+ + ", please check the URI.",
TSStatusCode.PIPE_PLUGIN_DOWNLOAD_ERROR.getStatusCode()));
return future;
}
@@ -1093,7 +1097,7 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
final TSStatus executionStatus =
client.dropPipePlugin(
new TDropPipePluginReq()
- .setPluginName(dropPipePluginStatement.getPluginName())
+
.setPluginName(dropPipePluginStatement.getPluginName().toUpperCase())
.setIfExistsCondition(dropPipePluginStatement.hasIfExistsCondition())
.setIsTableModel(dropPipePluginStatement.isTableModel()));
if (TSStatusCode.SUCCESS_STATUS.getStatusCode() !=
executionStatus.getCode()) {