Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

feat!: Use ReadResult instead of ResultSet; remove ResultSet #935

Merged
merged 1 commit into from
Oct 9, 2019

Conversation

scotthart
Copy link
Member

@scotthart scotthart commented Oct 8, 2019

BREAKING CHANGE: Completes refactoring and removal of ResultSet in favor of more
specific result return types. Profiling methods and result types to be added in a subsequent
PR. Possible combining of ReadResult and ExecuteQueryResult types deferred to a future
PR.


This change is Reviewable

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 8, 2019
@codecov
Copy link

codecov bot commented Oct 8, 2019

Codecov Report

Merging #935 into master will increase coverage by 0.13%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #935      +/-   ##
==========================================
+ Coverage   94.12%   94.25%   +0.13%     
==========================================
  Files          90       91       +1     
  Lines        3895     3897       +2     
==========================================
+ Hits         3666     3673       +7     
+ Misses        229      224       -5
Impacted Files Coverage Δ
google/cloud/spanner/internal/connection_impl.h 100% <ø> (ø) ⬆️
google/cloud/spanner/result_set.h 91.66% <ø> (-4.49%) ⬇️
google/cloud/spanner/client.h 100% <ø> (ø) ⬆️
google/cloud/spanner/connection.h 100% <ø> (ø) ⬆️
google/cloud/spanner/samples/samples.cc 89.76% <100%> (+0.41%) ⬆️
...ogle/cloud/spanner/mocks/mock_spanner_connection.h 53.33% <100%> (-6.67%) ⬇️
google/cloud/spanner/client.cc 96.51% <100%> (+2.32%) ⬆️
google/cloud/spanner/internal/connection_impl.cc 94.1% <52.38%> (-0.22%) ⬇️
...loud/spanner/internal/partial_result_set_resume.cc 90.9% <0%> (-4.55%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8864ec4...39bb685. Read the comment docs.

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

You may need to open some cleanup bugs to deal with the filenames and the lack of tests for ExecuteQueryResult bothers me a wee bit.

Reviewed 14 of 14 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @devbww, @devjgm, @mr-salty, and @scotthart)


google/cloud/spanner/client.h, line 78 at r1 (raw file):

 * @code
 * namespace cs = ::google::cloud::spanner;
 * using ::google::cloud::StatusOr;

nit: I think this is no longer used.


google/cloud/spanner/client.h, line 84 at r1 (raw file):

 * auto client = cs::Client(conn);
 *
 * ReadResult result = client.Read(...);

I think that should becs::ReadResult maybe?


google/cloud/spanner/result_set_test.cc, line 36 at r1 (raw file):

using ::testing::Return;

TEST(ReadResult, IterateNoRows) {

nit: the filename is a bit odd right now. And I do not see any tests for ExecuteQueryResult, both these things can be post-poned with a issue in GitHub.


google/cloud/spanner/samples/samples.cc, line 1192 at r1 (raw file):

  auto result_set = client.ExecuteQuery(*partition);
  using RowType = spanner::Row<std::int64_t, std::string, std::string>;
  for (auto const& row : result_set.Rows<RowType>()) {

nit: I am not sure we want const here.

Copy link
Member Author

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewable status: 13 of 14 files reviewed, 3 unresolved discussions (waiting on @coryan, @devbww, @devjgm, and @mr-salty)


google/cloud/spanner/client.h, line 84 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

I think that should becs::ReadResult maybe?

Done.


google/cloud/spanner/result_set_test.cc, line 36 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

nit: the filename is a bit odd right now. And I do not see any tests for ExecuteQueryResult, both these things can be post-poned with a issue in GitHub.

It's looking like ReadResult and ExecuteQueryResult are going to be merged. I'm open to suggestions for file names, and opinions on whether or not to keep all these "result" types in one file or split them up. And yes, testing needs to be added for the new types that are in a current state of flux.


google/cloud/spanner/samples/samples.cc, line 1192 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

nit: I am not sure we want const here.

Greg and I were talking earlier about what our "Best Practices" should be regarding the element type as we iterate though the collection returned from Rows(). I don't think we have a great answer yet.

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @devbww, @devjgm, @mr-salty, and @scotthart)


google/cloud/spanner/result_set_test.cc, line 36 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

It's looking like ReadResult and ExecuteQueryResult are going to be merged. I'm open to suggestions for file names, and opinions on whether or not to keep all these "result" types in one file or split them up. And yes, testing needs to be added for the new types that are in a current state of flux.

If we keep both types and we decide to keep them in the same file, then result_set.h is a good name. The alternative is to split each in its own file, does not matter much because we will force folks to include both anyway.


google/cloud/spanner/samples/samples.cc, line 1192 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

Greg and I were talking earlier about what our "Best Practices" should be regarding the element type as we iterate though the collection returned from Rows(). I don't think we have a great answer yet.

"Almost Always Const" is becoming a thing... You do not always want auto const& because sometimes the values are large and you may want to move the values out of the object referenced by the iterator.

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @devbww, @devjgm, and @mr-salty)

update documentation

address review comments
@scotthart scotthart added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 9, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 9, 2019
@scotthart scotthart merged commit c9c3e78 into googleapis:master Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants