Class BigQueryHelpers
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.bigquery.BigQueryHelpers
-
public class BigQueryHelpers extends java.lang.ObjectA set of helper functions and classes used byBigQueryIO.
-
-
Constructor Summary
Constructors Constructor Description BigQueryHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>dataCatalogSegments(com.google.api.services.bigquery.model.TableReference ref, BigQueryOptions options)static <T> @PolyNull TfromJsonString(@PolyNull java.lang.String json, java.lang.Class<T> clazz)static @Nullable java.math.BigIntegergetNumRows(BigQueryOptions options, com.google.api.services.bigquery.model.TableReference tableRef)It returns the number of rows for a given table.static @Nullable com.google.api.services.bigquery.model.TablegetTable(BigQueryOptions options, com.google.api.services.bigquery.model.TableReference tableRef)static com.google.api.services.bigquery.model.TableReferenceparseTableSpec(java.lang.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 com.google.api.services.bigquery.model.TableReferenceparseTableUrn(java.lang.String tableUrn)static java.lang.StringstripPartitionDecorator(java.lang.String tableSpec)Strip off any partition decorator information from a tablespec.static @PolyNull java.lang.StringtoJsonString(@PolyNull java.lang.Object item)static java.lang.StringtoTableSpec(com.google.api.services.bigquery.model.TableReference ref)Returns a canonical string representation of theTableReference.
-
-
-
Method Detail
-
toTableSpec
public static java.lang.String toTableSpec(com.google.api.services.bigquery.model.TableReference ref)
Returns a canonical string representation of theTableReference.
-
dataCatalogSegments
public static java.util.List<java.lang.String> dataCatalogSegments(com.google.api.services.bigquery.model.TableReference ref, BigQueryOptions options)
-
parseTableSpec
public static com.google.api.services.bigquery.model.TableReference parseTableSpec(java.lang.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]".If the project id is omitted, the default project id is used.
-
parseTableUrn
public static com.google.api.services.bigquery.model.TableReference parseTableUrn(java.lang.String tableUrn)
-
stripPartitionDecorator
public static java.lang.String stripPartitionDecorator(java.lang.String tableSpec)
Strip off any partition decorator information from a tablespec.
-
toJsonString
public static @PolyNull java.lang.String toJsonString(@PolyNull java.lang.Object item)
-
fromJsonString
public static <T> @PolyNull T fromJsonString(@PolyNull java.lang.String json, java.lang.Class<T> clazz)
-
getNumRows
public static @Nullable java.math.BigInteger getNumRows(BigQueryOptions options, com.google.api.services.bigquery.model.TableReference tableRef) throws java.lang.InterruptedException, java.io.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:
java.lang.InterruptedExceptionjava.io.IOException
-
getTable
public static @Nullable com.google.api.services.bigquery.model.Table getTable(BigQueryOptions options, com.google.api.services.bigquery.model.TableReference tableRef) throws java.lang.InterruptedException, java.io.IOException
- Throws:
java.lang.InterruptedExceptionjava.io.IOException
-
-