Skip to content

Commit

Permalink
Changing max long to signed from unsigned
Browse files Browse the repository at this point in the history
Signed-off-by: expani <[email protected]>
  • Loading branch information
expani committed Dec 27, 2024
1 parent 1d66ec7 commit 2a2c955
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libs/common/src/main/java/org/opensearch/common/Numbers.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
* @opensearch.internal
*/
public final class Numbers {

public static final BigInteger MAX_SIGNED_LONG = BigInteger.valueOf(Long.MAX_VALUE);

public static final BigInteger MAX_UNSIGNED_LONG_VALUE = BigInteger.ONE.shiftLeft(64).subtract(BigInteger.ONE);
public static final BigInteger MIN_UNSIGNED_LONG_VALUE = BigInteger.ZERO;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private NumericDocValues getNumericDocValues(LeafReaderContext context, BigInteg
public Object missingObject(Object missingValue, boolean reversed) {
if (sortMissingFirst(missingValue) || sortMissingLast(missingValue)) {
final boolean min = sortMissingFirst(missingValue) ^ reversed;
return min ? Numbers.MIN_UNSIGNED_LONG_VALUE : Numbers.MAX_UNSIGNED_LONG_VALUE;
return min ? Numbers.MIN_UNSIGNED_LONG_VALUE : Numbers.MAX_SIGNED_LONG;
} else {
if (missingValue instanceof Number) {
return Numbers.toUnsignedLongExact((Number) missingValue);
Expand Down

0 comments on commit 2a2c955

Please sign in to comment.