You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/31 08:25:09 UTC

[GitHub] [spark] yaooqinn commented on a change in pull request #26337: [SPARK-29679][SQL] Make interval type comparable and orderable

yaooqinn commented on a change in pull request #26337: [SPARK-29679][SQL] Make interval type comparable and orderable
URL: https://github.com/apache/spark/pull/26337#discussion_r341006377
 
 

 ##########
 File path: common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java
 ##########
 @@ -72,6 +74,23 @@ public int hashCode() {
     return 31 * months + (int) microseconds;
   }
 
+  @Override
+  public int compare(CalendarInterval that) {
+    int mc = this.months - that.months;
+    if (mc == 0) {
+      long mic = this.microseconds - that.microseconds;
+      if (mic == 0) {
+        return 0;
+      } else if (mic > 0) {
+        return 1;
+      } else {
+        return -1;
+      }
+    } else {
+      return mc;
 
 Review comment:
   you're right, will fix this, thanks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org