1717package com .google .cloud .bigquery ;
1818
1919import com .google .api .core .BetaApi ;
20+ import com .google .api .core .ObsoleteApi ;
2021import com .google .api .gax .retrying .ResultRetryAlgorithm ;
2122import com .google .cloud .ServiceDefaults ;
2223import com .google .cloud .ServiceOptions ;
@@ -41,6 +42,7 @@ public class BigQueryOptions extends ServiceOptions<BigQuery, BigQueryOptions> {
4142 // set the option ThrowNotFound when you want to throw the exception when the value not found
4243 private boolean setThrowNotFound ;
4344 private boolean useInt64Timestamps ;
45+ private final DataFormatOptions dataFormatOptions ;
4446 private JobCreationMode defaultJobCreationMode = JobCreationMode .JOB_CREATION_MODE_UNSPECIFIED ;
4547 private boolean enableOpenTelemetryTracing ;
4648 private Tracer openTelemetryTracer ;
@@ -70,6 +72,7 @@ public static class Builder extends ServiceOptions.Builder<BigQuery, BigQueryOpt
7072
7173 private String location ;
7274 private boolean useInt64Timestamps ;
75+ private DataFormatOptions dataFormatOptions = DataFormatOptions .newBuilder ().build ();
7376 private boolean enableOpenTelemetryTracing ;
7477 private Tracer openTelemetryTracer ;
7578 private ResultRetryAlgorithm <?> resultRetryAlgorithm ;
@@ -94,11 +97,31 @@ public Builder setLocation(String location) {
9497 return this ;
9598 }
9699
100+ /**
101+ * This setter is marked as Obsolete. Prefer {@link #setDataFormatOptions(DataFormatOptions)} to
102+ * set the int64timestamp configuration instead.
103+ *
104+ * <p>If useInt64Timestamps value is set in here and via DataFormatOptions, the
105+ * DataFormatOptions configuration value is used.
106+ *
107+ * <p>{@code DataFormatOptions.newBuilder().setUseInt64Timestamp(...).build()}
108+ */
109+ @ ObsoleteApi ("Use setDataFormatOptions(DataFormatOptions) instead" )
97110 public Builder setUseInt64Timestamps (boolean useInt64Timestamps ) {
98111 this .useInt64Timestamps = useInt64Timestamps ;
99112 return this ;
100113 }
101114
115+ /**
116+ * Set the format options for the BigQuery data types
117+ *
118+ * @param dataFormatOptions Configuration of the formatting options
119+ */
120+ public Builder setDataFormatOptions (DataFormatOptions dataFormatOptions ) {
121+ this .dataFormatOptions = dataFormatOptions ;
122+ return this ;
123+ }
124+
102125 /**
103126 * Enables OpenTelemetry tracing functionality for this BigQuery instance
104127 *
@@ -136,6 +159,7 @@ private BigQueryOptions(Builder builder) {
136159 super (BigQueryFactory .class , BigQueryRpcFactory .class , builder , new BigQueryDefaults ());
137160 this .location = builder .location ;
138161 this .useInt64Timestamps = builder .useInt64Timestamps ;
162+ this .dataFormatOptions = builder .dataFormatOptions ;
139163 this .enableOpenTelemetryTracing = builder .enableOpenTelemetryTracing ;
140164 this .openTelemetryTracer = builder .openTelemetryTracer ;
141165 if (builder .resultRetryAlgorithm != null ) {
@@ -210,6 +234,10 @@ public boolean getUseInt64Timestamps() {
210234 return useInt64Timestamps ;
211235 }
212236
237+ public DataFormatOptions getDataFormatOptions () {
238+ return dataFormatOptions ;
239+ }
240+
213241 public JobCreationMode getDefaultJobCreationMode () {
214242 return defaultJobCreationMode ;
215243 }
0 commit comments