darshan-sj commented on code in PR #40489:
URL: https://github.com/apache/beam/pull/40489#discussion_r4279360728
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java:
##########
@@ -2937,6 +2972,14 @@ private Options.TransactionOption[]
getTransactionOptions() {
? Options.maxCommitDelay(
java.time.Duration.ofMillis(
spannerConfig.getMaxCommitDelay().get().getMillis()))
+ : null,
+ spannerConfig.getExcludeTxnFromChangeStreams() != null
+ &&
Boolean.TRUE.equals(spannerConfig.getExcludeTxnFromChangeStreams().get())
Review Comment:
1. The `Options.excludeTxnFromChangeStreams()` only sets the flag to true.
There is no `Options.excludeTxnFromChangeStreams(boolean)` method. So, we need
to call `Options.excludeTxnFromChangeStreams()` only when we want to set it to
true.
2. The null check is not needed because `Boolean.TRUE.equals(null)`
evaluates to false and does not lead to NullPointerException.
##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIOWriteTest.java:
##########
@@ -319,6 +319,57 @@ public void runBatchQueryTestWithMaxCommitDelay() {
}));
}
+ @Test
+ public void runBatchQueryTestWithExcludeTxnFromChangeStreams() {
+ SpannerIO.Write write =
+ SpannerIO.write()
+ .withSpannerConfig(SPANNER_CONFIG)
+ .withServiceFactory(serviceFactory)
+ .withExcludeTxnFromChangeStreams(true);
Review Comment:
Done
--
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]