-
Notifications
You must be signed in to change notification settings - Fork 418
feat(bigtable): add support for STRUCT #15568
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15568 +/- ##
==========================================
- Coverage 93.08% 93.08% -0.01%
==========================================
Files 2418 2418
Lines 221886 222131 +245
==========================================
+ Hits 206553 206769 +216
- Misses 15333 15362 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cc45d4f
to
fbaac2b
Compare
This can likely be addressed with template functions. Will address cognitive penalty error.:
|
I would just try factoring out the more complicated Equals checks into separate functions. |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of google::bigtable::v2::Value::array_value is used to represent arrays, structs, and maps, let's add some tests to make sure testing for equality between a struct and array is false and attempting to convert one type into the other fail with correct error messages.
@scotthart reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 6 unresolved discussions
google/cloud/bigtable/value.h
line 504 at r2 (raw file):
static StatusOr<std::tuple<Ts...>> GetValue( std::tuple<Ts...> const&, V&& pv, google::bigtable::v2::Type const& pt) { if (!pv.has_array_value()) {
Per https://github.com/googleapis/googleapis/blob/374928c41762db87a25977ea3de13b62225bddb8/google/bigtable/v2/data.proto#L150, do we also need to check the type on the outermost value, in order to verify it is a struct?
google/cloud/bigtable/value.h
line 516 at r2 (raw file):
// A functor to be used with internal::ForEach to extract C++ types from a // ListValue proto and store then in a tuple.
ListValue is a specific "well known" protobuf type, that I don't think Bigtable is using (Spanner does however).
google/cloud/bigtable/value.h
line 525 at r2 (raw file):
template <typename T> void operator()(T& t) { auto&& e = GetProtoListValueElement(std::forward<V>(pv), i);
Either we're using the wrong function here, or we need to rename it to not specify "ListValue".
google/cloud/bigtable/value.cc
line 112 at r2 (raw file):
} // Compares two sets of Type and Value protos that represent a STRUCT for
s/STRUCT/ARRAY ?
google/cloud/bigtable/value.cc
line 113 at r2 (raw file):
// Compares two sets of Type and Value protos that represent a STRUCT for // equality. This method calls Equals() recursively to compare subtypes and
Can probably omit the recursive comment.
google/cloud/bigtable/value.cc
line 115 at r2 (raw file):
// equality. This method calls Equals() recursively to compare subtypes and // subvalues. bool ArrayEqual( // NOLINT(misc-no-recursion)
Is this linter annotation necessary?
This change is