You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by mx...@apache.org on 2015/10/02 11:56:18 UTC

[3/4] flink git commit: [FLINK-1599][docs] TypeComperator with no keys and comparators matches some elements

[FLINK-1599][docs] TypeComperator with no keys and comparators matches some elements

- update JavaDoc to clarify the usage of the extractKey(..) and
  getFlatComparators() method

This closes #1207.


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

Branch: refs/heads/master
Commit: df871b3ca1effdb2f4d5cbdb9d35c62a60a1564f
Parents: 142a844
Author: Maximilian Michels <mx...@apache.org>
Authored: Thu Oct 1 17:42:42 2015 +0200
Committer: Maximilian Michels <mx...@apache.org>
Committed: Fri Oct 2 11:52:02 2015 +0200

----------------------------------------------------------------------
 .../flink/api/common/typeutils/TypeComparator.java      | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/df871b3c/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeComparator.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeComparator.java b/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeComparator.java
index f98a05e..d017694 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeComparator.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeComparator.java
@@ -288,14 +288,20 @@ public abstract class TypeComparator<T> implements Serializable {
 
 	/**
 	 * Extracts the key fields from a record. This is for use by the PairComparator to provide
-	 * interoperability between different record types.
+	 * interoperability between different record types. Note, that at least one key should be extracted.
+	 * @param record The record that contains the key(s)
+	 * @param target The array to write the key(s) into.
+	 * @param index The offset of the target array to start writing into.
 	 * @return the number of keys added to target.
 	 */
 	public abstract int extractKeys(Object record, Object[] target, int index);
 
 	/**
-	 * Get the field comparators. This is used together with {@link #extractKeys(Object, Object[], int)} to provide
-	 * interoperability between different record types.
+	 * Get the field comparators. This is used together with {@link #extractKeys(Object, Object[], int)}
+	 * to provide interoperability between different record types. Note, that this should return at
+	 * least one Comparator and that the number of Comparators must match the number of extracted
+	 * keys.
+	 * @return An Array of Comparators for the extracted keys.
 	 */
 	@SuppressWarnings("rawtypes")
 	public abstract TypeComparator[] getFlatComparators();