Skip to content

fix(bigtable): handle empty RowRange::EndingAt - #16647

Merged
sushanb merged 1 commit into
googleapis:mainfrom
sushanb:fix/bigtable-row-range-ending-at-empty
Nov 10, 2026
Merged

sushanb merged 1 commit into
googleapis:mainfrom
sushanb:fix/bigtable-row-range-ending-at-empty

Conversation

@sushanb

@sushanb sushanb commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Guard set_end_key_closed in RowRange::EndingAt with !internal::IsEmptyRowKey(end), matching RightOpen, LeftOpen, Open, Closed, and RowRange(::google::bigtable::v2::RowRange) in row_range.cc.
  • In Cloud Bigtable (google.bigtable.v2.RowRange), empty row keys are invalid and an empty end key represents the unbounded end of the table (+infinity). Previously, RowRange::EndingAt("") set end_key_closed = "", which the Bigtable service treated as +infinity on the initial ReadRows RPC while client-side AboveEnd / Intersect treated it as key <= "", truncating remaining rows if a ReadRows stream retried.

Testing

  • Added unit tests in google/cloud/bigtable/row_range_test.cc and google/cloud/bigtable/row_set_test.cc verifying RowRange::EndingAt("") leaves end_key unset (END_KEY_NOT_SET), round-trips with RowRange(proto), and preserves RowRange::Intersect / RowSet::Intersect across ReadRows retry narrowing.
  • Verified bazel test //google/cloud/bigtable:row_range_test //google/cloud/bigtable:row_set_test.

Guard set_end_key_closed in RowRange::EndingAt with !internal::IsEmptyRowKey(end), matching RightOpen, LeftOpen, Open, Closed, and the proto constructor so empty end keys leave end_key_case unset (unbounded) and preserve client/server equivalence and ReadRows stream retry narrowing.
@sushanb
sushanb requested a review from a team as a code owner November 10, 2026 17:56
@sushanb
sushanb requested a review from scotthart November 10, 2026 17:56
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Nov 10, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request attempts to handle empty row keys in RowRange::EndingAt("") by checking if the key is empty. However, the implementation skips setting end_key_closed entirely when the key is empty, which leaves it unset and causes it to be treated as an infinite range. This contradicts the intended design of encoding it as end_key_closed containing a null byte. Consequently, the added unit tests in row_range_test.cc and row_set_test.cc incorrectly assert that EndingAt("") behaves as an infinite range. The feedback recommends updating the implementation to explicitly set end_key_closed to a null byte string of length 1 for empty keys, and correcting the corresponding test assertions to reflect this behavior.

Comment thread google/cloud/bigtable/row_range.h Resolved
Comment thread google/cloud/bigtable/row_range_test.cc Resolved
Comment thread google/cloud/bigtable/row_set_test.cc Resolved
@sushanb

sushanb commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request modifies RowRange::EndingAt to check if the provided end key is empty using internal::IsEmptyRowKey before setting it as a closed end key. It also adds comprehensive unit tests in row_range_test.cc and row_set_test.cc to verify the behavior of empty row ranges and their intersections. I have no feedback to provide as the changes are correct and well-tested.

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.49%. Comparing base (5dcdef5) to head (2e84c46).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16647      +/-   ##
==========================================
- Coverage   92.53%   92.49%   -0.04%     
==========================================
  Files        2269     2269              
  Lines      222896   222937      +41     
==========================================
- Hits       206250   206203      -47     
- Misses      16646    16734      +88     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sushanb
sushanb merged commit d686734 into googleapis:main Nov 10, 2026
67 of 68 checks passed
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.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo