@Experimental public interface SupportsPartitionManagement extends Table
Table
.
A partition is composed of identifier and properties,
and properties contains metadata information of the partition.
These APIs are used to modify table partition identifier or partition metadata. In some cases, they will change the table data as well.
createPartition(org.apache.spark.sql.catalyst.InternalRow, java.util.Map<java.lang.String, java.lang.String>)
: add a partition and any data it contains to the tabledropPartition(org.apache.spark.sql.catalyst.InternalRow)
: remove a partition and any data it contains from the tablepurgePartition(org.apache.spark.sql.catalyst.InternalRow)
: remove a partition and any data it contains from the table by
skipping a trash even if it is supported.replacePartitionMetadata(org.apache.spark.sql.catalyst.InternalRow, java.util.Map<java.lang.String, java.lang.String>)
: point a partition to a new location, which will swap
one location's data for the othertruncatePartition(org.apache.spark.sql.catalyst.InternalRow)
: remove partition data from the tableModifier and Type | Method and Description |
---|---|
void |
createPartition(org.apache.spark.sql.catalyst.InternalRow ident,
java.util.Map<String,String> properties)
Create a partition in table.
|
boolean |
dropPartition(org.apache.spark.sql.catalyst.InternalRow ident)
Drop a partition from table.
|
org.apache.spark.sql.catalyst.InternalRow[] |
listPartitionIdentifiers(String[] names,
org.apache.spark.sql.catalyst.InternalRow ident)
List the identifiers of all partitions that match to the ident by names.
|
java.util.Map<String,String> |
loadPartitionMetadata(org.apache.spark.sql.catalyst.InternalRow ident)
Retrieve the partition metadata of the existing partition.
|
default boolean |
partitionExists(org.apache.spark.sql.catalyst.InternalRow ident)
Test whether a partition exists using an
ident from the table. |
StructType |
partitionSchema()
Get the partition schema of table,
this must be consistent with $
Table.partitioning() . |
default boolean |
purgePartition(org.apache.spark.sql.catalyst.InternalRow ident)
Drop a partition from the table and completely remove partition data by skipping a trash
even if it is supported.
|
default boolean |
renamePartition(org.apache.spark.sql.catalyst.InternalRow from,
org.apache.spark.sql.catalyst.InternalRow to)
Rename an existing partition of the table.
|
void |
replacePartitionMetadata(org.apache.spark.sql.catalyst.InternalRow ident,
java.util.Map<String,String> properties)
Replace the partition metadata of the existing partition.
|
default boolean |
truncatePartition(org.apache.spark.sql.catalyst.InternalRow ident)
Truncate a partition in the table by completely removing partition data.
|
capabilities, columns, name, partitioning, properties, schema
StructType partitionSchema()
Table.partitioning()
.void createPartition(org.apache.spark.sql.catalyst.InternalRow ident, java.util.Map<String,String> properties) throws org.apache.spark.sql.catalyst.analysis.PartitionsAlreadyExistException, UnsupportedOperationException
ident
- a new partition identifierproperties
- the metadata of a partitionorg.apache.spark.sql.catalyst.analysis.PartitionsAlreadyExistException
- If a partition already exists for the identifierUnsupportedOperationException
- If partition property is not supportedboolean dropPartition(org.apache.spark.sql.catalyst.InternalRow ident)
ident
- a partition identifierdefault boolean purgePartition(org.apache.spark.sql.catalyst.InternalRow ident) throws org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException, UnsupportedOperationException
ident
- a partition identifierorg.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
- If the partition identifier to alter doesn't existUnsupportedOperationException
- If partition purging is not supporteddefault boolean partitionExists(org.apache.spark.sql.catalyst.InternalRow ident)
ident
from the table.ident
- a partition identifier which must contain all partition fields in ordervoid replacePartitionMetadata(org.apache.spark.sql.catalyst.InternalRow ident, java.util.Map<String,String> properties) throws org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException, UnsupportedOperationException
ident
- the partition identifier of the existing partitionproperties
- the new metadata of the partitionorg.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
- If the partition identifier to alter doesn't existUnsupportedOperationException
- If partition property is not supportedjava.util.Map<String,String> loadPartitionMetadata(org.apache.spark.sql.catalyst.InternalRow ident) throws UnsupportedOperationException
ident
- a partition identifierUnsupportedOperationException
- If partition property is not supportedorg.apache.spark.sql.catalyst.InternalRow[] listPartitionIdentifiers(String[] names, org.apache.spark.sql.catalyst.InternalRow ident)
names
- the names of partition values in the identifier.ident
- a partition identifier values.default boolean renamePartition(org.apache.spark.sql.catalyst.InternalRow from, org.apache.spark.sql.catalyst.InternalRow to) throws UnsupportedOperationException, org.apache.spark.sql.catalyst.analysis.PartitionsAlreadyExistException, org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
from
- an existing partition identifier to renameto
- new partition identifierUnsupportedOperationException
- If partition renaming is not supportedorg.apache.spark.sql.catalyst.analysis.PartitionsAlreadyExistException
- If the `to` partition exists alreadyorg.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
- If the `from` partition does not existdefault boolean truncatePartition(org.apache.spark.sql.catalyst.InternalRow ident) throws org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException, UnsupportedOperationException
ident
- a partition identifierorg.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
- If the partition identifier to alter doesn't existUnsupportedOperationException
- If partition truncation is not supported