Class HivePartitioningOptions.Builder

java.lang.Object
com.google.cloud.bigquery.HivePartitioningOptions.Builder
Enclosing class:
HivePartitioningOptions

public static final class HivePartitioningOptions.Builder extends Object
  • Method Details

    • setMode

      public HivePartitioningOptions.Builder setMode(String mode)
      [Optional] When set, what mode of hive partitioning to use when reading data. Two modes are supported. (1) AUTO: automatically infer partition key name(s) and type(s). (2) STRINGS: automatically infer partition key name(s). All types are interpreted as strings. Not all storage formats support hive partitioning. Requesting hive partitioning on an unsupported format will lead to an error. Currently supported types include: AVRO, CSV, JSON, ORC and Parquet.
    • setRequirePartitionFilter

      public HivePartitioningOptions.Builder setRequirePartitionFilter(Boolean requirePartitionFilter)
      [Optional] If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. Note that this field should only be true when creating a permanent external table or querying a temporary external table. Hive-partitioned loads with requirePartitionFilter explicitly set to true will fail.
    • setSourceUriPrefix

      public HivePartitioningOptions.Builder setSourceUriPrefix(String sourceUriPrefix)
      [Optional] When hive partition detection is requested, a common prefix for all source uris should be supplied. The prefix must end immediately before the partition key encoding begins. For example, consider files following this data layout. gs://bucket/path_to_table/dt=2019-01-01/country=BR/id=7/file.avro gs://bucket/path_to_table/dt=2018-12-31/country=CA/id=3/file.avro When hive partitioning is requested with either AUTO or STRINGS detection, the common prefix can be either of gs://bucket/path_to_table or gs://bucket/path_to_table/ (trailing slash does not matter).
    • setFields

      public HivePartitioningOptions.Builder setFields(List<String> fields)
      [Output-only] For permanent external tables, this field is populated with the hive partition keys in the order they were inferred.

      The types of the partition keys can be deduced by checking the table schema (which will include the partition keys). Not every API will populate this field in the output. For example, Tables.Get will populate it, but Tables.List will not contain this field.

    • build

      public HivePartitioningOptions build()
      Creates a HivePartitioningOptions object.