1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | package org.opensearch.sql.expression.system; | |
7 | ||
8 | import static org.opensearch.sql.data.type.ExprCoreType.STRING; | |
9 | ||
10 | import lombok.experimental.UtilityClass; | |
11 | import org.apache.commons.lang3.tuple.Pair; | |
12 | import org.opensearch.sql.data.model.ExprStringValue; | |
13 | import org.opensearch.sql.data.model.ExprValue; | |
14 | import org.opensearch.sql.data.type.ExprType; | |
15 | import org.opensearch.sql.expression.Expression; | |
16 | import org.opensearch.sql.expression.FunctionExpression; | |
17 | import org.opensearch.sql.expression.env.Environment; | |
18 | import org.opensearch.sql.expression.function.BuiltinFunctionName; | |
19 | import org.opensearch.sql.expression.function.BuiltinFunctionRepository; | |
20 | import org.opensearch.sql.expression.function.FunctionBuilder; | |
21 | import org.opensearch.sql.expression.function.FunctionName; | |
22 | import org.opensearch.sql.expression.function.FunctionResolver; | |
23 | import org.opensearch.sql.expression.function.FunctionSignature; | |
24 | ||
25 | @UtilityClass | |
26 | public class SystemFunctions { | |
27 | /** | |
28 | * Register TypeOf Operator. | |
29 | */ | |
30 | public static void register(BuiltinFunctionRepository repository) { | |
31 |
1
1. register : removed call to org/opensearch/sql/expression/function/BuiltinFunctionRepository::register → KILLED |
repository.register(typeof()); |
32 | } | |
33 | ||
34 | // Auxiliary function useful for debugging | |
35 | private static FunctionResolver typeof() { | |
36 |
1
1. typeof : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions::typeof → KILLED |
return new FunctionResolver() { |
37 | @Override | |
38 | public Pair<FunctionSignature, FunctionBuilder> resolve( | |
39 | FunctionSignature unresolvedSignature) { | |
40 |
1
1. resolve : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions$1::resolve → KILLED |
return Pair.of(unresolvedSignature, |
41 |
1
1. lambda$resolve$0 : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions$1::lambda$resolve$0 → KILLED |
arguments -> new FunctionExpression(BuiltinFunctionName.TYPEOF.getName(), arguments) { |
42 | @Override | |
43 | public ExprValue valueOf(Environment<Expression, ExprValue> valueEnv) { | |
44 |
1
1. valueOf : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions$1$1::valueOf → KILLED |
return new ExprStringValue(getArguments().get(0).type().toString()); |
45 | } | |
46 | ||
47 | @Override | |
48 | public ExprType type() { | |
49 |
1
1. type : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions$1$1::type → KILLED |
return STRING; |
50 | } | |
51 | }); | |
52 | } | |
53 | ||
54 | @Override | |
55 | public FunctionName getFunctionName() { | |
56 |
1
1. getFunctionName : replaced return value with null for org/opensearch/sql/expression/system/SystemFunctions$1::getFunctionName → KILLED |
return BuiltinFunctionName.TYPEOF.getName(); |
57 | } | |
58 | }; | |
59 | } | |
60 | } | |
Mutations | ||
31 |
1.1 |
|
36 |
1.1 |
|
40 |
1.1 |
|
41 |
1.1 |
|
44 |
1.1 |
|
49 |
1.1 |
|
56 |
1.1 |