diff --git a/java/algorithm/src/main/java/org/apache/arrow/algorithm/sort/DefaultVectorComparators.java b/java/algorithm/src/main/java/org/apache/arrow/algorithm/sort/DefaultVectorComparators.java index a6138b7a87660..2dfa0aaa7cc9f 100644 --- a/java/algorithm/src/main/java/org/apache/arrow/algorithm/sort/DefaultVectorComparators.java +++ b/java/algorithm/src/main/java/org/apache/arrow/algorithm/sort/DefaultVectorComparators.java @@ -132,14 +132,7 @@ public int compareNotNull(int index1, int index2) { } } - float result = Math.signum(value1 - value2); - if (result < 0f) { - return -1; - } else if (result > 0f) { - return 1; - } else { - return 0; - } + return (int) Math.signum(value1 - value2); } } @@ -171,14 +164,7 @@ public int compareNotNull(int index1, int index2) { } } - double result = Math.signum(value1 - value2); - if (result < 0) { - return -1; - } else if (result > 0) { - return 1; - } else { - return 0; - } + return (int) Math.signum(value1 - value2); } }