lhotari commented on PR #24759:
URL: https://github.com/apache/pulsar/pull/24759#issuecomment-3322620545

   @Meet0861 Thanks for the effort of debugging and drilling down to the root 
cause.
   Since the compareTo contracts were violated in NamespaceBundleStats, 
TimeAverageMessageData and ResourceUnitRanking classes, I have addressed those 
in an alternative approach to address the issue, #24772. It wouldn't have been 
useful to keep the invalid implementations since they could have caused similar 
problems in the future when sorting would have been used. The main purpose of 
`compareTo` methods is sorting.
   The original reason for the `Math.abs` was to compare with a coarse 
granularity (or resolution). I have addressed that without `Math.abs` in the PR 
so that the value is divided by the comparison resolution/granularity at 
comparison. The behavior isn't exactly the same as `Math.abs`, but it does 
retain the behavior of comparing at the desired level of granularity.
   Since the `compareTo` methods are now fixed with #24772, it won't be 
necessary to have custom comparators that this PR provides.


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