1 | /* | |
2 | * Copyright OpenSearch Contributors | |
3 | * SPDX-License-Identifier: Apache-2.0 | |
4 | */ | |
5 | ||
6 | ||
7 | package org.opensearch.sql.data.utils; | |
8 | ||
9 | import com.google.common.collect.Ordering; | |
10 | import java.util.Comparator; | |
11 | import lombok.RequiredArgsConstructor; | |
12 | import org.opensearch.sql.data.model.ExprValue; | |
13 | ||
14 | /** | |
15 | * Idea from guava {@link Ordering}. The only difference is the special logic to handle {@link | |
16 | * org.opensearch.sql.data.model.ExprNullValue} and {@link | |
17 | * org.opensearch.sql.data.model.ExprMissingValue} | |
18 | */ | |
19 | @RequiredArgsConstructor | |
20 | public abstract class ExprValueOrdering implements Comparator<ExprValue> { | |
21 | ||
22 | public static ExprValueOrdering natural() { | |
23 |
1
1. natural : replaced return value with null for org/opensearch/sql/data/utils/ExprValueOrdering::natural → KILLED |
return NaturalExprValueOrdering.INSTANCE; |
24 | } | |
25 | ||
26 | public ExprValueOrdering reverse() { | |
27 |
1
1. reverse : replaced return value with null for org/opensearch/sql/data/utils/ExprValueOrdering::reverse → KILLED |
return new ReverseExprValueOrdering(this); |
28 | } | |
29 | ||
30 | public ExprValueOrdering nullsFirst() { | |
31 |
1
1. nullsFirst : replaced return value with null for org/opensearch/sql/data/utils/ExprValueOrdering::nullsFirst → KILLED |
return new NullsFirstExprValueOrdering(this); |
32 | } | |
33 | ||
34 | public ExprValueOrdering nullsLast() { | |
35 |
1
1. nullsLast : replaced return value with null for org/opensearch/sql/data/utils/ExprValueOrdering::nullsLast → KILLED |
return new NullsLastExprValueOrdering(this); |
36 | } | |
37 | ||
38 | // Never make these public | |
39 | static final int LEFT_IS_GREATER = 1; | |
40 | static final int RIGHT_IS_GREATER = -1; | |
41 | } | |
Mutations | ||
23 |
1.1 |
|
27 |
1.1 |
|
31 |
1.1 |
|
35 |
1.1 |