Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion handwritten/bigquery/src/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2458,14 +2458,24 @@ export class BigQuery extends Service {
return;
}

const {location, maxResults, pageToken, wrapIntegers, parseJSON} = query;
const {
location,
maxResults,
pageToken,
wrapIntegers,
parseJSON,
'formatOptions.timestampOutputFormat': timestampOutputFormat,
'formatOptions.useInt64Timestamp': useInt64Timestamp,
} = query as any;

const opts = {
location,
maxResults,
pageToken,
wrapIntegers,
parseJSON,
'formatOptions.timestampOutputFormat': timestampOutputFormat,
'formatOptions.useInt64Timestamp': useInt64Timestamp,
autoPaginate: false,
};

Expand All @@ -2474,6 +2484,8 @@ export class BigQuery extends Service {
delete query.pageToken;
delete query.wrapIntegers;
delete query.parseJSON;
delete (query as any)['formatOptions.timestampOutputFormat'];
delete (query as any)['formatOptions.useInt64Timestamp'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't just delete timestampOutputFormat and useInt64Timestamp properties from being sent to the backend. Some of our users are likely relying on this feature.

The core issue is that this code was developed on the old repository with a project that had allowlisted a feature that we don't plan to make GA until Q3. So we has to pin the version as shown in #7286. We have a few options:

  1. Make source code changes so that requests don't set timestampOutputFormat by default and then this won't be an issue for users. The tests still won't pass for a project that isn't allowlisted, but it won't affect users.

  2. We can stage a PR to reverse the changes between 8.1.1 and 8.2.0 so that you can add newer changes and do a release which will unblock future work. Then we can revert this PR which will introduce the changes again when the feature is GA.

Option #2 is probably cleaner. Let me know what you think.


this.query(query, opts, callback);
}
Expand Down
20 changes: 20 additions & 0 deletions handwritten/bigquery/test/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3619,6 +3619,8 @@ describe('BigQuery', () => {
pageToken: undefined,
wrapIntegers: undefined,
parseJSON: undefined,
'formatOptions.timestampOutputFormat': undefined,
'formatOptions.useInt64Timestamp': undefined,
autoPaginate: false,
};

Expand Down Expand Up @@ -3692,6 +3694,24 @@ describe('BigQuery', () => {

assert(queryStub.calledOnceWithExactly(query, opts, sinon.match.func));
});

it('should pass formatOptions if supplied', done => {
const query = {
query: 'SELECT',
'formatOptions.timestampOutputFormat': 'INT64',
'formatOptions.useInt64Timestamp': true,
};

bq.queryAsStream_(query, done);

const opts = {
...defaultOpts,
'formatOptions.timestampOutputFormat': 'INT64',
'formatOptions.useInt64Timestamp': true,
};

assert(queryStub.calledOnceWithExactly(query, opts, sinon.match.func));
});
});

describe('#sanitizeEndpoint', () => {
Expand Down
Loading