Skip to content

Commit

Permalink
feat: clean cached rows and responses after conversion (#1393)
Browse files Browse the repository at this point in the history
* feat: clean cached rows and responses after convertion

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
alvarowolfx and gcf-owl-bot[bot] committed Jul 31, 2024
1 parent a7cd3af commit 3fd28b8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,7 @@ export class BigQuery extends Service {
wrapIntegers: options.wrapIntegers || false,
parseJSON: options.parseJSON,
});
delete res.rows;
}
this.trace_('[runJobsQuery] job complete');
options._cachedRows = rows;
Expand Down
13 changes: 8 additions & 5 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,16 +565,19 @@ class Job extends Operation {
const timeoutOverride =
typeof qs.timeoutMs === 'number' ? qs.timeoutMs : false;

if (options._cachedRows) {
const cachedRows = options._cachedRows;
const cachedResponse = options._cachedResponse;
delete options._cachedRows;
delete options._cachedResponse;
if (cachedRows) {
let nextQuery: QueryResultsOptions | null = null;
if (options.pageToken) {
nextQuery = Object.assign({}, options, {
pageToken: options.pageToken,
});
delete nextQuery._cachedRows;
delete nextQuery._cachedResponse;
}
callback!(null, options._cachedRows, nextQuery, options._cachedResponse);
delete cachedResponse?.rows;
callback!(null, cachedRows, nextQuery, cachedResponse);
return;
}

Expand Down Expand Up @@ -620,7 +623,7 @@ class Job extends Operation {
});
delete nextQuery.startIndex;
}

delete resp.rows;
callback!(null, rows, nextQuery, resp);
}
);
Expand Down
14 changes: 11 additions & 3 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/**
* Discovery Revision: 20240629
* Discovery Revision: 20240714
*/

/**
Expand Down Expand Up @@ -858,7 +858,7 @@ declare namespace bigquery {
*/
type IDataset = {
/**
* Optional. An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER;
* Optional. An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; If you patch a dataset, then this field is overwritten by the patched dataset's access field. To add entities, you must supply the entire existing access array in addition to any new entities that you want to add.
*/
access?: Array<{
/**
Expand Down Expand Up @@ -1013,7 +1013,7 @@ declare namespace bigquery {
| 'LOGICAL'
| 'PHYSICAL';
/**
* Output only. Tags for the Dataset.
* Output only. Tags for the dataset. To provide tags as inputs, use the `resourceTags` field.
*/
tags?: Array<{
/**
Expand Down Expand Up @@ -2754,6 +2754,14 @@ declare namespace bigquery {
* Output only. Statistics for data-masking. Present only for query and extract jobs.
*/
dataMaskingStatistics?: IDataMaskingStatistics;
/**
* Output only. Name of edition corresponding to the reservation for this job at the time of this update.
*/
edition?:
| 'RESERVATION_EDITION_UNSPECIFIED'
| 'STANDARD'
| 'ENTERPRISE'
| 'ENTERPRISE_PLUS';
/**
* Output only. End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
*/
Expand Down

0 comments on commit 3fd28b8

Please sign in to comment.