Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public SettableFuture<ConfigTaskResult> createFunction(
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 '"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4192,6 +4192,18 @@ public Scope visitTableFunctionInvocation(TableFunctionInvocation node, Optional
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,
Expand Down Expand Up @@ -4233,18 +4245,22 @@ private ArgumentsAnalysis analyzeArguments(
}
}
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());
Expand Down
Loading