Class RealBigQuery
java.lang.Object
io.github.flink.gcp.connector.testutils.bigquery.RealBigQuery
REST plumbing shared by the ITCases gated on real-GCP credentials: the
BQ_IT_* variables,
a REST client over application-default credentials, table creation/deletion and query read-back.
The gated classes reach BigQuery through this and nothing else (#292); RealGcs is the
sibling for the FILE_LOADS staging bucket, which only that write method needs. Here rather than
in the connector's test tree so the Tier-3 BigQuery application's gated test shares it; the two
helpers that take connector types stay with the connector's tests.
Deliberately a static utility and not a base class carrying the gating annotation:
scripts/e2e-gated-its.sh parses test sources for the environment-variable gate and
demands a surefire report per discovered file, so an abstract class carrying it would fail
--assert-ran. Each gated ITCase declares its own @EnabledIfEnvironmentVariable
annotations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateTable(String table, com.google.cloud.bigquery.Schema schema) Createstablein the gated dataset with the given REST schema, which can express columns the Storage Write API schema cannot, such asINTERVAL.static voidcreateTableWithMetadata(String table, com.google.cloud.bigquery.Schema schema, String description, Map<String, String> labels, com.google.cloud.bigquery.TableConstraints constraints) Creates a table carrying representative metadata that a data-only replacement must keep.static Stringdataset()The BigQuery dataset the gated ITCases create their tables in (BQ_IT_DATASET).static StringThe gated dataset's location, which a reuse-enabled query source must name: BigQuery scopes a job to (project, location, id), and a location-lessjobs.getsees only the US multi-region — measured 2026-08-10 against this suite's regional dataset.static voiddeleteTables(String... tables) Attempts every given table deletion and reports failures; the dataset's default table expiration (24 h, set inopentofu/flink-gcp/it-resources.tf) is the backstop for a crashed run.static Stringproject()The GCP project the gated ITCases run against (BQ_IT_PROJECT).static longqueryBytesProcessed(String jobId) Returns the bytes processed by a completed query job in the gated dataset's location.queryLongs(String sql) Runs the query and returns its first column, one entry per row,nullfor a NULL cell.static List<com.google.cloud.bigquery.FieldValueList>Runs the query and returns its rows.static com.google.cloud.bigquery.TableConstraintstableConstraints(String table) Returns the constraints stored ontable.static com.google.cloud.bigquery.StandardTableDefinitiontableDefinition(String table) Returns the live definition oftable— the schema, and the partitioning and clustering the service actually stored.static StringtableDescription(String table) Returns the table-level description oftable.static com.google.cloud.bigquery.FieldListtableFields(String table) Returns the live columns oftable, in order.tableLabels(String table) Returns the labels stored ontable.static StringReturns the fully qualified, backtick-quoted table path for use in a query.
-
Method Details
-
project
The GCP project the gated ITCases run against (BQ_IT_PROJECT). -
dataset
The BigQuery dataset the gated ITCases create their tables in (BQ_IT_DATASET). -
datasetLocation
The gated dataset's location, which a reuse-enabled query source must name: BigQuery scopes a job to (project, location, id), and a location-lessjobs.getsees only the US multi-region — measured 2026-08-10 against this suite's regional dataset. -
createTable
Createstablein the gated dataset with the given REST schema, which can express columns the Storage Write API schema cannot, such asINTERVAL. The connector's tests create one from a Storage Write API schema through their ownRealTables. -
createTableWithMetadata
public static void createTableWithMetadata(String table, com.google.cloud.bigquery.Schema schema, String description, Map<String, String> labels, com.google.cloud.bigquery.TableConstraints constraints) Creates a table carrying representative metadata that a data-only replacement must keep. -
deleteTables
Attempts every given table deletion and reports failures; the dataset's default table expiration (24 h, set inopentofu/flink-gcp/it-resources.tf) is the backstop for a crashed run. A short-term table-update rate limit gets at most six attempts, with waits of one, two, four, eight and sixteen seconds. Interruption stops further cleanup. -
tableFields
Returns the live columns oftable, in order. -
tableDefinition
Returns the live definition oftable— the schema, and the partitioning and clustering the service actually stored. -
tableDescription
Returns the table-level description oftable. -
tableLabels
Returns the labels stored ontable. -
tableConstraints
Returns the constraints stored ontable. -
queryBytesProcessed
Returns the bytes processed by a completed query job in the gated dataset's location. -
queryRows
public static List<com.google.cloud.bigquery.FieldValueList> queryRows(String sql) throws InterruptedException Runs the query and returns its rows.- Throws:
InterruptedException
-
queryLongs
Runs the query and returns its first column, one entry per row,nullfor a NULL cell.The null mapping is not decoration:
FieldValue.getLongValue()isLong.parseLong(getStringValue())andgetStringValue()null-checks, so a NULL cell throws — and defaulting it to0would be a wrong answer rather than a failure.- Throws:
InterruptedException
-
tablePath
Returns the fully qualified, backtick-quoted table path for use in a query.
-