Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15907#discussion_r88794022
  
    --- Diff: 
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java 
---
    @@ -40,28 +42,28 @@
        *         of always copying the data back to position zero for 
efficiency.
        */
       public static int sort(
    -      LongArray array, int numRecords, int startByteIndex, int 
endByteIndex,
    +      LongArray array, long numRecords, int startByteIndex, int 
endByteIndex,
           boolean desc, boolean signed) {
         assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") 
should >= 0";
         assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should 
<= 7";
         assert endByteIndex > startByteIndex;
         assert numRecords * 2 <= array.size();
    -    int inIndex = 0;
    -    int outIndex = numRecords;
    +    long inIndex = 0;
    +    long outIndex = numRecords;
         if (numRecords > 0) {
           long[][] counts = getCounts(array, numRecords, startByteIndex, 
endByteIndex);
           for (int i = startByteIndex; i <= endByteIndex; i++) {
             if (counts[i] != null) {
               sortAtByte(
                 array, numRecords, counts[i], i, inIndex, outIndex,
                 desc, signed && i == endByteIndex);
    -          int tmp = inIndex;
    +          long tmp = inIndex;
               inIndex = outIndex;
               outIndex = tmp;
             }
           }
         }
    -    return inIndex;
    +    return Ints.checkedCast(inIndex);
    --- End diff --
    
    It might make sense to add a very simple if check in the beginning of this 
function. I will do it when I merge this.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to