cloud-fan commented on code in PR #44538:
URL: https://github.com/apache/spark/pull/44538#discussion_r1441184040


##########
common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java:
##########
@@ -127,4 +127,27 @@ private void appendUnit(StringBuilder sb, long value, 
String unit) {
    * @throws ArithmeticException if a numeric overflow occurs
    */
   public Duration extractAsDuration() { return Duration.of(microseconds, 
ChronoUnit.MICROS); }
+
+  /**
+   * This method is not used to order CalendarInterval instances, as they are 
not orderable and
+   * can't be used in a ORDER BY statement.
+   * Instead, it is used to find identical interval instances for aggregation 
purposes.
+   * It compares the 'months', 'days', and 'microseconds' fields of this 
CalendarInterval
+   * with another instance. The comparison is done first on the 'months', then 
on the 'days',
+   * and finally on the 'microseconds'.
+   *
+   * @param o The CalendarInterval instance to compare with.
+   * @return A negative integer, zero, or a positive integer as this object is 
less than,

Review Comment:
   let's just say: `returns zero if this object is equal to the specified 
object, and non-zero otherwise.`
   
   It's a "fake order". We only need it to find identical instances, and the 
order itself has no meanings.



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