Interface UpdatePartitionSpec
- All Superinterfaces:
PendingUpdate<PartitionSpec>
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
Modifier and TypeMethodDescriptionAdd a new partition field from a source column.Add a new partition field from anexpression term
, with the given partition field name.Add a new partition field from anexpression term
.default UpdatePartitionSpec
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.caseSensitive
(boolean isCaseSensitive) Set whether column resolution in the source schema should be case sensitive.removeField
(String name) Remove a partition field by name.removeField
(Term term) Remove a partition field by its transformexpression term
.renameField
(String name, String newName) Rename a field in the partition spec.Methods inherited from interface org.apache.iceberg.PendingUpdate
apply, commit, updateEvent
-
Method Details
-
caseSensitive
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
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:
IllegalArgumentException
- If the an identity partition field for the source already exists, or if this change conflicts with other additions, removals, or renames.
-
addField
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:
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
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:
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
Remove a partition field by name.- Parameters:
name
- name of the partition field to remove- Returns:
- this for method chaining
- Throws:
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
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:
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
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:
IllegalArgumentException
- If name doesn't identify a column in the schema or if this change conflicts with other additions, removals, or renames.
-
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
-