You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/03/17 03:08:10 UTC
[GitHub] [beam] thiagotnunes commented on a change in pull request #17023: [BEAM-12164]: Remove child partition query workaround
thiagotnunes commented on a change in pull request #17023:
URL: https://github.com/apache/beam/pull/17023#discussion_r828716251
##########
File path: sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/DetectNewPartitionsDoFn.java
##########
@@ -109,9 +110,7 @@ public Instant getInitialWatermarkEstimatorState(@Element PartitionMetadata part
public TimestampRange initialRestriction(@Element PartitionMetadata partition) {
final com.google.cloud.Timestamp createdAt = partition.getCreatedAt();
return TimestampRange.of(
- com.google.cloud.Timestamp.ofTimeSecondsAndNanos(
- createdAt.getSeconds(), createdAt.getNanos() - 1),
- com.google.cloud.Timestamp.MAX_VALUE);
+ TimestampUtils.previous(createdAt), com.google.cloud.Timestamp.MAX_VALUE);
Review comment:
Makes sure there is no underflow here by using `TimestampUtils.previous` instead of simply subtracting `1ns`
##########
File path: sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dofn/ReadChangeStreamPartitionDoFn.java
##########
@@ -130,8 +130,7 @@ public TimestampRange initialRestriction(@Element PartitionMetadata partition) {
final com.google.cloud.Timestamp startTimestamp = partition.getStartTimestamp();
// Range represents closed-open interval
final com.google.cloud.Timestamp endTimestamp =
- ofTimeSecondsAndNanos(
- partition.getEndTimestamp().getSeconds(), partition.getEndTimestamp().getNanos() + 1);
+ TimestampUtils.next(partition.getEndTimestamp());
Review comment:
Makes sure there is no overflow here by using `TimestampUtils.next` instead of simply adding `1ns`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org