Skip to content

Commit bdcc2f8

Browse files
authored
fix(bigquery): revert to useInt64Timestamp for REST format options (#13789)
Revert BigQuery REST format options to `useInt64Timestamp` to avoid the `timestamp_output_format is not supported yet` 400 ERRORs introduced in v1.73.0. Related: #13788
1 parent e9c0abd commit bdcc2f8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

bigquery/iterator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
const (
29-
defaultTimestampWireFormat string = "INT64"
29+
defaultUseInt64Timestamp = true
3030
)
3131

3232
// Construct a RowIterator.
@@ -294,7 +294,7 @@ func fetchTableResultPage(ctx context.Context, src *rowSource, schema Schema, st
294294
}()
295295
}
296296
call := src.t.c.bqs.Tabledata.List(src.t.ProjectID, src.t.DatasetID, src.t.TableID)
297-
call = call.FormatOptionsTimestampOutputFormat(defaultTimestampWireFormat)
297+
call = call.FormatOptionsUseInt64Timestamp(defaultUseInt64Timestamp)
298298
setClientHeader(call.Header())
299299
if pageToken != "" {
300300
call.PageToken(pageToken)
@@ -332,7 +332,7 @@ func fetchJobResultPage(ctx context.Context, src *rowSource, schema Schema, star
332332
// reduce data transferred by leveraging api projections
333333
projectedFields := []googleapi.Field{"rows", "pageToken", "totalRows"}
334334
call := src.j.c.bqs.Jobs.GetQueryResults(src.j.projectID, src.j.jobID).Location(src.j.location).Context(ctx)
335-
call = call.FormatOptionsTimestampOutputFormat(defaultTimestampWireFormat)
335+
call = call.FormatOptionsUseInt64Timestamp(defaultUseInt64Timestamp)
336336
if schema == nil {
337337
// only project schema if we weren't supplied one.
338338
projectedFields = append(projectedFields, "schema")

bigquery/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func (j *Job) read(ctx context.Context, waitForQuery func(context.Context, strin
353353
func (j *Job) waitForQuery(ctx context.Context, projectID string) (Schema, uint64, error) {
354354
// Use GetQueryResults only to wait for completion, not to read results.
355355
call := j.c.bqs.Jobs.GetQueryResults(projectID, j.jobID).Location(j.location).Context(ctx).MaxResults(0)
356-
call = call.FormatOptionsTimestampOutputFormat(defaultTimestampWireFormat)
356+
call = call.FormatOptionsUseInt64Timestamp(defaultUseInt64Timestamp)
357357
setClientHeader(call.Header())
358358
backoff := gax.Backoff{
359359
Initial: 50 * time.Millisecond,

bigquery/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ func (q *Query) probeFastPath() (*bq.QueryRequest, error) {
500500
MaxSlots: int64(q.MaxSlots),
501501
Labels: q.Labels,
502502
FormatOptions: &bq.DataFormatOptions{
503-
TimestampOutputFormat: defaultTimestampWireFormat,
503+
UseInt64Timestamp: defaultUseInt64Timestamp,
504504
},
505505
}
506506
if q.QueryConfig.DisableQueryCache {

bigquery/query_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func TestProbeFastPath(t *testing.T) {
470470
Query: "foo",
471471
UseLegacySql: &pfalse,
472472
FormatOptions: &bq.DataFormatOptions{
473-
TimestampOutputFormat: defaultTimestampWireFormat,
473+
UseInt64Timestamp: defaultUseInt64Timestamp,
474474
},
475475
},
476476
},
@@ -509,7 +509,7 @@ func TestProbeFastPath(t *testing.T) {
509509
},
510510
UseQueryCache: &pfalse,
511511
FormatOptions: &bq.DataFormatOptions{
512-
TimestampOutputFormat: defaultTimestampWireFormat,
512+
UseInt64Timestamp: defaultUseInt64Timestamp,
513513
},
514514
Reservation: "reservation/1",
515515
MaxSlots: 222,

0 commit comments

Comments
 (0)