acrites commented on code in PR #30317:
URL: https://github.com/apache/beam/pull/30317#discussion_r1635143775
##########
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/state/FakeBeamFnStateClient.java:
##########
@@ -143,34 +178,162 @@ public CompletableFuture<StateResponse>
handle(StateRequest.Builder requestBuild
switch (request.getRequestCase()) {
case GET:
- List<ByteString> byteStrings =
- data.getOrDefault(request.getStateKey(),
Collections.singletonList(ByteString.EMPTY));
- int block = 0;
- if (request.getGet().getContinuationToken().size() > 0) {
- block =
Integer.parseInt(request.getGet().getContinuationToken().toStringUtf8());
- }
- ByteString returnBlock = byteStrings.get(block);
- ByteString continuationToken = ByteString.EMPTY;
- if (byteStrings.size() > block + 1) {
- continuationToken = ByteString.copyFromUtf8(Integer.toString(block +
1));
+ if (key.getTypeCase() != TypeCase.ORDERED_LIST_USER_STATE) {
Review Comment:
This if/else block might be clearer as `if (case == ORDERED_LIST) { ...}
else { ... }`. Or should we also explicitly check the other `key.getTypeCase`'s
in a further `else if` block and throw an error in a final else block?
--
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]