forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into numeric_exact_match
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
- Loading branch information
Showing
524 changed files
with
4,882 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
899e5cf01be55fbf094ad72b2edb0c5df99111ee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
distribution/tools/upgrade-cli/licenses/jackson-annotations-2.15.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
distribution/tools/upgrade-cli/licenses/jackson-annotations-2.16.0.jar.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dc30995f7428c0a405eba9b8c619b20d2b3b9905 |
1 change: 0 additions & 1 deletion
1
distribution/tools/upgrade-cli/licenses/jackson-databind-2.15.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
distribution/tools/upgrade-cli/licenses/jackson-databind-2.16.0.jar.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3a6b7f8ff7b30d518bbd65678e9c30cd881f19a7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
libs/common/src/main/java/org/opensearch/common/round/BidirectionalLinearSearcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.round; | ||
|
||
import org.opensearch.common.annotation.InternalApi; | ||
|
||
/** | ||
* It uses linear search on a sorted array of pre-computed round-down points. | ||
* For small inputs (≤ 64 elements), this can be much faster than binary search as it avoids the penalty of | ||
* branch mispredictions and pipeline stalls, and accesses memory sequentially. | ||
* | ||
* <p> | ||
* It uses "meet in the middle" linear search to avoid the worst case scenario when the desired element is present | ||
* at either side of the array. This is helpful for time-series data where velocity increases over time, so more | ||
* documents are likely to find a greater timestamp which is likely to be present on the right end of the array. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
@InternalApi | ||
class BidirectionalLinearSearcher implements Roundable { | ||
private final long[] ascending; | ||
private final long[] descending; | ||
|
||
BidirectionalLinearSearcher(long[] values, int size) { | ||
if (size <= 0) { | ||
throw new IllegalArgumentException("at least one value must be present"); | ||
} | ||
|
||
int len = (size + 1) >>> 1; // rounded-up to handle odd number of values | ||
ascending = new long[len]; | ||
descending = new long[len]; | ||
|
||
for (int i = 0; i < len; i++) { | ||
ascending[i] = values[i]; | ||
descending[i] = values[size - i - 1]; | ||
} | ||
} | ||
|
||
@Override | ||
public long floor(long key) { | ||
int i = 0; | ||
for (; i < ascending.length; i++) { | ||
if (descending[i] <= key) { | ||
return descending[i]; | ||
} | ||
if (ascending[i] > key) { | ||
assert i > 0 : "key must be greater than or equal to " + ascending[0]; | ||
return ascending[i - 1]; | ||
} | ||
} | ||
return ascending[i - 1]; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
libs/common/src/main/java/org/opensearch/common/round/BinarySearcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.round; | ||
|
||
import org.opensearch.common.annotation.InternalApi; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* It uses binary search on a sorted array of pre-computed round-down points. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
@InternalApi | ||
class BinarySearcher implements Roundable { | ||
private final long[] values; | ||
private final int size; | ||
|
||
BinarySearcher(long[] values, int size) { | ||
if (size <= 0) { | ||
throw new IllegalArgumentException("at least one value must be present"); | ||
} | ||
|
||
this.values = values; | ||
this.size = size; | ||
} | ||
|
||
@Override | ||
public long floor(long key) { | ||
int idx = Arrays.binarySearch(values, 0, size, key); | ||
assert idx != -1 : "key must be greater than or equal to " + values[0]; | ||
if (idx < 0) { | ||
idx = -2 - idx; | ||
} | ||
return values[idx]; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
libs/common/src/main/java/org/opensearch/common/round/Roundable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.common.round; | ||
|
||
import org.opensearch.common.annotation.InternalApi; | ||
|
||
/** | ||
* Interface to round-off values. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
@InternalApi | ||
@FunctionalInterface | ||
public interface Roundable { | ||
/** | ||
* Returns the greatest lower bound of the given key. | ||
* In other words, it returns the largest value such that {@code value <= key}. | ||
* @param key to floor | ||
* @return the floored value | ||
*/ | ||
long floor(long key); | ||
} |
Oops, something went wrong.