shunping commented on code in PR #30317:
URL: https://github.com/apache/beam/pull/30317#discussion_r1635230664


##########
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/state/FakeBeamFnStateClient.java:
##########
@@ -97,6 +111,27 @@ public FakeBeamFnStateClient(Map<StateKey, KV<Coder<?>, 
List<?>>> initialData, i
                   }
                   return chunks;
                 }));
+
+    List<StateKey> orderedListStateKeys =
+        initialData.keySet().stream()
+            .filter((k) -> k.getTypeCase() == TypeCase.ORDERED_LIST_USER_STATE)
+            .collect(Collectors.toList());
+
+    this.orderedListSortKeysFromStateKey = new HashMap<>();
+    for (StateKey key : orderedListStateKeys) {
+      long sortKey = key.getOrderedListUserState().getRange().getStart();
+
+      StateKey.Builder keyBuilder = key.toBuilder();
+
+      // clear the range in the state key before using it as a key to store, 
because ordered list

Review Comment:
   The initialData is a list of entries to be stored in the ordered list, which 
is an idea borrowed from the MultimapUserStateTest. 
   
   An entry is specified by the value and a state key (including the name of 
the state and the range this entry will fall in). Multiple entries may belong 
to the same state because only the name of the state is the identifier.
   
   When we need to put these entries in the internal structure, we will remove 
the range field in the state key so that entries of the same state identifier 
will be put into one bucket.  



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