Repository navigation
fix(bigquery-jdbc): validate LargeResult properties and use UUID temp tables with WRITE_EMPTY - #15257
keshavdandeva wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces automatic lifecycle management and cleanup for temporary destination tables and datasets generated during large query executions. It ensures that generated temporary tables are deleted when their associated ResultSet is closed or when a new query is executed on the same statement. Additionally, it resolves the owner's email from connection credentials to set appropriate owner ACLs on auto-created datasets, and improves dataset conflict handling. The feedback suggests two performance optimizations in BigQueryStatement.java: avoiding unnecessary ArrayList allocation when iterating over the concurrent set trackedTempTables, and using System.currentTimeMillis() instead of Instant.now().toEpochMilli() to prevent object allocation.
3f28088 to
8e7c265
Compare
… tables with WRITE_EMPTY
8e7c265 to
9db511a
Compare
b/584840569
Summary of Changes
DataSource,BigQueryStatement):LargeResultsDatasetExpirationTimevia existingDataSource.validateNonNegative(...)while preserving0(falls back to the 1-hour default3600000ms inBigQueryStatement) for backwards compatibility with existing=0URLs.LargeResultTablewithoutLargeResultDatasetunder Standard SQL before runninggetQueryTypedry-run inBigQueryStatement.executeImpl, avoiding a wasted dry-run RPC and failing fast withBigQueryJdbcException.BigQueryStatement):this.querySettings.toString()viaBigQueryConnection.sanitizeForLog(...)inlogQueryExecutionStart, protecting all query settings fields against log injection without adding setter-level character rejections.BigQueryStatement):temp_table_<millis>_<random(0..9998)>withtemp_table_<uuid>and useJobInfo.WriteDisposition.WRITE_EMPTYfor generated temporary tables (keepingWRITE_TRUNCATEfor explicitLargeResultTable).JobId(google-jdbc-<uuid>) inexecuteJobwheneverdestinationTable != null, makingjobs.insertretries idempotent underWRITE_EMPTYwhile leavingJobId.jobunset for jobless fast-query-eligible queries.BigQueryStatement):Connection.isValid) ignoreLargeResultDatasetandLargeResultTableso health checks never write into user destination datasets/tables.USER_GUIDE.md,DataSourceTest,BigQueryStatementTest):LargeResultTable,LargeResultDataset, andLargeResultsDatasetExpirationTimebehavior and add unit tests covering each invariant.Decisions Taken & Open Review Points
LargeResultsDatasetExpirationTime=0kept valid at connect time (falls back to 1h default): Rejecting0would break existing URLs that explicitly pass=0to mean default. ReusingDataSource.validateNonNegativerejects< 0without a breaking connect-time regression.logQueryExecutionStartcovers all ~80 settings properties uniformly and avoids surprising rejects on unusual valid values.JobIdidempotency toPriority.BATCHand KMS-encrypted queries withoutdestinationTableis tracked separately inb/592249905.