1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | ||
7 | package org.opensearch.sql.ast.expression; | |
8 | ||
9 | import com.google.common.collect.ImmutableList; | |
10 | import java.util.List; | |
11 | import lombok.EqualsAndHashCode; | |
12 | import lombok.Getter; | |
13 | import lombok.RequiredArgsConstructor; | |
14 | import lombok.ToString; | |
15 | import org.opensearch.sql.ast.AbstractNodeVisitor; | |
16 | import org.opensearch.sql.ast.Node; | |
17 | ||
18 | /** | |
19 | * AST node that represents WHEN clause. | |
20 | */ | |
21 | @EqualsAndHashCode(callSuper = false) | |
22 | @Getter | |
23 | @RequiredArgsConstructor | |
24 | @ToString | |
25 | public class When extends UnresolvedExpression { | |
26 | ||
27 | /** | |
28 | * WHEN condition, either a search condition or compare value if case value present. | |
29 | */ | |
30 | private final UnresolvedExpression condition; | |
31 | ||
32 | /** | |
33 | * Result to return if condition matched. | |
34 | */ | |
35 | private final UnresolvedExpression result; | |
36 | ||
37 | @Override | |
38 | public List<? extends Node> getChild() { | |
39 |
1
1. getChild : replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/When::getChild → NO_COVERAGE |
return ImmutableList.of(condition, result); |
40 | } | |
41 | ||
42 | @Override | |
43 | public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | |
44 |
1
1. accept : replaced return value with null for org/opensearch/sql/ast/expression/When::accept → KILLED |
return nodeVisitor.visitWhen(this, context); |
45 | } | |
46 | ||
47 | } | |
Mutations | ||
39 |
1.1 |
|
44 |
1.1 |