Skip to content

test(bigquery): use compute query in testQueryStatistics to avoid 0 totalSlotMs flake - #15082

Open
lqiu96 wants to merge 1 commit into
googleapis:mainfrom
lqiu96:fix/bigquery-query-statistics-it
Open

lqiu96 wants to merge 1 commit into
googleapis:mainfrom
lqiu96:fix/bigquery-query-statistics-it

Conversation

@lqiu96

@lqiu96 lqiu96 commented Nov 19, 2026

Copy link
Copy Markdown
Member

Re-enable ITBigQueryTest.testQueryStatistics and replace SELECT CURRENT_TIMESTAMP() AS ts with SELECT SUM(x) AS total FROM UNNEST(GENERATE_ARRAY(1, 1000000)) AS x.

It's possible that a scalar-only query such as SELECT CURRENT_TIMESTAMP() can finish in under 1 ms of slot time on BigQuery's short-query path and report 0 totalSlotMs. Switch to summing a generated array remains self-contained with 0 bytes scanned.

Fixes b/574587826

…otalSlotMs flake

Re-enable ITBigQueryTest.testQueryStatistics and replace SELECT CURRENT_TIMESTAMP() AS ts with SELECT SUM(x) AS total FROM UNNEST(GENERATE_ARRAY(1, 1000000)) AS x.

A scalar-only query such as SELECT CURRENT_TIMESTAMP() can finish in under 1 ms of slot time on BigQuery's short-query path and legitimately report 0 totalSlotMs, causing assertThat(statistics.getTotalSlotMs()).isGreaterThan(0L) to flake. Summing a generated array remains self-contained with 0 bytes scanned (no external table dependency, safe on regional and GraalVM Native Image runs) while reliably executing real slot work.

Fixes b/574587826.
@lqiu96
lqiu96 requested a review from jinseopkim0 November 19, 2026 19:27
@lqiu96
lqiu96 requested review from a team as code owners November 19, 2026 19:27

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request re-enables the previously disabled testQueryStatistics integration test in ITBigQueryTest.java. The test query has been updated from a simple timestamp selection to a compute-intensive query (SELECT SUM(x) AS total FROM UNNEST(GENERATE_ARRAY(1, 1000000)) AS x) to ensure BigQuery executes real slot work and reports non-zero slot time, resolving the flakiness issue. Additionally, the unused Disabled import has been removed. There are no review comments, and I have no feedback to provide.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant