Package com.google.cloud.bigquery
Class TimePartitioning
- java.lang.Object
-
- com.google.cloud.bigquery.TimePartitioning
-
- All Implemented Interfaces:
Serializable
public abstract class TimePartitioning extends Object implements Serializable
Objects of this class allow to configure table partitioning based on time. By dividing a large table into smaller partitions, you can improve query performance and reduce the number of bytes billed by restricting the amount of data scanned.- See Also:
- Partitioned Tables, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TimePartitioning.Builder
static class
TimePartitioning.Type
[Optional] The supported types are DAY, HOUR, MONTH, and YEAR, which will generate one partition per day, hour, month, and year, respectively.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Long
getExpirationMs()
Returns the number of milliseconds for which to keep the storage for a partition.abstract String
getField()
If not set, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the table is partitioned by this field.abstract Boolean
getRequirePartitionFilter()
If set to true, queries over this table require a partition filter (that can be used for partition elimination) to be specified.abstract TimePartitioning.Type
getType()
Returns the time partitioning type.static TimePartitioning.Builder
newBuilder(TimePartitioning.Type type)
Returns aTimePartitioning
object given the time partitioning type.static TimePartitioning
of(TimePartitioning.Type type)
Returns aTimePartitioning
object given the time partitioning type.static TimePartitioning
of(TimePartitioning.Type type, long expirationMs)
Returns aTimePartitioning
object given the time partitioning type and the partition's expiration in milliseconds.abstract TimePartitioning.Builder
toBuilder()
-
-
-
Method Detail
-
getType
public abstract TimePartitioning.Type getType()
Returns the time partitioning type.
-
getExpirationMs
@Nullable public abstract Long getExpirationMs()
Returns the number of milliseconds for which to keep the storage for a partition. When expired, the storage for the partition is reclaimed. If null, the partion does not expire.
-
getField
@BetaApi @Nullable public abstract String getField()
If not set, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the table is partitioned by this field.
-
getRequirePartitionFilter
@BetaApi @Nullable public abstract Boolean getRequirePartitionFilter()
If set to true, queries over this table require a partition filter (that can be used for partition elimination) to be specified.
-
toBuilder
public abstract TimePartitioning.Builder toBuilder()
-
newBuilder
public static TimePartitioning.Builder newBuilder(TimePartitioning.Type type)
Returns aTimePartitioning
object given the time partitioning type.
-
of
public static TimePartitioning of(TimePartitioning.Type type)
Returns aTimePartitioning
object given the time partitioning type. The partitions will not expire.
-
of
public static TimePartitioning of(TimePartitioning.Type type, long expirationMs)
Returns aTimePartitioning
object given the time partitioning type and the partition's expiration in milliseconds.- Parameters:
type
- the time partitioning type.expirationMs
- the number of milliseconds for which to keep the storage for a partition
-
-