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

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

@VeronicaWasson VeronicaWasson requested a review from a team March 15, 2021 18:33
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 15, 2021
@product-auto-label product-auto-label bot added api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. samples Issues that are directly related to 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
Contributor

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

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
Contributor

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

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
Contributor

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 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 Add this label to force Kokoro to re-run the tests. automerge Merge the pull request once unit tests and other checks pass. labels Mar 23, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 23, 2021
@gcf-merge-on-green
Copy link

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 Merge the pull request once unit tests and other checks pass. label Mar 24, 2021
@stephaniewang526 stephaniewang526 added the automerge Merge the pull request once unit tests and other checks pass. label Mar 24, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit ab3c145 into googleapis:master Mar 25, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Mar 25, 2021
gcf-merge-on-green bot pushed a commit that referenced this pull request 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).
shubhwip pushed a commit to shubhwip/java-bigquerystorage that referenced this pull request Oct 7, 2023
🤖 I have created a release *beep* *boop*
---


## [0.124.7](googleapis/java-storage-nio@v0.124.6...v0.124.7) (2022-06-29)


### Dependencies

* update dependency com.google.cloud:google-cloud-storage to v2.9.0 ([googleapis#939](googleapis/java-storage-nio#939)) ([ae5d294](googleapis/java-storage-nio@ae5d294))

---
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 Issues related to the googleapis/java-bigquerystorage API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants