raminqaf commented on code in PR #15601:
URL: https://github.com/apache/kafka/pull/15601#discussion_r1563929782
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/LeftOrRightValue.java:
##########
@@ -63,21 +63,6 @@ public static <V1, V2> LeftOrRightValue<V1, V2>
makeRightValue(final V2 rightVal
return new LeftOrRightValue<>(null, rightValue);
}
- /**
- * Create a new {@link LeftOrRightValue} instance with the V value as
{@code leftValue} if
- * {@code isLeftSide} is True; otherwise {@code rightValue} if {@code
isLeftSide} is False.
- *
- * @param value the V value (either V1 or V2 type)
- * @param <V> the type of the value
- * @return a new {@link LeftOrRightValue} instance
- */
- public static <V> LeftOrRightValue make(final boolean isLeftSide, final V
value) {
- Objects.requireNonNull(value, "value is null");
- return isLeftSide
- ? LeftOrRightValue.makeLeftValue(value)
- : LeftOrRightValue.makeRightValue(value);
- }
-
Review Comment:
Removed as promised 😄
##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamJoin.java:
##########
Review Comment:
Not that much has changed in this abstract class. I have moved some code in
methods.
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/TimestampedKeyAndJoinSide.java:
##########
@@ -52,7 +52,26 @@ private TimestampedKeyAndJoinSide(final boolean leftSide,
final K key, final lon
public static <K> TimestampedKeyAndJoinSide<K> make(final boolean
leftSide, final K key, final long timestamp) {
return new TimestampedKeyAndJoinSide<>(leftSide, key, timestamp);
}
-
+ /**
+ * Create a new {@link TimestampedKeyAndJoinSide} instance for the left
join side if the provide {@code key} is not {@code null}.
+ *
+ * @param key the key
+ * @param <K> the type of the key
+ * @return a new {@link TimestampedKeyAndJoinSide} instance for the left
join side if the provide {@code key} is not {@code null}
+ */
+ public static <K> TimestampedKeyAndJoinSide<K> makeLeft(final K key, final
long timestamp) {
+ return new TimestampedKeyAndJoinSide<>(true, key, timestamp);
+ }
+ /**
+ * Create a new {@link TimestampedKeyAndJoinSide} instance for the right
join side if the provide {@code key} is not {@code null}.
+ *
+ * @param key the key
+ * @param <K> the type of the key
+ * @return a new {@link TimestampedKeyAndJoinSide} instance for the right
join side if the provide {@code key} is not {@code null}
+ */
+ public static <K> TimestampedKeyAndJoinSide<K> makeRight(final K key,
final long timestamp) {
+ return new TimestampedKeyAndJoinSide<>(false, key, timestamp);
+ }
Review Comment:
@gharris1727 I have added these static factory methods for a cleaner
definition. If you prefer, I can have them removed and use the `make` method.
##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamLeftJoin.java:
##########
Review Comment:
A clean abstraction. Each join side defines its "this side value" and "other
side value".
--
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]