Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bigtable): reverse scans #12022

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Jul 5, 2023

Fixes #12010

  • Adds a ReverseScanOption and passes its value to the sync/async row readers
  • Adds a bool reverse field to the ReadRowsParams
  • Adds a sample
  • Adds an integration test

Note that the emulator does not yet support returning rows in reverse.


This change is Reviewable

@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Jul 5, 2023
@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Patch coverage: 70.96% and project coverage change: -0.01 ⚠️

Comparison is base (c0a1706) 93.72% compared to head (b666bda) 93.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12022      +/-   ##
==========================================
- Coverage   93.72%   93.71%   -0.01%     
==========================================
  Files        2010     2010              
  Lines      174704   174761      +57     
==========================================
+ Hits       163734   163771      +37     
- Misses      10970    10990      +20     
Impacted Files Coverage Δ
google/cloud/bigtable/data_connection.h 100.00% <ø> (ø)
google/cloud/bigtable/examples/read_snippets.cc 82.73% <7.14%> (-4.51%) ⬇️
...ogle/cloud/bigtable/tests/data_integration_test.cc 96.63% <20.00%> (-1.09%) ⬇️
...oud/bigtable/internal/data_connection_impl_test.cc 96.59% <97.14%> (+0.01%) ⬆️
google/cloud/bigtable/data_connection.cc 45.76% <100.00%> (+3.94%) ⬆️
...le/cloud/bigtable/internal/data_connection_impl.cc 98.81% <100.00%> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dbolduc dbolduc marked this pull request as ready for review July 5, 2023 15:50
@dbolduc dbolduc requested a review from a team as a code owner July 5, 2023 15:50
@snippet-bot
Copy link

snippet-bot bot commented Jul 5, 2023

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Comment on lines 345 to 352
for (StatusOr<cbt::Row>& row : table.ReadRows(
cbt::RowRange::RightOpen("phone#5c10102", "phone#5c10103"), 3,
cbt::Filter::PassAllFilter(),
Options{}.set<cbt::ReverseScanOption>(true))) {
if (!row) throw std::move(row).status();
PrintRow(*row);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be getting too long for a call inside a range for. Consider:

Suggested change
for (StatusOr<cbt::Row>& row : table.ReadRows(
cbt::RowRange::RightOpen("phone#5c10102", "phone#5c10103"), 3,
cbt::Filter::PassAllFilter(),
Options{}.set<cbt::ReverseScanOption>(true))) {
if (!row) throw std::move(row).status();
PrintRow(*row);
}
auto rows = table.ReadRows(
cbt::RowRange::RightOpen("phone#5c10102", "phone#5c10103"), 3,
cbt::Filter::PassAllFilter(),
Options{}.set<cbt::ReverseScanOption>(true));
for (StatusOr<cbt::Row>& row : rows) {
if (!row) throw std::move(row).status();
PrintRow(*row);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dbolduc dbolduc force-pushed the bigtable-reverse-scans-pr-3 branch from 622b99e to b666bda Compare July 5, 2023 16:11
@dbolduc dbolduc merged commit 286a6eb into googleapis:main Jul 5, 2023
@dbolduc dbolduc deleted the bigtable-reverse-scans-pr-3 branch July 5, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support reverse scans in Bigtable
2 participants