This is an automated email from the ASF dual-hosted git repository.

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a3d2be3 Fix bug of "Comparison method violates its general contract" 
(#315)
4a3d2be3 is described below

commit 4a3d2be36795df2eaf2edbe75ecc5816bf7eb87a
Author: Junfan Zhang <[email protected]>
AuthorDate: Sat Nov 12 17:09:05 2022 +0800

    Fix bug of "Comparison method violates its general contract" (#315)
    
    ### What changes were proposed in this pull request?
    Fix bug of "Comparison method violates its general contract"
    
    ### Why are the changes needed?
    If not, it will throw the exception when using the timsort.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Dont need
---
 .../src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java 
b/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java
index 724fc6bc..fdec31f6 100644
--- a/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java
+++ b/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java
@@ -83,7 +83,7 @@ public class ShuffleBuffer {
     // buffer will be cleared, and new list must be created for async flush
     List<ShufflePartitionedBlock> spBlocks = new LinkedList<>(blocks);
     if (dataDistributionType == ShuffleDataDistributionType.LOCAL_ORDER) {
-      spBlocks.sort((o1, o2) -> o1.getTaskAttemptId() - o2.getTaskAttemptId() 
> 0 ? 1 : -1);
+      spBlocks.sort((o1, o2) -> new 
Long(o1.getTaskAttemptId()).compareTo(o2.getTaskAttemptId()));
     }
     long eventId = ShuffleFlushManager.ATOMIC_EVENT_ID.getAndIncrement();
     final ShuffleDataFlushEvent event = new ShuffleDataFlushEvent(

Reply via email to