flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhue...@apache.org
Subject flink git commit: [FLINK-2280] GenericTypeComparator.compare() respects ascending flag
Date Thu, 09 Jul 2015 08:41:32 GMT
Repository: flink
Updated Branches:
  refs/heads/master d948f1dc0 -> 590c6d064


[FLINK-2280] GenericTypeComparator.compare() respects ascending flag

This closes #894


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/590c6d06
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/590c6d06
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/590c6d06

Branch: refs/heads/master
Commit: 590c6d0644e59d0bc3b5b6f4869f91bc38864232
Parents: d948f1d
Author: Fabian Hueske <fhueske@apache.org>
Authored: Tue Jun 30 15:11:11 2015 +0200
Committer: Fabian Hueske <fhueske@apache.org>
Committed: Thu Jul 9 10:38:34 2015 +0200

----------------------------------------------------------------------
 .../flink/api/java/typeutils/runtime/GenericTypeComparator.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/590c6d06/flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/GenericTypeComparator.java
----------------------------------------------------------------------
diff --git a/flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/GenericTypeComparator.java
b/flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/GenericTypeComparator.java
index aad3c41..28fea6a 100644
--- a/flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/GenericTypeComparator.java
+++ b/flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/GenericTypeComparator.java
@@ -88,7 +88,8 @@ public class GenericTypeComparator<T extends Comparable<T>>
extends TypeComparat
 
 	@Override
 	public int compare(T first, T second) {
-		return first.compareTo(second);
+		int cmp = first.compareTo(second);
+		return this.ascending ? cmp : -cmp;
 	}
 
 	@Override


Mime
View raw message