bigquery: `query()` never uses the `jobs.query` fast path when `jobTimeoutMs` is set
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- typescript
Rechercherichtung
Beginne in handwritten/bigquery/src/bigquery.ts bei buildQueryRequest_(), wo die Denylist den jobs.query-Fast-Path steuert. Prüfe die Definition von IQueryRequest in handwritten/bigquery/src/types.d.ts und das vorhandene createQueryJob()-Mapping und füge dann den relevanten Unit-Test hinzu oder aktualisiere ihn. Erledigt ist es, wenn jobTimeoutMs als String über jobs.query gesendet wird und der Test die Fast-Path-Anfrage verifiziert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Library Name
@google-cloud/bigquery
A screenshot that you have tested with "Try this API".
The screenshots show the issue is client-side, not API-side:
jobs.queryacceptsjobTimeoutMsand returns results normally (HTTP 200).jobs.queryenforces it: a ~30s query withjobTimeoutMs: "1000"returns HTTP 499 with"Job execution was cancelled: Job timed out after 1 sec".
What would you like to see in the library?
This is a request for the handwritten client logic in handwritten/bigquery, not for the API surface: the API already supports the field, and the limitation is a client-side denylist.
Current behavior
BigQuery.query() routes queries to the accelerated jobs.query endpoint unless an option appears on a denylist in buildQueryRequest_().
jobTimeoutMs is on that list, so setting it silently forces every query through the slower jobs.insert + getQueryResults path:
// always goes through jobs.insert + polling, even for a tiny query
const [rows] = await bigquery.query({query: 'SELECT 1', jobTimeoutMs: 60000});
The API now supports jobTimeoutMs on jobs.query
- The
jobs.queryrequest body now has ajobTimeoutMsfield. This repository's generatedIQueryRequesttype already includes it: https://github.com/googleapis/google-cloud-node/blob/13d1ca8247789323094df9ed916e3ad184053cd7/handwritten/bigquery/src/types.d.ts#L4437-L4440 - The field's documentation explicitly covers the no-job case: "This timeout applies to the query even if a job does not need to be created."
Proposed change
Remove jobTimeoutMs from the denylist and map it into the IQueryRequest, converting the number to a string as the API expects an int64 field. This mirrors what createQueryJob() already does for the jobs.insert path.
A patch with a unit test is ready on my fork, based on current main. I will open a PR if the approach looks good: https://github.com/googleapis/google-cloud-node/compare/main...takaebato:google-cloud-node:bigquery-jobtimeoutms-fast-path
Describe alternatives you've considered
No real alternative: users today can only drop jobTimeoutMs or fall back to createQueryJob() and manage the job manually.
Additional context/notes
I verified the server-side behavior with direct REST calls.
1. jobTimeoutMs is enforced on the fast path, with the identical error as the slow path
A query that runs for roughly 30 seconds, submitted with a 1 second timeout via POST /projects/$PROJECT/queries:
{
"query": "SELECT COUNT(*) FROM UNNEST(GENERATE_ARRAY(1, 1000000)) a CROSS JOIN UNNEST(GENERATE_ARRAY(1, 1000)) b WHERE MOD(a + b, 7) = 0",
"useLegacySql": false,
"useQueryCache": false,
"jobTimeoutMs": "1000",
"timeoutMs": 120000
}
returns HTTP 499 synchronously after about 7 seconds:
{
"error": {
"code": 499,
"message": "Job execution was cancelled: Job timed out after 1 sec",
"errors": [
{
"message": "Job execution was cancelled: Job timed out after 1 sec",
"domain": "global",
"reason": "stopped"
}
],
"status": "CANCELLED"
}
}
The same query submitted via POST /projects/$PROJECT/jobs with {"configuration": {"query": {...}, "jobTimeoutMs": "1000"}} ends as DONE with an errorResult carrying the identical reason and message, and jobs.getQueryResults for that job returns a byte-identical HTTP 499 body. So the error surfaced to the client is the same regardless of path.
2. The timeout applies even when no job is created
The same fast path request with "jobCreationMode": "JOB_CREATION_OPTIONAL" added was cancelled as well, with the same error shape, confirming the documented behavior ("This timeout applies to the query even if a job does not need to be created").
3. The jobTimeoutMs: 0 case: only the request body changes, not the behavior
Before the patch, query({query, jobTimeoutMs: 0}) already took the fast path, because the denylist check is truthiness-based and 0 is falsy. The field was not sent in that case. With the patch, the field is sent as "jobTimeoutMs": "0". The server accepts "0" and treats it as "no timeout", so the observable behavior is the same, verified with
{"query": "SELECT 1", "useLegacySql": false, "jobTimeoutMs": "0"}
returning HTTP 200 with results. This also matches createQueryJob(), which has always sent "0" on the jobs.insert path.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.2k
- Forks
- 732
- Ø Merge
- 2 T. 11 Std.
- Gemergte PRs (30 T.)
- 99
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-node
-
Broken deprecation chainOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
googleapis/google-cloud-node#9854 ·
Maintainer antworten meist innerhalb von 1 Tag
-
pubsub: "Operation attempted on ended Span" when a modack is flushed after the message was ackedOffenapi: pubsub
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9853 ·
Maintainer antworten meist innerhalb von 1 Tag
-
storage: V4 getSignedUrl sorts canonical headers with localeCompare, so they disagree with X-Goog-SignedHeadersEvtl. vergeben @itsrayeedscodespace hat das vor 9 Tagen übernommen. Offenapi: storage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9840 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
firestore: getPartitions() emits gax AutopaginateTrueWarning in every processEvtl. vergeben @TheRealDanii hat das vor 13 Tagen übernommen. Offenapi: firestore
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
googleapis/google-cloud-node#9736 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
googleapis/google-cloud-node#9723 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-node
Ähnliche Issues
-
area: batch
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
inabagumi/shinju-date#7294 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
streaming-video-technology-alliance/common-media-library#700 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
vercel-labs/ui#809 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
KrisCris/village-in-the-shade-guide#75 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bot:ai-assisted component:platform-js status:untriaged
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
midnightntwrk/platform-js#38 ·