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

docs(samples): Check for error from BatchCommitWriteStreams #940

Merged

Conversation

VeronicaWasson
Copy link
Contributor

@VeronicaWasson VeronicaWasson commented Mar 15, 2021

If the returned BatchCommitWriteStreamsResponse does not have a commit time, it means an error occurred.

@VeronicaWasson VeronicaWasson requested a review from Mar 15, 2021
@google-cla google-cla bot added the cla: yes label Mar 15, 2021
@product-auto-label product-auto-label bot added api: bigquerystorage samples labels Mar 15, 2021
@@ -90,6 +90,10 @@ public static void writePendingStream(String projectId, String datasetName, Stri
.build();
BatchCommitWriteStreamsResponse commitResponse =
client.batchCommitWriteStreams(commitRequest);
// If the response does not have a commit time, it means the commit operation failed.
if (commitResponse.hasCommitTime() == false) {
Copy link
Member

@stephaniewang526 stephaniewang526 Mar 15, 2021

Choose a reason for hiding this comment

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

Does it not return an error object in this case? User is expected to guess that something went wrong?

Copy link
Contributor Author

@VeronicaWasson VeronicaWasson Mar 15, 2021

Choose a reason for hiding this comment

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

The user can call getStreamErrorsList to get a list of StorageError's. You could use this to look at the error per stream. Does it make sense to show this?

Copy link
Member

@stephaniewang526 stephaniewang526 Mar 16, 2021

Choose a reason for hiding this comment

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

I think it would make more sense to just show the error objects rather than show hasCommitTime indirectly.

Copy link
Contributor Author

@VeronicaWasson VeronicaWasson Mar 22, 2021

Choose a reason for hiding this comment

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

Per @yirutang checking for hasCommitTime is more semantically meaningful, because that's the error condition. I added code to display the list of error messages.

Copy link
Member

@stephaniewang526 stephaniewang526 Mar 23, 2021

Choose a reason for hiding this comment

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

Got it. SGTM.

@codecov
Copy link

@codecov codecov bot commented Mar 15, 2021

Codecov Report

Merging #940 (181a2ba) into master (4a09405) will increase coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #940      +/-   ##
============================================
+ Coverage     80.92%   81.05%   +0.13%     
- Complexity     1020     1038      +18     
============================================
  Files            76       77       +1     
  Lines          5556     5632      +76     
  Branches        427      431       +4     
============================================
+ Hits           4496     4565      +69     
  Misses          884      884              
- Partials        176      183       +7     
Impacted Files Coverage Δ Complexity Δ
...oud/bigquery/storage/v1beta2/CivilTimeEncoder.java 90.78% <0.00%> (ø) 18.00% <0.00%> (?%)

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 4a09405...181a2ba. Read the comment docs.

@stephaniewang526 stephaniewang526 added kokoro:force-run automerge labels Mar 23, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run label Mar 23, 2021
@gcf-merge-on-green
Copy link

@gcf-merge-on-green gcf-merge-on-green bot commented Mar 24, 2021

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge label Mar 24, 2021
@stephaniewang526 stephaniewang526 added the automerge label Mar 24, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit ab3c145 into googleapis:master Mar 25, 2021
19 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge label Mar 25, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Mar 25, 2021
🤖 I have created a release \*beep\* \*boop\*
---
## [1.16.0](https://www.github.com/googleapis/java-bigquerystorage/compare/v1.15.1...v1.16.0) (2021-03-25)


### Features

* Add CivilTimeEncoder to encode and decode DateTime/Time as numerics ([#937](https://www.github.com/googleapis/java-bigquerystorage/issues/937)) ([969b429](https://www.github.com/googleapis/java-bigquerystorage/commit/969b4290b9934b94b1a0113e04e37ff44b2a536e))


### Bug Fixes

* add a deprecation message on StreamWriter ([#922](https://www.github.com/googleapis/java-bigquerystorage/issues/922)) ([fce5289](https://www.github.com/googleapis/java-bigquerystorage/commit/fce52890c6948a9b78a62d2fe0e4f9768d10d401))


### Dependencies

* update dependency com.google.cloud:google-cloud-bigquery to v1.127.10 ([#955](https://www.github.com/googleapis/java-bigquerystorage/issues/955)) ([c810c72](https://www.github.com/googleapis/java-bigquerystorage/commit/c810c7279bfbad31cb0f94f5ad5d4a74342d4481))
* update dependency com.google.cloud:google-cloud-bigquery to v1.127.9 ([#947](https://www.github.com/googleapis/java-bigquerystorage/issues/947)) ([d781dc5](https://www.github.com/googleapis/java-bigquerystorage/commit/d781dc5479602fee01eb971033978317e5669694))


### Documentation

* **samples:** Check for error from BatchCommitWriteStreams ([#940](https://www.github.com/googleapis/java-bigquerystorage/issues/940)) ([ab3c145](https://www.github.com/googleapis/java-bigquerystorage/commit/ab3c1453d3c1fb627e773d0e7ca4ec991f8d38b7))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage cla: yes samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants