Repository navigation
fix(bigtable): handle empty RowRange::EndingAt - #16647
Conversation
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.
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Summary
set_end_key_closedinRowRange::EndingAtwith!internal::IsEmptyRowKey(end), matchingRightOpen,LeftOpen,Open,Closed, andRowRange(::google::bigtable::v2::RowRange)inrow_range.cc.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("")setend_key_closed = "", which the Bigtable service treated as+infinityon the initialReadRowsRPC while client-sideAboveEnd/Intersecttreated it askey <= "", truncating remaining rows if aReadRowsstream retried.Testing
google/cloud/bigtable/row_range_test.ccandgoogle/cloud/bigtable/row_set_test.ccverifyingRowRange::EndingAt("")leavesend_keyunset (END_KEY_NOT_SET), round-trips withRowRange(proto), and preservesRowRange::Intersect/RowSet::IntersectacrossReadRowsretry narrowing.bazel test //google/cloud/bigtable:row_range_test //google/cloud/bigtable:row_set_test.