@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 table
$dropPartition(org.apache.spark.sql.catalyst.InternalRow)
:
remove a partition and any data it contains from the table
$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 other
Modifier 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() . |
void |
replacePartitionMetadata(org.apache.spark.sql.catalyst.InternalRow ident,
java.util.Map<String,String> properties)
Replace the partition metadata of the existing partition.
|
capabilities, 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.PartitionAlreadyExistsException, UnsupportedOperationException
ident
- a new partition identifierproperties
- the metadata of a partitionorg.apache.spark.sql.catalyst.analysis.PartitionAlreadyExistsException
- 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 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.