-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Closed
Copy link
Labels
🚨This issue needs some love.This issue needs some love.api: bigqueryIssues related to the googleapis/java-bigquery API.Issues related to the googleapis/java-bigquery API.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Hi,
There is a small, but a misleading, bug in examples on how to set an expiration for the table in Java.
Relevant code:
java-bigquery/samples/snippets/src/main/java/com/example/bigquery/UpdateTableExpiration.java
Line 33 in fa998ba
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
- OS type and version: Any
- Java version: 8
- bigquery version(s): 1.133.0
Steps to reproduce
- Just try an example and your table will disappear because the expiration date will be in the past
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: bigqueryIssues related to the googleapis/java-bigquery API.Issues related to the googleapis/java-bigquery API.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.