-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: Add CivilTimeEncoder to encode and decode DateTime/Time as numerics #937
feat: Add CivilTimeEncoder to encode and decode DateTime/Time as numerics #937
Conversation
...igquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoder.java
Show resolved
Hide resolved
...igquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoder.java
Outdated
Show resolved
Hide resolved
...igquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoder.java
Outdated
Show resolved
Hide resolved
...ge/src/test/java/com/google/cloud/bigquery/storage/v1beta2/it/ITBigQueryTimeEncoderTest.java
Outdated
Show resolved
Hide resolved
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Outdated
Show resolved
Hide resolved
Java LocalTime and LocalDateTime use Java 8 so will need to be reverted back to using Joda time so as not to change the language level. |
Codecov Report
@@ Coverage Diff @@
## master #937 +/- ##
============================================
- Coverage 81.14% 80.86% -0.29%
- Complexity 996 1038 +42
============================================
Files 74 77 +3
Lines 5347 5645 +298
Branches 415 436 +21
============================================
+ Hits 4339 4565 +226
- Misses 838 897 +59
- Partials 170 183 +13 Continue to review full report at Codecov.
|
Not a |
not sure how I misnamed this so badly. This should be adding in the feature CivilTimeEncoder, I will rename the subject and the initial commit, but should I still use test instead of feat? |
… table insertion holds up
…s/java-bigquerystorage into jstocklass-bug-fix
@yirutang PTAL |
...igquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoder.java
Outdated
Show resolved
Hide resolved
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Show resolved
Hide resolved
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Show resolved
Hide resolved
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Outdated
Show resolved
Hide resolved
...ge/src/test/java/com/google/cloud/bigquery/storage/v1beta2/it/ITBigQueryTimeEncoderTest.java
Outdated
Show resolved
Hide resolved
@yirutang PTAL. I've removed the e2e test for another PR where we can change the mapping function as well. |
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.
Almost there.
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Outdated
Show resolved
Hide resolved
...erystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
Show resolved
Hide resolved
I think you are missing a t at the end?
…On Tue, Mar 16, 2021 at 10:08 AM JacobStocklass ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
<#937 (comment)>
:
> + // 0b000000000000000000000000000|01101|001110|001111|00000011111010000000
+ // 0xD38F03E80
+ assertEquals(
+ 0xD38F03E80L,
+ CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(13, 14, 15, 16_000_000)));
+ // 23:59:59.999000
+ // 0b000000000000000000000000000|10111|111011|111011|11110011111001011000
+ // 0x17EFBF3E58
+ assertEquals(
+ 0x17EFBF3E58L,
+ CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(23, 59, 59, 999_000_000)));
+ }
+
+ @test
+ public void encodePacked64TimeMicros_giveErrorWhenDataIsLos() {
+
I might change the name from DataLost to PrecisionLost
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#937 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHGYVEVXZWUOYLX6DCUPNV3TD6GA7ANCNFSM4ZBGWE7A>
.
--
Thanks.
Yiru
|
Yeah, putting them together is easier to see.
…On Tue, Mar 16, 2021 at 10:13 AM JacobStocklass ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/CivilTimeEncoderTest.java
<#937 (comment)>
:
> +import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.threeten.bp.LocalDateTime;
+import org.threeten.bp.LocalTime;
+
***@***.***(JUnit4.class)
+public class CivilTimeEncoderTest {
+ private static final Logger LOG = Logger.getLogger(CivilTimeEncoderTest.class.getName());
+
+ // Time
+ @test
+ public void encodePacked64TimeMicros_validTime() {
+ // 00:00:00.000000
+ // 0b000000000000000000000000000|00000|000000|000000|00000000000000000000
+ // 0x0
+ assertEquals(0x0L, CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(0, 0, 0, 0)));
I do have those cases in the
decodePackd64TimeMicros_validBitFieldTimeMircros() test. Should they be
combined into one test?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#937 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHGYVEQUQYB3RGK4IYRA3Y3TD6GVFANCNFSM4ZBGWE7A>
.
--
Thanks.
Yiru
|
@yirutang I've made the tweeks to the test code and I think it reads a bit easier now |
@stephaniewang526 Hey Stephanie are you able to merge this PR? I believe it is ready |
🤖 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).
) * chore: update dependencies for regapic * add more dependencies and trigger comment * update goldens * fix indentation * remove duplicate gax-httpjson dependency * remove duplicated dependencies Source-Link: googleapis/synthtool@fa54eb2 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️