googleapis / googleapis/google-cloud-java

[bigquery-jdbc] Expose dry-run / query cost estimation API

オープン
#14,264 コメント 0 件 リアクション 1 件 担当者 1 名 @logachev が担当を希望しています GitHub で見る
主要言語
Java
スター
2.1k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
154

説明

### Problem

BigQuery clients often need to estimate the amount of data a query will process **before executing it**, because BigQuery billing depends on bytes processed.

The BigQuery API supports this through dry runs and returns `totalBytesProcessed`. The Java BigQuery client also exposes this capability, including `Connection.dryRun(String)` / `BigQueryDryRunResult`.

However, `google-cloud-bigquery-jdbc` does not currently expose an equivalent public API through `BigQueryConnection` or `BigQueryStatement`.

This prevents JDBC-based database tools such as DataGrip from providing the same pre-execution cost information that the BigQuery Console provides.

### Requested API

It would be useful to expose dry-run/query estimation as a BigQuery-specific JDBC extension, for example through an unwrapped `BigQueryConnection` or `BigQueryStatement`:

```java
BigQueryStatement statement =
jdbcStatement.unwrap(BigQueryStatement.class);

BigQueryDryRunResult result = statement.dryRun(sql);
long bytes = result.getTotalBytesProcessed();
```

The exact API shape is not important; the main requirement is to perform the dry run using the **existing JDBC connection configuration and authentication**.

Ideally it should preserve:

* authentication/credentials
* project
* location
* default dataset
* session configuration
* prepared-statement parameters, where applicable

### Motivation

For database IDEs and other JDBC tools, this would allow:

> This query will process approximately 1.8 TB.

to be shown before execution, optionally allowing clients to warn users about unexpectedly expensive queries.

`MaximumBytesBilled` is useful as a hard safety limit, but it does not expose the estimated number of bytes to the JDBC client before execution.

The underlying BigQuery APIs already provide dry-run estimation, so this request is specifically about making that capability accessible through the JDBC driver.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。