[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.
[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.
[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.
[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).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class HivePartitioningOptions.Builder (2.54.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.54.1 (latest)](/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.54.0](/java/docs/reference/google-cloud-bigquery/2.54.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.53.0](/java/docs/reference/google-cloud-bigquery/2.53.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.52.0](/java/docs/reference/google-cloud-bigquery/2.52.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.51.0](/java/docs/reference/google-cloud-bigquery/2.51.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.50.1](/java/docs/reference/google-cloud-bigquery/2.50.1/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.49.0](/java/docs/reference/google-cloud-bigquery/2.49.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.48.1](/java/docs/reference/google-cloud-bigquery/2.48.1/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.47.0](/java/docs/reference/google-cloud-bigquery/2.47.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.46.0](/java/docs/reference/google-cloud-bigquery/2.46.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.45.0](/java/docs/reference/google-cloud-bigquery/2.45.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.44.0](/java/docs/reference/google-cloud-bigquery/2.44.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.43.3](/java/docs/reference/google-cloud-bigquery/2.43.3/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.42.3](/java/docs/reference/google-cloud-bigquery/2.42.3/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.41.0](/java/docs/reference/google-cloud-bigquery/2.41.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.40.3](/java/docs/reference/google-cloud-bigquery/2.40.3/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.39.1](/java/docs/reference/google-cloud-bigquery/2.39.1/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.38.2](/java/docs/reference/google-cloud-bigquery/2.38.2/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.37.2](/java/docs/reference/google-cloud-bigquery/2.37.2/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.36.0](/java/docs/reference/google-cloud-bigquery/2.36.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.35.0](/java/docs/reference/google-cloud-bigquery/2.35.0/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.34.2](/java/docs/reference/google-cloud-bigquery/2.34.2/com.google.cloud.bigquery.HivePartitioningOptions.Builder)\n- [2.33.2](/java/docs/reference/google-cloud-bigquery/2.33.2/com.google.cloud.bigquery.HivePartitioningOptions.Builder) \n\n public static final class HivePartitioningOptions.Builder\n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e HivePartitioningOptions.Builder \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nMethods\n-------\n\n### build()\n\n public HivePartitioningOptions build()\n\nCreates a [HivePartitioningOptions](/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.HivePartitioningOptions) object.\n\n### setFields(List\\\u003cString\\\u003e fields)\n\n public HivePartitioningOptions.Builder setFields(List\u003cString\u003e fields)\n\n\\[Output-only\\] For permanent external tables, this field is populated with the hive partition\nkeys in the order they were inferred.\n\nThe types of the partition keys can be deduced by checking the table schema (which will\ninclude the partition keys). Not every API will populate this field in the output. For\nexample, Tables.Get will populate it, but Tables.List will not contain this field.\n\n### setMode(String mode)\n\n public HivePartitioningOptions.Builder setMode(String mode)\n\n\\[Optional\\] When set, what mode of hive partitioning to use when reading data. Two modes are\nsupported. (1) AUTO: automatically infer partition key name(s) and type(s). (2) STRINGS:\nautomatically infer partition key name(s). All types are interpreted as strings. Not all\nstorage formats support hive partitioning. Requesting hive partitioning on an unsupported\nformat will lead to an error. Currently supported types include: AVRO, CSV, JSON, ORC and\nParquet.\n\n### setRequirePartitionFilter(Boolean requirePartitionFilter)\n\n public HivePartitioningOptions.Builder setRequirePartitionFilter(Boolean requirePartitionFilter)\n\n\\[Optional\\] If set to true, queries over this table require a partition filter that can be\nused for partition elimination to be specified. Note that this field should only be true when\ncreating a permanent external table or querying a temporary external table. Hive-partitioned\nloads with requirePartitionFilter explicitly set to true will fail.\n\n### setSourceUriPrefix(String sourceUriPrefix)\n\n public HivePartitioningOptions.Builder setSourceUriPrefix(String sourceUriPrefix)\n\n\\[Optional\\] When hive partition detection is requested, a common prefix for all source uris\nshould be supplied. The prefix must end immediately before the partition key encoding begins.\nFor example, consider files following this data layout.\ngs://bucket/path_to_table/dt=2019-01-01/country=BR/id=7/file.avro\ngs://bucket/path_to_table/dt=2018-12-31/country=CA/id=3/file.avro When hive partitioning is\nrequested with either AUTO or STRINGS detection, the common prefix can be either of\ngs://bucket/path_to_table or gs://bucket/path_to_table/ (trailing slash does not matter)."]]