perf(bigquery-jdbc): optimize metadata introspection performance and parallel project scanning#13667
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes metadata retrieval in BigQueryDatabaseMetaData by specifying field options to limit the data fetched for routines and tables. It also refactors dataset fetching in getSchemas and fetchMatchingDatasets to parallelize multi-project scans. The review feedback points out a potential resource leak where outstanding futures are not cancelled if one of the parallel tasks fails, and suggests adding a finally block to clean them up.
|
/gemini review |
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
Code Review
This pull request optimizes metadata retrieval by introducing field masks (using RoutineOption.fields and TableOption.fields) when fetching routines and tables, and refactors getSchemas to parallelize dataset fetching across projects. The feedback suggests moving the task submission loop inside the try-finally block in fetchMatchingDatasets to prevent resource leaks on submission failure, and updating a log message to accurately reflect that a field mask is being used instead of fetching full table details.
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
b/530193584
This PR optimizes metadata introspection performance in the BigQuery JDBC driver by implementing parallel project scanning and reducing BigQuery REST API response payloads through field masking.
Key Changes
fetchMatchingDatasetsto scan multiple GCP projects concurrently instead of sequentialgetSchemasLogic:fetchMatchingDatasets.getTables&getColumns):TableOption.fields(...)masks to REST API listing calls.getTablesnow only fetchesTABLE_REFERENCE,TYPE, andDESCRIPTION(reducing average latency by ~26%).getColumnsnow only fetchesTABLE_REFERENCE,TYPE, andSCHEMA.getProcedureColumns):fetchFullRoutineDetailsForIdsto support optionalRoutineOption...varargs.getProcedureColumnsto only requestROUTINE_REFERENCE,ARGUMENTS, andROUTINE_TYPEfrom the backend, avoiding full routine downloads.