Class BigQueryHelpers
java.lang.Object
org.apache.beam.sdk.io.gcp.bigquery.BigQueryHelpers
A set of helper functions and classes used by
BigQueryIO
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataCatalogSegments
(TableReference ref, BigQueryOptions options) static <T> @PolyNull T
fromJsonString
(@PolyNull String json, Class<T> clazz) static @Nullable BigInteger
getNumRows
(BigQueryOptions options, TableReference tableRef) It returns the number of rows for a given table.getTable
(BigQueryOptions options, TableReference tableRef) static TableReference
parseTableSpec
(String tableSpec) Parse a table specification in the form"[project_id]:[dataset_id].[table_id]"
or"[project_id].[dataset_id].[table_id]"
or"[dataset_id].[table_id]"
.static TableReference
parseTableUrn
(String tableUrn) static String
stripPartitionDecorator
(String tableSpec) Strip off any partition decorator information from a tablespec.toJsonString
(@PolyNull Object item) static String
Returns a canonical string representation of theTableReference
.
-
Constructor Details
-
BigQueryHelpers
public BigQueryHelpers()
-
-
Method Details
-
toTableSpec
Returns a canonical string representation of theTableReference
. -
dataCatalogSegments
-
parseTableSpec
Parse a table specification in the form"[project_id]:[dataset_id].[table_id]"
or"[project_id].[dataset_id].[table_id]"
or"[dataset_id].[table_id]"
.If the project id is omitted, the default project id is used.
-
parseTableUrn
-
stripPartitionDecorator
Strip off any partition decorator information from a tablespec. -
toJsonString
-
fromJsonString
-
getNumRows
public static @Nullable BigInteger getNumRows(BigQueryOptions options, TableReference tableRef) throws InterruptedException, IOException It returns the number of rows for a given table.- Returns:
- The number of rows in the table or null if it cannot get any estimate.
- Throws:
InterruptedException
IOException
-
getTable
public static @Nullable Table getTable(BigQueryOptions options, TableReference tableRef) throws InterruptedException, IOException - Throws:
InterruptedException
IOException
-