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 Details

    • 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(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:
      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 an expression 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

      UpdatePartitionSpec addField(String name, Term term)
      Add a new partition field from an expression 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 field
      term - 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

      UpdatePartitionSpec removeField(String name)
      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

      UpdatePartitionSpec removeField(Term term)
      Remove a partition field by its transform expression 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

      UpdatePartitionSpec renameField(String name, String newName)
      Rename a field in the partition spec.
      Parameters:
      name - name of the partition field to rename
      newName - 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

      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