Interface UpdatePartitionSpec
-
- All Superinterfaces:
PendingUpdate<PartitionSpec>
public interface UpdatePartitionSpec extends PendingUpdate<PartitionSpec>
API for partition spec evolution.When committing, these changes will be applied to the current table metadata. Commit conflicts will not be resolved and will result in a
CommitFailedException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description UpdatePartitionSpec
addField(java.lang.String sourceName)
Add a new partition field from a source column.UpdatePartitionSpec
addField(java.lang.String name, Term term)
Add a new partition field from anexpression term
, with the given partition field name.UpdatePartitionSpec
addField(Term term)
Add a new partition field from anexpression term
.default UpdatePartitionSpec
addNonDefaultSpec()
Sets that the new partition spec will be NOT set as the default partition spec for the table, the default behavior is to do so.UpdatePartitionSpec
caseSensitive(boolean isCaseSensitive)
Set whether column resolution in the source schema should be case sensitive.UpdatePartitionSpec
removeField(java.lang.String name)
Remove a partition field by name.UpdatePartitionSpec
removeField(Term term)
Remove a partition field by its transformexpression term
.UpdatePartitionSpec
renameField(java.lang.String name, java.lang.String newName)
Rename a field in the partition spec.-
Methods inherited from interface org.apache.iceberg.PendingUpdate
apply, commit, updateEvent
-
-
-
-
Method Detail
-
caseSensitive
UpdatePartitionSpec caseSensitive(boolean isCaseSensitive)
Set whether column resolution in the source schema should be case sensitive.- Parameters:
isCaseSensitive
- whether column resolution should be case sensitive- Returns:
- this for method chaining
-
addField
UpdatePartitionSpec addField(java.lang.String sourceName)
Add a new partition field from a source column.The partition field will be created as an identity partition field for the given source column, with the same name as the source column.
The source column is located using
Schema.findField(String)
.- Parameters:
sourceName
- source column name in the table schema- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If the an identity partition field for the source already exists, or if this change conflicts with other additions, removals, or renames.
-
addField
UpdatePartitionSpec addField(Term term)
Add a new partition field from anexpression term
.The partition field will use the term's transform or the identity transform if the term is a reference.
The term's reference is used to locate the source column using
Schema.findField(String)
.The new partition field will be named for the source column and the transform.
- Parameters:
term
- source column name in the table schema- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If the a partition field for the transform and source already exists, or if this change conflicts with other additions, removals, or renames.
-
addField
UpdatePartitionSpec addField(java.lang.String name, Term term)
Add a new partition field from anexpression term
, with the given partition field name.The partition field will use the term's transform or the identity transform if the term is a reference.
The term's reference is used to locate the source column using
Schema.findField(String)
.- Parameters:
name
- name for the partition fieldterm
- expression for the partition transform- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If the a partition field for the transform and source already exists, if a partition field with the given name already exists, or if this change conflicts with other additions, removals, or renames.
-
removeField
UpdatePartitionSpec removeField(java.lang.String name)
Remove a partition field by name.- Parameters:
name
- name of the partition field to remove- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If the a partition field with the given name does not exist, or if this change conflicts with other additions, removals, or renames.
-
removeField
UpdatePartitionSpec removeField(Term term)
Remove a partition field by its transformexpression term
.The partition field with the same transform and source reference will be removed. If the term is a reference and does not have a transform, the identity transform is used.
- Parameters:
term
- expression for the partition transform to remove- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If the a partition field with the given transform and source does not exist, or if this change conflicts with other additions, removals, or renames.
-
renameField
UpdatePartitionSpec renameField(java.lang.String name, java.lang.String newName)
Rename a field in the partition spec.- Parameters:
name
- name of the partition field to renamenewName
- replacement name for the partition field- Returns:
- this for method chaining
- Throws:
java.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this change conflicts with other additions, removals, or renames.
-
addNonDefaultSpec
default UpdatePartitionSpec addNonDefaultSpec()
Sets that the new partition spec will be NOT set as the default partition spec for the table, the default behavior is to do so.- Returns:
- this for method chaining
-
-