1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | ||
7 | package org.opensearch.sql.storage.bindingtuple; | |
8 | ||
9 | import org.opensearch.sql.data.model.ExprMissingValue; | |
10 | import org.opensearch.sql.data.model.ExprValue; | |
11 | import org.opensearch.sql.exception.ExpressionEvaluationException; | |
12 | import org.opensearch.sql.expression.Expression; | |
13 | import org.opensearch.sql.expression.ReferenceExpression; | |
14 | import org.opensearch.sql.expression.env.Environment; | |
15 | ||
16 | /** | |
17 | * BindingTuple represents the a relationship between bindingName and ExprValue. | |
18 | * e.g. The operation output column name is bindingName, the value is the ExprValue. | |
19 | */ | |
20 | public abstract class BindingTuple implements Environment<Expression, ExprValue> { | |
21 | public static BindingTuple EMPTY = new BindingTuple() { | |
22 | @Override | |
23 | public ExprValue resolve(ReferenceExpression ref) { | |
24 |
1
1. resolve : replaced return value with null for org/opensearch/sql/storage/bindingtuple/BindingTuple$1::resolve → KILLED |
return ExprMissingValue.of(); |
25 | } | |
26 | }; | |
27 | ||
28 | /** | |
29 | * Resolve {@link Expression} in the BindingTuple environment. | |
30 | */ | |
31 | @Override | |
32 | public ExprValue resolve(Expression var) { | |
33 |
1
1. resolve : negated conditional → KILLED |
if (var instanceof ReferenceExpression) { |
34 |
1
1. resolve : replaced return value with null for org/opensearch/sql/storage/bindingtuple/BindingTuple::resolve → KILLED |
return resolve(((ReferenceExpression) var)); |
35 | } else { | |
36 | throw new ExpressionEvaluationException(String.format("can resolve expression: %s", var)); | |
37 | } | |
38 | } | |
39 | ||
40 | /** | |
41 | * Resolve the {@link ReferenceExpression} in BindingTuple context. | |
42 | */ | |
43 | public abstract ExprValue resolve(ReferenceExpression ref); | |
44 | } | |
Mutations | ||
24 |
1.1 |
|
33 |
1.1 |
|
34 |
1.1 |