You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2022/01/13 23:57:21 UTC

[GitHub] [samza] xinyuiscool commented on a change in pull request #1560: SAMZA-2709: Adding partial update api to Table API

xinyuiscool commented on a change in pull request #1560:
URL: https://github.com/apache/samza/pull/1560#discussion_r784410391



##########
File path: samza-api/src/main/java/org/apache/samza/table/Table.java
##########
@@ -38,7 +38,7 @@
  * <p>

Review comment:
       I think we should add a section to the table api page to include the partial update feature. Since this pr is already very big, I suggest open another pr for the doc change. What do you think?

##########
File path: samza-api/src/main/java/org/apache/samza/operators/MessageStream.java
##########
@@ -291,12 +291,34 @@
    * scheme when propogated to next operator.
    *
    * @param table the table to write messages to
-   * @param args additional arguments passed to the table
    * @param <K> the type of key in the table
    * @param <V> the type of record value in the table
    * @return this {@link MessageStream}
    */
-  <K, V> MessageStream<KV<K, V>> sendTo(Table<KV<K, V>> table, Object ... args);
+  <K, V> MessageStream<KV<K, V>> sendTo(Table<KV<K, V>> table);
+
+  /**
+   * Allows sending update messages in this {@link MessageStream} to a {@link Table} and then propagates this
+   * {@link MessageStream} to the next chained operator. The type of input message is expected to be {@link KV},
+   * otherwise a {@link ClassCastException} will be thrown. The value is an UpdateMessage- update and default value.
+   * Defaults are optional and can be used if the Remote Table integration supports inserting a default through PUT in
+   * the event an update fails due to an existing record being absent.
+   * The user also needs to pass UpdateContract argument which defines whether the update is an update only operation
+   * or a update with default.
+   * <p>
+   * Note: The update will be written but may not be flushed to the underlying table before its propagated to the
+   * chained operators. Whether the message can be read back from the Table in the chained operator depends on whether
+   * it was flushed and whether the Table offers read after write consistency. Messages retain the original partitioning
+   * scheme when propagated to next operator.
+   *
+   * @param table the table to write update messages to
+   * @param contract Update contract which defines how the update will be performed
+   * @param <K> the type of key in the table
+   * @param <V> the type of record value in the table
+   * @param <U> the type of update value for the table
+   * @return this {@link MessageStream}
+   */
+  <K, V, U> MessageStream<KV<K, UpdateMessage<U, V>>> sendTo(Table<KV<K, V>> table, UpdateContract contract);

Review comment:
       Nit-pick: this name is a bit hard to me to understand. maybe UpdateOptions or UpdateArguments?




-- 
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: commits-unsubscribe@samza.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org