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 Tue, 14 Jul 2015 09:18:01 GMT
Repository: flink
Updated Branches:
  refs/heads/release-0.9 acd43176e -> 451eb8245


[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/451eb824
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/451eb824
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/451eb824

Branch: refs/heads/release-0.9
Commit: 451eb82459f6ba49d0503b1ed2e4248b691574ff
Parents: acd4317
Author: Fabian Hueske <fhueske@apache.org>
Authored: Tue Jun 30 15:11:11 2015 +0200
Committer: Fabian Hueske <fhueske@apache.org>
Committed: Tue Jul 14 11:17:47 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/451eb824/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