y1chi commented on code in PR #23491:
URL: https://github.com/apache/beam/pull/23491#discussion_r993973863


##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/FnApiStateAccessor.java:
##########
@@ -576,6 +577,17 @@ public ReadableState<Boolean> readLater() {
             });
   }
 
+  @Override
+  public <KeyT, ValueT> MultimapState<KeyT, ValueT> bindMultimap(
+      String id,
+      StateSpec<MultimapState<KeyT, ValueT>> spec,
+      Coder<KeyT> keyCoder,
+      Coder<ValueT> valueCoder) {
+    throw new UnsupportedOperationException(
+        "TODO(https://github.com/apache/beam/issues/23616): Add support for a 
multimap"

Review Comment:
   Maybe just move the TODO as a comment and the exception just says multimap 
not supported.



##########
sdks/java/core/src/main/java/org/apache/beam/sdk/state/StateSpecs.java:
##########
@@ -733,6 +771,69 @@ public int hashCode() {
     }
   }
 
+  private static class MultimapStateSpec<K, V> implements 
StateSpec<MultimapState<K, V>> {
+
+    private @Nullable Coder<K> keyCoder;
+    private @Nullable Coder<V> valueCoder;
+
+    private MultimapStateSpec(@Nullable Coder<K> keyCoder, @Nullable Coder<V> 
valueCoder) {
+      this.keyCoder = keyCoder;
+      this.valueCoder = valueCoder;
+    }
+
+    @Override
+    public MultimapState<K, V> bind(String id, StateBinder visitor) {
+      return visitor.bindMultimap(id, this, keyCoder, valueCoder);
+    }
+
+    @Override
+    public <ResultT> ResultT match(Cases<ResultT> cases) {
+      return cases.dispatchMap(keyCoder, valueCoder);

Review Comment:
   dispatchMultiMap()?



-- 
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]

Reply via email to