LuciferYang commented on a change in pull request #33260:
URL: https://github.com/apache/spark/pull/33260#discussion_r666016446



##########
File path: 
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/PrefixComparators.java
##########
@@ -141,7 +141,7 @@ public int compare(long bPrefix, long aPrefix) {
     @Override public boolean sortSigned() { return true; }
     @Override public boolean nullsFirst() { return true; }
     public int compare(long a, long b) {
-      return (a < b) ? -1 : (a > b) ? 1 : 0;
+      return Long.compare(a, b);

Review comment:
       ```
       /**
        * Compares two {@code long} values numerically.
        * The value returned is identical to what would be returned by:
        * <pre>
        *    Long.valueOf(x).compareTo(Long.valueOf(y))
        * </pre>
        *
        * @param  x the first {@code long} to compare
        * @param  y the second {@code long} to compare
        * @return the value {@code 0} if {@code x == y};
        *         a value less than {@code 0} if {@code x < y}; and
        *         a value greater than {@code 0} if {@code x > y}
        * @since 1.7
        */
       public static int compare(long x, long y) {
           return (x < y) ? -1 : ((x == y) ? 0 : 1);
       }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to