Class BigQueryHelpers


  • public class BigQueryHelpers
    extends java.lang.Object
    A set of helper functions and classes used by BigQueryIO.
    • Constructor Summary

      Constructors 
      Constructor Description
      BigQueryHelpers()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> @PolyNull T fromJsonString​(@PolyNull java.lang.String json, java.lang.Class<T> clazz)  
      static @Nullable java.math.BigInteger getNumRows​(BigQueryOptions options, com.google.api.services.bigquery.model.TableReference tableRef)
      It returns the number of rows for a given table.
      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]".
      static com.google.api.services.bigquery.model.TableReference parseTableUrn​(java.lang.String tableUrn)  
      static java.lang.String stripPartitionDecorator​(java.lang.String tableSpec)
      Strip off any partition decorator information from a tablespec.
      static @PolyNull java.lang.String toJsonString​(@PolyNull java.lang.Object item)  
      static java.lang.String toTableSpec​(com.google.api.services.bigquery.model.TableReference ref)
      Returns a canonical string representation of the TableReference.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BigQueryHelpers

        public BigQueryHelpers()
    • Method Detail

      • toTableSpec

        public static java.lang.String toTableSpec​(com.google.api.services.bigquery.model.TableReference ref)
        Returns a canonical string representation of the TableReference.
      • 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.InterruptedException
        java.io.IOException