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

BigQuery:Java:Examples Incorrect example for setting expiration for the table #1371

Closed
mixermt opened this issue Jun 15, 2021 · 0 comments · Fixed by #1389
Closed

BigQuery:Java:Examples Incorrect example for setting expiration for the table #1371

mixermt opened this issue Jun 15, 2021 · 0 comments · Fixed by #1389
Assignees
Labels
api: bigquery Issues related to the googleapis/java-bigquery API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mixermt
Copy link

mixermt commented Jun 15, 2021

Hi,

There is a small, but a misleading, bug in examples on how to set an expiration for the table in Java.

https://cloud.google.com/bigquery/docs/managing-tables#updating_a_tables_expiration_time

Relevant code:

Long newExpiration = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);

Expiration is shown in pure milliseconds of time and not in milliseconds since the epoch like stated in method documentation.

Instead, the example should use:

Long newExpiration = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS) + ZonedDateTime.now(ZoneOffset.UTC).toInstant().toEpochMilli();

or simple

Long newExpiration = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS) + System.currentTimeMillis();

Environment details

  1. OS type and version: Any
  2. Java version: 8
  3. bigquery version(s): 1.133.0

Steps to reproduce

  1. Just try an example and your table will disappear because the expiration date will be in the past
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/java-bigquery API. label Jun 15, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 16, 2021
@stephaniewang526 stephaniewang526 self-assigned this Jun 19, 2021
@stephaniewang526 stephaniewang526 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Jun 19, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 21, 2021
@stephaniewang526 stephaniewang526 removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jun 21, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 21, 2021
@stephaniewang526 stephaniewang526 removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jun 23, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 24, 2021
stephaniewang526 added a commit to stephaniewang526/java-bigquery that referenced this issue Jun 24, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Jun 25, 2021
🤖 I have created a release \*beep\* \*boop\*
---
## [1.134.0](https://www.github.com/googleapis/java-bigquery/compare/v1.133.1...v1.134.0) (2021-06-25)


### Features

* add support for jobs.delete ([#1387](https://www.github.com/googleapis/java-bigquery/issues/1387)) ([95f1a6c](https://www.github.com/googleapis/java-bigquery/commit/95f1a6c2e3281d61d38660749cf31fa504ddf8e0))
* add support for parameterized type ([#1390](https://www.github.com/googleapis/java-bigquery/issues/1390)) ([b1fb57c](https://www.github.com/googleapis/java-bigquery/commit/b1fb57c0b43f4bdc9e32b821b32e95bb1ca8df3b)), closes [#1309](https://www.github.com/googleapis/java-bigquery/issues/1309)


### Bug Fixes

* bug fix for get method of Bigquery Dataset ([#1379](https://www.github.com/googleapis/java-bigquery/issues/1379)) ([f034a99](https://www.github.com/googleapis/java-bigquery/commit/f034a99806613fc6abb5587c56362fe38d60bebc))


### Dependencies

* update dependency com.google.apis:google-api-services-bigquery to v2-rev20210529-1.31.5 ([#1380](https://www.github.com/googleapis/java-bigquery/issues/1380)) ([4a6906a](https://www.github.com/googleapis/java-bigquery/commit/4a6906aa1e3ac139973823bdf142e5c280f6ab68))
* update dependency com.google.apis:google-api-services-bigquery to v2-rev20210611-1.31.5 ([#1383](https://www.github.com/googleapis/java-bigquery/issues/1383)) ([b09f951](https://www.github.com/googleapis/java-bigquery/commit/b09f951d9debe783c5f67c3e9479fb640722a8bd))
* update dependency com.google.cloud:google-cloud-bigtable to v1.27.0 ([#1384](https://www.github.com/googleapis/java-bigquery/issues/1384)) ([6c4d886](https://www.github.com/googleapis/java-bigquery/commit/6c4d886a3875eaed5d7c10b82f6c064c1995b6ca))


### Documentation

* **sample:** update UpdateTableExpiration sample ([#1389](https://www.github.com/googleapis/java-bigquery/issues/1389)) ([ac854c4](https://www.github.com/googleapis/java-bigquery/commit/ac854c42fa4339f688c03d121e25df6030eabd3f)), closes [#1371](https://www.github.com/googleapis/java-bigquery/issues/1371)
---


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: bigquery Issues related to the googleapis/java-bigquery API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants