chenxuesdu commented on code in PR #37459:
URL: https://github.com/apache/beam/pull/37459#discussion_r2766403704


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.java:
##########
@@ -195,13 +199,17 @@ public ProcessContinuation run(
     final Timestamp endTimestamp = partition.getEndTimestamp();
     final boolean isBoundedRestriction = 
!endTimestamp.equals(MAX_INCLUSIVE_END_AT);
     final Timestamp changeStreamQueryEndTimestamp =
-        isBoundedRestriction ? endTimestamp : 
getNextReadChangeStreamEndTimestamp();
+        isBoundedRestriction
+            ? getBoundedQueryEndTimestamp(endTimestamp)
+            : getNextReadChangeStreamEndTimestamp();
 
     // Once the changeStreamQuery completes we may need to resume reading from 
the partition if we
     // had an unbounded restriction for which we set an arbitrary query end 
timestamp and for which
     // we didn't  encounter any indications that the partition is done 
(explicit end records or
     // exceptions about being out of timestamp range).
-    boolean stopAfterQuerySucceeds = isBoundedRestriction;
+    boolean stopAfterQuerySucceeds =
+        isBoundedRestriction && 
changeStreamQueryEndTimestamp.equals(endTimestamp);

Review Comment:
   For v2 bounded query, the changeStreamQueryEndTimestamp.equals(endTimestamp) 
condition can meet, since we choose the min of the 
changeStreamQueryEndTimestamp and endTimestamp, so they will equal to each 
other sometime. Started one connector test it, it stopped after the 
endTimestamp given by user. 



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