GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BigQuery's QueryResultsOption.maxWaitTime Not Respected · Issue #2543 · googleapis/google-cloud-java

BigQuery's QueryResultsOption.maxWaitTime Not Respected #2543

New issue
Copy link
New issue
Copy link
Closed
Closed
BigQuery's QueryResultsOption.maxWaitTime Not Respected#2543
Copy link
Assignees
yihanzhen
Labels
api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@dclements
dclements
opened on Oct 20, 2017
Issue body actions

I may be missing something very simple, but the QueryResultsOption.maxWaitTime does not appear to be followed.

Version: 0.26.0-beta.

Code sample below:

bigquery.query(
            queryRequest,
            JobId.of(),
            QueryOption.of(QueryResultsOption.pageSize(1000L)),
            QueryOption.of(
              QueryResultsOption.maxWaitTime(
                1000L
              )
            )
          )

This is based on the example from: https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-bigquery

I expected this to block for 1 s and then return, regardless of whether it has completed, and then return (possibly with response.jobCompleted returning false).

When I run a query that lasts 15 seconds, it will block for all 15 seconds, however, the full time of the query (until jobCompleted is true). No matter what I set the value of maxWaitTime to, it never seems to return before jobCompleted returns true.

Activity

  1. vam-google commented on Oct 23, 2017

    @vam-google
    vam-google
    on Oct 23, 2017
    Contributor
    More actions

    There was a recent change in BigQuery API which caused that.

    Now, BigQuery.query() is a synchronous operation, which is essentially a wrapper around creating a QueryJob and waiting for its completion (notice how now query() method accepts QueryJobConfiguration as an input).

    The reason behind that change was to avoid using the query API at all, since it has various limitations. Now the client library never calls that API.

    But I agree the result of the change is now confusing and there should be additional work done to polish this new implementation.

    But currently there are 2 options you can provide, which have similar names and can be confused with each other:
    QueryOption.of(QueryResultsOption.maxWaitTime(1000L))
    and
    QueryOption.of(RetryOption.totalTimeout(Duration.ofMillis(1000L)))

    So to achieve what you want you need the second option. The first option still exists to allow configuring parameters for the getQueryResults call, which is used to do the actual polling (waiting) for the query job completion.

    Also note that now if RetryOption.totalTimeout() expires an exception will be thrown (instead of returning a result), with e.getCause() instanceof PollException == true

    For your case, you most probably want to create a QueryJob manually, start it, and then wait for its completion. Please check ITJobSnippets.testWaitForWithOptions() for an example.

  2. vam-google
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    api: bigqueryIssues related to the BigQuery API.
    on Oct 23, 2017
  3. vam-google commented on Oct 23, 2017

    @vam-google
    vam-google
    on Oct 23, 2017
    Contributor
    More actions

    Some enhancements/fixes are needed for BigQuery:

    1. Better documentation for BigQuery.query() method: explicitly specify that it is a synchronous call now and what happens if polling fails
    2. Rename QueryResultsOptions.maxWaitTime() or at least add better documentation about what that parameter regulates
    3. Better handle PollException (probably throw it directly instead of wrapped in BigQueryException, provide more details in PollException about failed polling task)
  4. dclements commented on Oct 23, 2017

    @dclements
    dclements
    on Oct 23, 2017
    Author
    More actions

    Awesome, that makes sense and thank you for the clarification. To add to the enhancements, some additional points in the documentation that seem out of date (or at least confusing):

    The javadoc for maxWaitTime reads:

    Returns an option that sets how long to wait for the query to complete, in milliseconds,
    before returning. Default is 10 seconds. If the timeout passes before the job completes,
     {@link QueryResponse#jobCompleted()} will be {@code false}.
    

    The javadoc for BigQuery#getQueryResults shows the old pattern, and seems to use query without any parameters that would indicate manual polling.

  5. garrettjonesgoogle
    assigned
    vam-google
    on Oct 26, 2017
  6. garrettjonesgoogle
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Oct 26, 2017
  7. yihanzhen commented on Jan 24, 2018

    @yihanzhen
    yihanzhen
    on Jan 24, 2018
    Contributor
    More actions

    Move this issue to feature request backlog and close it here.

  8. yihanzhen
    closed this as completedon Jan 24, 2018
  9. theacodes
    unassigned
    vam-google
    on Sep 28, 2018
  10. JustinBeckwith
    assigned
    yihanzhen
    on Feb 1, 2021
  11. chingor13
    added a commit that references this issue on Feb 20, 2026

    deps: update dependency org.junit.vintage:junit-vintage-engine to v5.…

    f36d734
  12. chingor13
    added a commit that references this issue on Mar 4, 2026

    fix: Use ServiceName + MethodName as the regex for Otel (#2543)

    b9ae73f
  13. chingor13
    added 3 commits that reference this issue on Mar 20, 2026

    chore(main): release 2.68.0 (#4123)

    a0fb119

    fix: Use ServiceName + MethodName as the regex for Otel (#2543)

    8196b8f

    chore(deps): update dependency com.google.cloud:google-cloud-storage-…

    7e344e6
  14. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    deps: update dependency com.google.cloud:google-cloud-core to v2.60.1 (…

    fbb45ce

    deps: update dependency com.google.cloud:google-cloud-core to v2.60.1 (…

    86adf2e
  15. rahul2393
    added a commit that references this issue on May 21, 2026

    chore(main): release 2.57.2-SNAPSHOT (googleapis#2543)

    70f4524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @yihanzhen
    yihanzhen

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.