jnh5y opened a new pull request, #28155:
URL: https://github.com/apache/flink/pull/28155

   The comparator built from a single SQL > probe returned +1 or -1 and never 
0, so for equal elements compare(a,b) == compare(b,a) == -1. That violates 
antisymmetry and trips TimSort's contract check once an array is large enough 
to take the merge path (>= 32 elements with duplicates):
   
       java.lang.IllegalArgumentException: Comparison method violates its
       general contract!
           at java.util.TimSort.mergeHi(TimSort.java:903)
           ...
           at ArraySortFunction.eval(ArraySortFunction.java:91)
   
   Derive ordering from two greater-than probes - if neither side is greater, 
treat the elements as equal and return 0. This satisfies both antisymmetry and 
(for total orders) transitivity.
   
   Coverage: a new 64-element BIGINT case in CollectionFunctionsITCase 
exercises the TimSort merge path with duplicates.
   
   Generated-by: Claude (Opus 4.7)
   
   ## Verifying this change
   
   This change added tests which fails without the fix.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): *no*
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: *no*
     - The serializers: *no*
     - The runtime per-record code paths (performance sensitive): *no*
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: *no*
     - The S3 file system connector: *no*
   
   ## Documentation
   
     - Does this pull request introduce a new feature? *no*
     - If yes, how is the feature documented? *not applicable*
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   Generated-by: Claude (Opus 4.7)
   


-- 
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]

Reply via email to