Class HivePartitioningOptions.Builder (2.38.1)

public static final class HivePartitioningOptions.Builder

Inheritance

java.lang.Object > HivePartitioningOptions.Builder

Methods

build()

public HivePartitioningOptions build()

Creates a HivePartitioningOptions object.

Returns
TypeDescription
HivePartitioningOptions

setFields(List<String> fields)

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.

Parameter
NameDescription
fieldsList<String>
Returns
TypeDescription
HivePartitioningOptions.Builder

setMode(String mode)

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.

Parameter
NameDescription
modeString
Returns
TypeDescription
HivePartitioningOptions.Builder

setRequirePartitionFilter(Boolean requirePartitionFilter)

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.

Parameter
NameDescription
requirePartitionFilterBoolean
Returns
TypeDescription
HivePartitioningOptions.Builder

setSourceUriPrefix(String sourceUriPrefix)

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).

Parameter
NameDescription
sourceUriPrefixString
Returns
TypeDescription
HivePartitioningOptions.Builder