1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | ||
7 | package org.opensearch.sql.data.model; | |
8 | ||
9 | import java.util.Objects; | |
10 | import org.opensearch.sql.data.type.ExprCoreType; | |
11 | import org.opensearch.sql.data.type.ExprType; | |
12 | ||
13 | /** | |
14 | * Expression Null Value. | |
15 | */ | |
16 | public class ExprNullValue extends AbstractExprValue { | |
17 | private static final ExprNullValue instance = new ExprNullValue(); | |
18 | ||
19 | private ExprNullValue() { | |
20 | } | |
21 | ||
22 | @Override | |
23 | public int hashCode() { | |
24 |
1
1. hashCode : replaced int return with 0 for org/opensearch/sql/data/model/ExprNullValue::hashCode → KILLED |
return Objects.hashCode("NULL"); |
25 | } | |
26 | ||
27 | @Override | |
28 | public String toString() { | |
29 |
1
1. toString : replaced return value with "" for org/opensearch/sql/data/model/ExprNullValue::toString → KILLED |
return "NULL"; |
30 | } | |
31 | ||
32 | public static ExprNullValue of() { | |
33 |
1
1. of : replaced return value with null for org/opensearch/sql/data/model/ExprNullValue::of → KILLED |
return instance; |
34 | } | |
35 | ||
36 | @Override | |
37 | public Object value() { | |
38 | return null; | |
39 | } | |
40 | ||
41 | @Override | |
42 | public ExprType type() { | |
43 |
1
1. type : replaced return value with null for org/opensearch/sql/data/model/ExprNullValue::type → KILLED |
return ExprCoreType.UNDEFINED; |
44 | } | |
45 | ||
46 | @Override | |
47 | public boolean isNull() { | |
48 |
1
1. isNull : replaced boolean return with false for org/opensearch/sql/data/model/ExprNullValue::isNull → KILLED |
return true; |
49 | } | |
50 | ||
51 | @Override | |
52 | public int compare(ExprValue other) { | |
53 | throw new IllegalStateException( | |
54 | String.format("[BUG] Unreachable, Comparing with NULL is undefined")); | |
55 | } | |
56 | ||
57 | /** | |
58 | * NULL value is equal to NULL value. | |
59 | * Notes, this function should only used for Java Object Compare. | |
60 | */ | |
61 | @Override | |
62 | public boolean equal(ExprValue other) { | |
63 |
2
1. equal : replaced boolean return with false for org/opensearch/sql/data/model/ExprNullValue::equal → SURVIVED 2. equal : replaced boolean return with true for org/opensearch/sql/data/model/ExprNullValue::equal → KILLED |
return other.isNull(); |
64 | } | |
65 | } | |
Mutations | ||
24 |
1.1 |
|
29 |
1.1 |
|
33 |
1.1 |
|
43 |
1.1 |
|
48 |
1.1 |
|
63 |
1.1 2.2 |