chenhao7253886 commented on a change in pull request #1418: Set stmt support
Expr
URL: https://github.com/apache/incubator-doris/pull/1418#discussion_r300166455
##########
File path: fe/src/main/java/org/apache/doris/analysis/ExpressionFunctions.java
##########
@@ -162,13 +160,52 @@ public FEFunctionSignature getSignature() {
return signature;
}
+ // Now we only support functions which contain only one
variable-length arg or fixed-length args
+ // which does't contain any arrays.
public LiteralExpr invoke(List<Expr> args) throws AnalysisException {
+ boolean isArray = false;
+ for (Class<?> argType : method.getParameterTypes()) {
+ if (argType.isArray()) {
+
Preconditions.checkArgument(method.getParameterTypes().length == 1);
+ isArray = true;
+ }
+ }
try {
- return (LiteralExpr) method.invoke(null, args.toArray());
+ if (!isArray) {
+ return invokeFixedVariableLengthArgsMethod(args);
+ } else {
+ return invokeVariableLengthArgsMethod(args);
+ }
} catch (InvocationTargetException | IllegalAccessException |
IllegalArgumentException e) {
throw new AnalysisException(e.getLocalizedMessage(), e);
}
}
+
+ public LiteralExpr invokeFixedVariableLengthArgsMethod(List<Expr>
args) throws InvocationTargetException, IllegalAccessException {
+ return (LiteralExpr) method.invoke(null, args.toArray());
+ }
+
+ public LiteralExpr invokeVariableLengthArgsMethod(List<Expr> args)
throws InvocationTargetException, IllegalAccessException {
Review comment:
i will improve it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]