feat(bigquery): expose StatementType and query execution stats on TableResult - #14145
feat(bigquery): expose StatementType and query execution stats on TableResult#14145keshavdandeva wants to merge 2 commits into
StatementType and query execution stats on TableResult#14145Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the BigQuery dependency version and propagates query execution statistics—including statement type, total bytes billed, total bytes processed, total slot milliseconds, and affected DML rows—from query results and job statistics into the TableResult object. The review feedback suggests wrapping the StatementType.valueOf() conversion in a try-catch block to gracefully handle any unrecognized statement types returned by the BigQuery service and prevent runtime exceptions.
|
@keshavdandeva FYI, I'm going to upgrade the bigquery apiary version in #14149 |
b333559 to
94fbc07
Compare
94fbc07 to
d4f4546
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the BigQuery client to expose additional query statistics and session information (such as statement type, bytes billed/processed, slot milliseconds, affected DML rows, and session info) in TableResult, along with updating the BigQuery API dependency version and adding corresponding unit tests. Feedback was provided to wrap the StatementType.valueOf conversion in a try-catch block to prevent runtime crashes if the backend returns an unrecognized statement type.
|
|
||
| public abstract TableResult.Builder setNumDmlAffectedRows(Long numDmlAffectedRows); | ||
|
|
||
| public abstract TableResult.Builder setSessionInfo(SessionInfo sessionInfo); |
There was a problem hiding this comment.
Add an IT test to verify that this values is getting propagated from the backend correctly.
b/549680449
This PR exposes
StatementTypeand jobless query execution metrics onTableResultby plumbing them fromQueryResponseandJobStatistics.QueryStatistics.This enables downstream consumers (such as the BigQuery JDBC driver) to inspect query statement types and execution statistics directly from
TableResultwithout needing to issue secondary jobs or dry-run queries.Changes
google-api-services-bigquerytov2-rev20260731-2.0.0ingoogle-cloud-jar-parent/pom.xmlandjava-bigquery/pom.xml.getNextPage()),toString(),hashCode(), andequals()for:getStatementType()(StatementType)getTotalBytesBilled()(Long)getTotalBytesProcessed()(Long)getTotalSlotMs()(Long)getNumDmlAffectedRows()(Long)QueryResponsewhen buildingTableResultinqueryRpc().StatementTypeand query metrics fromQueryStatisticswhen creatingTableResultingetQueryResults().TableResultTestandBigQueryImplTestverifying field retrieval, pagination propagation, builder modifications, and serialization.