ryan-mbuashundip commented on code in PR #37691:
URL: https://github.com/apache/beam/pull/37691#discussion_r2880690642


##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/StateFetchingIterators.java:
##########
@@ -677,6 +683,15 @@ static class LazyBlockingStateFetchingIterator implements 
PrefetchableIterator<B
       this.continuationToken = 
stateRequestForFirstChunk.getGet().getContinuationToken();
     }
 
+    LazyBlockingStateFetchingIterator(
+        BeamFnStateClient beamFnStateClient,
+        StateRequest stateRequestForFirstChunk,
+        boolean hasNoState) {
+      this.beamFnStateClient = beamFnStateClient;
+      this.stateRequestForFirstChunk = stateRequestForFirstChunk;
+      this.continuationToken = hasNoState ? null : 
stateRequestForFirstChunk.getGet().getContinuationToken();

Review Comment:
   @Abacn Do you know what can be checked in order to verify that there is, in 
fact, state to be read from the runner without requesting that state?



##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/StateFetchingIterators.java:
##########


Review Comment:
   Calls to `seekToContinuationToken` might override the null 
`continuationToken` set in the iterator constructor, so you'll need to save the 
bit in the class and check it here to make sure the state request is never made.



##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/BagUserState.java:
##########
@@ -54,27 +54,33 @@ public class BagUserState<T> {
   private List<T> newValues;
   private boolean isCleared;
   private boolean isClosed;
+  private final boolean hasNoState;
+  private final boolean onlyBundleForKeys;
 
   static final int BAG_APPEND_BATCHING_LIMIT = 10 * 1024 * 1024;
 
   /** The cache must be namespaced for this state object accordingly. */
   public BagUserState(
-      Cache<?, ?> cache,
-      BeamFnStateClient beamFnStateClient,
-      String instructionId,
-      StateKey stateKey,
-      Coder<T> valueCoder) {
+    Cache<?, ?> cache,
+    BeamFnStateClient beamFnStateClient,
+    String instructionId,
+    StateKey stateKey,
+    Coder<T> valueCoder,
+    boolean hasNoState,
+    boolean onlyBundleForKeys) {

Review Comment:
   I think the indentation got messed up here.
   
   
   ```suggestion
           Cache<?, ?> cache,
           BeamFnStateClient beamFnStateClient,
           String instructionId,
           StateKey stateKey,
           Coder<T> valueCoder,
           boolean hasNoState,
           boolean onlyBundleForKeys) {
   ```



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