This is an automated email from the ASF dual-hosted git repository.
jackietien 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 61fb62cd42e Check TVF parameter case-intensively during invocation and
declaration.
61fb62cd42e is described below
commit 61fb62cd42e262260c1ef0b14fb0d959b596e371
Author: Chen YZ <[email protected]>
AuthorDate: Tue May 6 10:02:39 2025 +0900
Check TVF parameter case-intensively during invocation and declaration.
---
.../db/query/udf/example/relational/MySplit.java | 4 ++--
.../config/executor/ClusterConfigTaskExecutor.java | 2 +-
.../relational/analyzer/StatementAnalyzer.java | 26 +++++++++++++++++-----
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git
a/integration-test/src/main/java/org/apache/iotdb/db/query/udf/example/relational/MySplit.java
b/integration-test/src/main/java/org/apache/iotdb/db/query/udf/example/relational/MySplit.java
index 6039b8df75e..5da4f6a30bf 100644
---
a/integration-test/src/main/java/org/apache/iotdb/db/query/udf/example/relational/MySplit.java
+++
b/integration-test/src/main/java/org/apache/iotdb/db/query/udf/example/relational/MySplit.java
@@ -42,8 +42,8 @@ import java.util.List;
import java.util.Map;
public class MySplit implements TableFunction {
- private final String INPUT_PARAMETER_NAME = "INPUT";
- private final String SPLIT_PARAMETER_NAME = "SPLIT";
+ private final String INPUT_PARAMETER_NAME = "input";
+ private final String SPLIT_PARAMETER_NAME = "split";
@Override
public List<ParameterSpecification> getArgumentsSpecifications() {
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 892a74a4319..56e36fbe0da 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
@@ -628,7 +628,7 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
Set<String> argNames = new HashSet<>();
for (ParameterSpecification specification :
tableFunction.getArgumentsSpecifications()) {
- if (!argNames.add(specification.getName())) {
+ if (!argNames.add(specification.getName().toUpperCase())) {
future.setException(
new IoTDBException(
"Failed to create function '"
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
index fc7589a69c2..4db6547bb6e 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java
@@ -4192,6 +4192,18 @@ public class StatementAnalyzer {
return createAndAssignScope(node, scope, fields.build());
}
+ private String castNameAsSpecification(Set<String> specifiedNames, String
passedName) {
+ if (specifiedNames.contains(passedName)) {
+ return passedName;
+ }
+ for (String name : specifiedNames) {
+ if (name.equalsIgnoreCase(passedName)) {
+ return name;
+ }
+ }
+ return null;
+ }
+
private ArgumentsAnalysis analyzeArguments(
List<ParameterSpecification> parameterSpecifications,
List<TableFunctionArgument> arguments,
@@ -4233,18 +4245,22 @@ public class StatementAnalyzer {
}
}
Set<String> uniqueArgumentNames = new HashSet<>();
+ Set<String> specifiedArgumentNames =
+ ImmutableSet.copyOf(argumentSpecificationsByName.keySet());
for (TableFunctionArgument argument : arguments) {
// it has been checked that all arguments have different names
- String argumentName = argument.getName().get().getCanonicalValue();
+ String argumentName =
+ castNameAsSpecification(
+ specifiedArgumentNames,
argument.getName().get().getCanonicalValue());
+ if (argumentName == null) {
+ throw new SemanticException(
+ String.format("Unexpected argument name: %s",
argument.getName().get().getValue()));
+ }
if (!uniqueArgumentNames.add(argumentName)) {
throw new SemanticException(String.format("Duplicate argument
name: %s", argumentName));
}
ParameterSpecification parameterSpecification =
argumentSpecificationsByName.remove(argumentName);
- if (parameterSpecification == null) {
- throw new SemanticException(
- String.format("Unexpected argument name: %s", argumentName));
- }
ArgumentAnalysis argumentAnalysis =
analyzeArgument(parameterSpecification, argument, scope);
passedArguments.put(argumentName, argumentAnalysis.getArgument());