mutianf commented on code in PR #34245:
URL: https://github.com/apache/beam/pull/34245#discussion_r2058994502
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -631,6 +631,24 @@ public Read withMaxBufferElementCount(@Nullable Integer
maxBufferElementCount) {
.build();
}
+ /**
+ * Returns a new {@link BigtableIO.Read} that will skip the large rows
while reading. This
+ * function will switch the base BigtableIO.Reader class to using the
+ * BigtableReaderWithExperimentalOptions. If
+ *
+ * <p>Does not modify this object.
+ *
+ * <p>This is incompatible with withMaxBufferElementCount()
+ */
+ public Read withExperimentalSkipLargeRows(@Nullable Boolean skipLargeRows)
{
Review Comment:
Let's use the experimental flag because it's not final state we want to
have. The example code Igor mentioned:
https://github.com/apache/beam/blob/3b5a2b67bb64e8649116f395586f6265c463c759/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableServiceFactory.java#L131
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableServiceImpl.java:
##########
@@ -174,10 +177,18 @@ public boolean start() throws IOException {
query.filter(Filters.FILTERS.fromProto(rowFilter));
}
try {
- stream =
- client
- .readRowsCallable(new BigtableRowProtoAdapter())
- .call(query, GrpcCallContext.createDefault());
+ if (bigtableReadOptions != null
+ &&
Boolean.TRUE.equals(bigtableReadOptions.getExperimentalSkipLargeRows())) {
+ stream =
+ client
+ .skipLargeRowsCallable(new BigtableRowProtoAdapter())
+ .call(query, GrpcCallContext.createDefault());
+ } else {
+ stream =
+ client
+ .readRowsCallable(new BigtableRowProtoAdapter())
+ .call(query, GrpcCallContext.createDefault());
+ }
Review Comment:
I think you can pass in a unary callable when creating the
BigtableReaderImpl instead of the client:
https://github.com/apache/beam/blob/3b5a2b67bb64e8649116f395586f6265c463c759/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableServiceImpl.java#L653-L672
--
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]