File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class BigQueryClientWrapper extends BigQueryClient
2828 */
2929 public function __construct (
3030 array $ config = [],
31- readonly string $ runId = '' ,
31+ string $ runId = '' ,
3232 array $ queryTags = [],
3333 BackOffPolicyInterface |null $ backOffPolicy = null ,
3434 ) {
@@ -43,6 +43,9 @@ public function __construct(
4343 $ this ->backOffPolicy = $ backOffPolicy ;
4444 }
4545
46+ if ($ runId !== '' ) {
47+ $ queryTags [QueryTagKey::RUN_ID ->value ] = $ runId ;
48+ }
4649 $ this ->queryTags = new QueryTags ($ queryTags );
4750 }
4851
@@ -51,17 +54,8 @@ public function __construct(
5154 */
5255 public function runQuery (JobConfigurationInterface $ query , array $ options = []): QueryResults
5356 {
54- $ allQueryTags = [];
55- if ($ this ->runId !== '' ) {
56- $ allQueryTags ['run_id ' ] = $ this ->runId ;
57- }
58-
59- if ($ this ->queryTags ->isEmpty () === false ) {
60- $ allQueryTags = array_merge ($ allQueryTags , $ this ->queryTags ->toArray ());
61- }
62-
63- if (count ($ allQueryTags ) !== 0 && method_exists ($ query , 'labels ' )) {
64- $ query = $ query ->labels ($ allQueryTags );
57+ if (count ($ this ->queryTags ->toArray ()) !== 0 && method_exists ($ query , 'labels ' )) {
58+ $ query = $ query ->labels ($ this ->queryTags ->toArray ());
6559 }
6660
6761 return $ this ->runJob ($ query , $ options )
Original file line number Diff line number Diff line change 99enum QueryTagKey: string
1010{
1111 case BRANCH_ID = 'branch_id ' ;
12+ case RUN_ID = 'run_id ' ;
1213
1314 /**
1415 * Validates if the given string is a valid tag key
You can’t perform that action at this time.
0 commit comments