FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: handled race condition in stateless query integration test by SivamuruganP · Pull Request #4045 · googleapis/java-bigquery · GitHub

This repository was archived by the owner on Mar 23, 2026. It is now read-only.
/ java-bigquery Public archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7181,8 +7181,12 @@ public void testStatelessQueries() throws InterruptedException {
// Stateless query should have no job id.
bigQuery.getOptions().setDefaultJobCreationMode(JobCreationMode.JOB_CREATION_OPTIONAL);
TableResult tableResult = executeSimpleQuery(bigQuery);
assertNotNull(tableResult.getQueryId());
assertNull(tableResult.getJobId());
// Use XOR: We accept EITHER a QueryId (fast path) OR a JobId (slow fallback), but not both.
Comment thread
lqiu96 marked this conversation as resolved.
// Ideally Stateless query will return queryId but in some cases it would return jobId instead
// of queryId based on the query complexity or other factors (job timeout configs).
assertTrue(
"Exactly one of jobId or queryId should be non-null",
(tableResult.getJobId() != null) ^ (tableResult.getQueryId() != null));

// Job creation takes over, no query id is created.
bigQuery.getOptions().setDefaultJobCreationMode(JobCreationMode.JOB_CREATION_REQUIRED);
Expand Down Expand Up @@ -7220,8 +7224,14 @@ public void testTableResultJobIdAndQueryId() throws InterruptedException {
String query = "SELECT 1 as one";
QueryJobConfiguration configStateless = QueryJobConfiguration.newBuilder(query).build();
TableResult result = bigQuery.query(configStateless);
assertNull(result.getJobId());
assertNotNull(result.getQueryId());
// A stateless query should result in either a queryId (stateless success) or a jobId (fallback
// to a job).
// Exactly one of them should be non-null.
// Ideally Stateless query will return queryId but in some cases it would return jobId instead
// of queryId based on the query complexity or other factors (job timeout configs).
assertTrue(
"Exactly one of jobId or queryId should be non-null",
(result.getJobId() != null) ^ (result.getQueryId() != null));

// Test scenario 2 by failing stateless check by setting job timeout.
QueryJobConfiguration configQueryWithJob =
Expand Down

Back | FazBrowse Home | New Git URL