Skip to content

Commit ba193ef

Browse files
feat(large-row-skip): added large-row-skip-callable with configurable rowadapter (#2509)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-bigtable/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Rollback plan is reviewed and LGTMed - [ ] All new data plane features have a completed end to end testing plan Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent a772103 commit ba193ef

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,46 @@ public <RowT> ServerStreamingCallable<Query, RowT> readRowsCallable(RowAdapter<R
13611361
return stub.createReadRowsCallable(rowAdapter);
13621362
}
13631363

1364+
/**
1365+
* This is an internal API, it is subject to breaking changes and should not be relied on by user
1366+
* code
1367+
*
1368+
* <p>Streams back the results of the query skipping the large-rows. This callable allows for
1369+
* customization of the logical representation of a row. It's meant for advanced use cases.
1370+
*
1371+
* <p>Sample code:
1372+
*
1373+
* <pre>{@code
1374+
* try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
1375+
* String tableId = "[TABLE]";
1376+
*
1377+
* Query query = Query.create(tableId)
1378+
* .range("[START KEY]", "[END KEY]")
1379+
* .filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));
1380+
*
1381+
* // Iterator style
1382+
* try {
1383+
* for(CustomRow row : bigtableDataClient.skipLargeRowsCallable(new CustomRowAdapter()).call(query)) {
1384+
* // Do something with row
1385+
* }
1386+
* } catch (NotFoundException e) {
1387+
* System.out.println("Tried to read a non-existent table");
1388+
* } catch (RuntimeException e) {
1389+
* e.printStackTrace();
1390+
* }
1391+
* }
1392+
* }</pre>
1393+
*
1394+
* @see ServerStreamingCallable For call styles.
1395+
* @see Query For query options.
1396+
* @see com.google.cloud.bigtable.data.v2.models.Filters For the filter building DSL.
1397+
*/
1398+
@InternalApi("only to be used by Bigtable beam connector")
1399+
public <RowT> ServerStreamingCallable<Query, RowT> skipLargeRowsCallable(
1400+
RowAdapter<RowT> rowAdapter) {
1401+
return stub.createSkipLargeRowsCallable(rowAdapter);
1402+
}
1403+
13641404
/**
13651405
* Convenience method to synchronously return a sample of row keys in the table. The returned row
13661406
* keys will delimit contiguous sections of the table of approximately equal size, which can be

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ private <ReqT, RowT> ServerStreamingCallable<ReadRowsRequest, RowT> createReadRo
538538
* <li>Add tracing & metrics.
539539
* </ul>
540540
*/
541-
private <ReqT, RowT> ServerStreamingCallable<Query, RowT> createSkipLargeRowsCallable(
541+
public <ReqT, RowT> ServerStreamingCallable<Query, RowT> createSkipLargeRowsCallable(
542542
RowAdapter<RowT> rowAdapter) {
543543

544544
ServerStreamingCallSettings<ReqT, Row> readRowsSettings =

0 commit comments

Comments
 (0)