Class TableChange.AddColumn

java.lang.Object
org.apache.gravitino.rel.TableChange.AddColumn
All Implemented Interfaces:
TableChange, TableChange.ColumnChange
Enclosing interface:
TableChange

public static final class TableChange.AddColumn extends Object implements TableChange.ColumnChange
A TableChange to add a field. The implementation may need to back-fill all the existing data to add this new column, or remember the column default value specified here and let the reader fill the column value when reading existing data that do not have this new column.

If the field already exists, the change must result in an IllegalArgumentException. If the new field is nested and its parent does not exist or is not a struct, the change must result in an IllegalArgumentException.

  • Method Details

    • getFieldName

      public String[] getFieldName()
      Retrieves the field name of the new column.
      Returns:
      An array of strings representing the field name.
    • getDataType

      public Type getDataType()
      Retrieves the data type of the new column.
      Returns:
      The data type of the column.
    • getComment

      public String getComment()
      Retrieves the comment for the new column.
      Returns:
      The comment associated with the column.
    • getPosition

      public TableChange.ColumnPosition getPosition()
      Retrieves the position where the new column should be added.
      Returns:
      The position of the column.
    • isNullable

      public boolean isNullable()
      Checks if the new column is nullable.
      Returns:
      true if the column is nullable; false otherwise.
    • isAutoIncrement

      public boolean isAutoIncrement()
      Checks if the new column is autoIncrement.
      Returns:
      true if the column is autoIncrement; false otherwise.
    • getDefaultValue

      public Expression getDefaultValue()
      Retrieves the default value of the new column.
      Returns:
      The default value of the column.
    • equals

      public boolean equals(Object o)
      Compares this AddColumn instance with another object for equality. The comparison is based on the field name, data type, comment, position, and nullability.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare with this instance.
      Returns:
      true if the given object represents the same column addition; false otherwise.
    • hashCode

      public int hashCode()
      Generates a hash code for this AddColumn instance. This hash code is based on the field name, data type, comment, position, nullability, and autoIncrement.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code value for this column addition operation.
    • fieldName

      public String[] fieldName()
      Description copied from interface: TableChange.ColumnChange
      Retrieves the field name of the column to be modified.
      Specified by:
      fieldName in interface TableChange.ColumnChange
      Returns:
      An array of strings representing the field name.