From 3fd28b8a0db415c0e5f19a6763f7ad44350e27b1 Mon Sep 17 00:00:00 2001 From: Alvaro Viebrantz Date: Wed, 31 Jul 2024 08:27:00 -0700 Subject: [PATCH] feat: clean cached rows and responses after conversion (#1393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/bigquery.ts | 1 + src/job.ts | 13 ++++++++----- src/types.d.ts | 14 +++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/bigquery.ts b/src/bigquery.ts index 5aad199a..fb6bd5ea 100644 --- a/src/bigquery.ts +++ b/src/bigquery.ts @@ -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; diff --git a/src/job.ts b/src/job.ts index 78e6a6d2..04ce0ec2 100644 --- a/src/job.ts +++ b/src/job.ts @@ -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; } @@ -620,7 +623,7 @@ class Job extends Operation { }); delete nextQuery.startIndex; } - + delete resp.rows; callback!(null, rows, nextQuery, resp); } ); diff --git a/src/types.d.ts b/src/types.d.ts index d64bb052..788750e6 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -13,7 +13,7 @@ // limitations under the License. /** - * Discovery Revision: 20240629 + * Discovery Revision: 20240714 */ /** @@ -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<{ /** @@ -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<{ /** @@ -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. */