afedulov commented on code in PR #19405:
URL: https://github.com/apache/flink/pull/19405#discussion_r854161245
##########
flink-end-to-end-tests/flink-end-to-end-tests-elasticsearch-common/src/main/java/org/apache/flink/streaming/tests/KeyValue.java:
##########
@@ -0,0 +1,74 @@
+package org.apache.flink.streaming.tests;
+
+import org.apache.flink.util.StringUtils;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/** A {@link Comparable} holder for key-value pairs. */
+public class KeyValue<K extends Comparable<? super K>, V extends Comparable<?
super V>>
+ implements Comparable<KeyValue<K, V>>, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /** The key of the key-value pair. */
+ public K key;
+ /** The value the key-value pair. */
+ public V value;
+
+ /** Creates a new key-value pair where all fields are null. */
+ public KeyValue() {}
+
+ private KeyValue(K key, V value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public int compareTo(KeyValue<K, V> other) {
Review Comment:
That could work but would make `Tuple2` somewhat special, not sure if we
want this for consistency reasons. An alternative is to define `Tuple` as
comparable, but that would mean adding `compareTo` to 73 classes, including
test utilities across the framework. Having a separate `KeyValue` class seems
like a good alternative to both of those approaches. WDYT?
--
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]