Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit cfc0b26

Browse files
committed
chore: Fix lint issues
1 parent 6e16c81 commit cfc0b26

4 files changed

Lines changed: 21 additions & 13 deletions

File tree

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,8 @@ && getOptions().getOpenTelemetryTracer() != null) {
20672067
try (Scope queryScope = querySpan != null ? querySpan.makeCurrent() : null) {
20682068
// If all parameters passed in configuration are supported by the query() method on the
20692069
// backend, put on fast path
2070-
QueryRequestInfo requestInfo = new QueryRequestInfo(configuration, getOptions().getDataFormatOptions());
2070+
QueryRequestInfo requestInfo =
2071+
new QueryRequestInfo(configuration, getOptions().getDataFormatOptions());
20712072
if (requestInfo.isFastQuerySupported(jobId)) {
20722073
// Be careful when setting the projectID in JobId, if a projectID is specified in the JobId,
20732074
// the job created by the query method will use that project. This may cause the query to

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ public void setThrowNotFound(boolean setThrowNotFound) {
230230
* Builder#setDataFormatOptions(DataFormatOptions)} to set the int64timestamp configuration
231231
* instead.
232232
*
233-
* <p>If useInt64Timestamps is set via DataFormatOptions, then that value will be used.
233+
* <p>If useInt64Timestamps is set via DataFormatOptions, then that value in DataFormatOptions
234+
* will be used.
234235
*
235236
* <p>{@code DataFormatOptions.newBuilder().setUseInt64Timestamp(...).build()}
236237
*/
@@ -251,8 +252,9 @@ public boolean getThrowNotFound() {
251252
}
252253

253254
/**
254-
* This getter is marked as Obsolete. Prefer {@link #getDataFormatOptions().isUseInt64Timestamp()}
255-
* to set the int64timestamp configuration instead.
255+
* This getter is marked as Obsolete. Prefer {@link
256+
* DataFormatOptions.Builder#useInt64Timestamp(boolean)} to set the int64timestamp configuration
257+
* instead.
256258
*/
257259
@ObsoleteApi("Use getDataFormatOptions().isUseInt64Timestamp() instead")
258260
public boolean getUseInt64Timestamps() {

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DataFormatOptions.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
package com.google.cloud.bigquery;
1717

1818
import com.google.auto.value.AutoValue;
19-
import org.jspecify.annotations.Nullable;
20-
2119
import java.io.Serializable;
20+
import javax.annotation.Nullable;
2221

2322
/**
2423
* Google BigQuery DataFormatOptions. Configures the output format for data types returned from
@@ -50,8 +49,7 @@ public String toString() {
5049
public abstract TimestampFormatOptions timestampFormatOptions();
5150

5251
public static Builder newBuilder() {
53-
return new AutoValue_DataFormatOptions.Builder()
54-
.useInt64Timestamp(false);
52+
return new AutoValue_DataFormatOptions.Builder().useInt64Timestamp(false);
5553
}
5654

5755
public abstract Builder toBuilder();
@@ -85,9 +83,14 @@ com.google.api.services.bigquery.model.DataFormatOptions toPb() {
8583
}
8684

8785
DataFormatOptions fromPb(com.google.api.services.bigquery.model.DataFormatOptions request) {
88-
return new AutoValue_DataFormatOptions.Builder()
89-
.useInt64Timestamp(request.getUseInt64Timestamp())
90-
.timestampFormatOptions(TimestampFormatOptions.valueOf(request.getTimestampOutputFormat()))
91-
.build();
86+
AutoValue_DataFormatOptions.Builder builder = new AutoValue_DataFormatOptions.Builder();
87+
if (request.getUseInt64Timestamp() != null) {
88+
builder.useInt64Timestamp(request.getUseInt64Timestamp());
89+
}
90+
if (request.getTimestampOutputFormat() != null) {
91+
builder.timestampFormatOptions(
92+
TimestampFormatOptions.valueOf(request.getTimestampOutputFormat()));
93+
}
94+
return builder.build();
9295
}
9396
}

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestInfoTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ public void testInt64Timestamp() {
195195
assertFalse(requestPb.getFormatOptions().getUseInt64Timestamp());
196196

197197
QueryRequestInfo requestInfoLosslessTs =
198-
new QueryRequestInfo(QUERY_JOB_CONFIGURATION, DataFormatOptions.newBuilder().useInt64Timestamp(true).build());
198+
new QueryRequestInfo(
199+
QUERY_JOB_CONFIGURATION,
200+
DataFormatOptions.newBuilder().useInt64Timestamp(true).build());
199201
QueryRequest requestLosslessTsPb = requestInfoLosslessTs.toPb();
200202
assertTrue(requestLosslessTsPb.getFormatOptions().getUseInt64Timestamp());
201203
}

0 commit comments

Comments
 (0)