Skip to content

Commit 8f97419

Browse files
Simplify impl/implWithProperties.
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
1 parent 5468caa commit 8f97419

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -227,31 +227,8 @@ public static SerializableFunction<FunctionName, Pair<FunctionSignature, Functio
227227
ExprType args1Type,
228228
ExprType args2Type) {
229229

230-
return functionName -> {
231-
FunctionSignature functionSignature =
232-
new FunctionSignature(functionName, Arrays.asList(args1Type, args2Type));
233-
FunctionBuilder functionBuilder =
234-
(functionProperties, arguments) -> new FunctionExpression(functionName, arguments) {
235-
@Override
236-
public ExprValue valueOf(Environment<Expression, ExprValue> valueEnv) {
237-
ExprValue arg1 = arguments.get(0).valueOf(valueEnv);
238-
ExprValue arg2 = arguments.get(1).valueOf(valueEnv);
239-
return function.apply(arg1, arg2);
240-
}
241-
242-
@Override
243-
public ExprType type() {
244-
return returnType;
245-
}
246-
247-
@Override
248-
public String toString() {
249-
return String.format("%s(%s, %s)", functionName, arguments.get(0).toString(),
250-
arguments.get(1).toString());
251-
}
252-
};
253-
return Pair.of(functionSignature, functionBuilder);
254-
};
230+
return implWithProperties((fp, arg1, arg2) ->
231+
function.apply(arg1, arg2), returnType, args1Type, args2Type);
255232
}
256233

257234
/**

0 commit comments

Comments
 (0)