kmjung commented on a change in pull request #13378:
URL: https://github.com/apache/beam/pull/13378#discussion_r526457024
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.java
##########
@@ -178,6 +179,7 @@ private BigQueryStorageStreamReader(
this.parseFn = source.parseFn;
this.storageClient = source.bqServices.getStorageClient(options);
this.tableSchema = fromJsonString(source.jsonTableSchema,
TableSchema.class);
+ this.splitPossible = true;
Review comment:
Nit: I would just initialize this in the declaration above (e.g.
```private boolean splitPossible = true;```) rather than in the constructor.
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.java
##########
@@ -288,78 +290,85 @@ public synchronized void close() {
return null;
}
- SplitReadStreamRequest splitRequest =
- SplitReadStreamRequest.newBuilder()
- .setName(source.readStream.getName())
- .setFraction((float) fraction)
- .build();
-
- SplitReadStreamResponse splitResponse =
storageClient.splitReadStream(splitRequest);
- if (!splitResponse.hasPrimaryStream() ||
!splitResponse.hasRemainderStream()) {
- // No more splits are possible!
- Metrics.counter(
- BigQueryStorageStreamReader.class,
- "split-at-fraction-calls-failed-due-to-impossible-split-point")
- .inc();
- LOG.info(
- "BigQuery Storage API stream {} cannot be split at {}.",
- source.readStream.getName(),
- fraction);
- return null;
- }
+ if (splitPossible) {
Review comment:
Nit: I would structure this check as an early return (e.g. ```if
(!splitPossible) { return null; }```) rather than putting the whole
implementation into a new 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.
For queries about this service, please contact Infrastructure at:
[email protected]