From e6843e2bf9159820fc04871d744b59630c262080 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 12 Dec 2022 18:16:44 -0800 Subject: [PATCH] Simplify `impl`/`implWithProperties`. Signed-off-by: Yury-Fridlyand --- .../sql/expression/function/FunctionDSL.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java b/core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java index 5938eb85d5..1bf38f7722 100644 --- a/core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java +++ b/core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java @@ -227,31 +227,8 @@ public static SerializableFunction { - FunctionSignature functionSignature = - new FunctionSignature(functionName, Arrays.asList(args1Type, args2Type)); - FunctionBuilder functionBuilder = - (functionProperties, arguments) -> new FunctionExpression(functionName, arguments) { - @Override - public ExprValue valueOf(Environment valueEnv) { - ExprValue arg1 = arguments.get(0).valueOf(valueEnv); - ExprValue arg2 = arguments.get(1).valueOf(valueEnv); - return function.apply(arg1, arg2); - } - - @Override - public ExprType type() { - return returnType; - } - - @Override - public String toString() { - return String.format("%s(%s, %s)", functionName, arguments.get(0).toString(), - arguments.get(1).toString()); - } - }; - return Pair.of(functionSignature, functionBuilder); - }; + return implWithProperties((fp, arg1, arg2) -> + function.apply(arg1, arg2), returnType, args1Type, args2Type); } /**