-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
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.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.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
Environment details
- Specify the API at the beginning of the title (for example, "BigQuery: ...")
General, Core, and Other are also allowed as types - OS type and version: any
- Java version: any
- google-cloud-java version(s): 1.96.0
Steps to reproduce
Create a row with this timestamp: 1337-09-02 11:43:21.622894 UTC, query and use fieldValue.getTimestamp(). Microseconds wouldn't be equal.
Code example
@test
public void testFloatingPointPrecisionLoss() {
FieldValue fieldValue = FieldValue.of(Attribute.PRIMITIVE, "-1.9954383398377106E10");
long received = fieldValue.getTimestampValue();
long expected = -19954383398377106L;
assertEquals(expected, received);
}
Any additional information below
Cause - floating point conversation causes it; need to use BigDecimal (or equivalent) to perform lossless conversion.
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.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.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.