@Evolving public interface TableChange
Modifier and Type | Interface and Description |
---|---|
static class |
TableChange.AddColumn
A TableChange to add a field.
|
static class |
TableChange.AddIndex
A TableChange to add an index.
|
static class |
TableChange.After
Column position AFTER means the specified column should be put after the given `column`.
|
static interface |
TableChange.ColumnChange
The interface for all column changes.
|
static interface |
TableChange.ColumnPosition
The interface for all column positions.
|
static class |
TableChange.Default
Column position DEFAULT means the position of the column was ignored by the user, and should be
determined by the catalog implementation.
|
static class |
TableChange.DeleteColumn
A TableChange to delete a field.
|
static class |
TableChange.DeleteIndex
A TableChange to delete an index.
|
static class |
TableChange.First
Column position FIRST means the specified column should be the first column.
|
static class |
TableChange.RemoveProperty
A TableChange to remove a table property.
|
static class |
TableChange.RenameColumn
A TableChange to rename a field.
|
static class |
TableChange.RenameTable
A TableChange to rename a table.
|
static class |
TableChange.SetProperty
A TableChange to set a table property.
|
static class |
TableChange.UpdateColumnAutoIncrement
A TableChange to update the autoIncrement of a field.
|
static class |
TableChange.UpdateColumnComment
A TableChange to update the comment of a field.
|
static class |
TableChange.UpdateColumnDefaultValue
A TableChange to update the default of a field.
|
static class |
TableChange.UpdateColumnNullability
A TableChange to update the nullability of a field.
|
static class |
TableChange.UpdateColumnPosition
A TableChange to update the position of a field.
|
static class |
TableChange.UpdateColumnType
A TableChange to update the type of a field.
|
static class |
TableChange.UpdateComment
A TableChange to update a table's comment.
|
Modifier and Type | Method and Description |
---|---|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType)
Create a TableChange for adding an optional column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
boolean nullable)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
Expression defaultValue)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
boolean nullable)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
Expression defaultValue)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
TableChange.ColumnPosition position)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
TableChange.ColumnPosition position,
boolean nullable)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
TableChange.ColumnPosition position,
boolean nullable,
boolean autoIncrement)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
TableChange.ColumnPosition position,
boolean nullable,
boolean autoIncrement,
Expression defaultValue)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
java.lang.String comment,
TableChange.ColumnPosition position,
Expression defaultValue)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
TableChange.ColumnPosition position)
Create a TableChange for adding a column.
|
static TableChange |
addColumn(java.lang.String[] fieldName,
Type dataType,
TableChange.ColumnPosition position,
Expression defaultValue)
Create a TableChange for adding a column.
|
static TableChange |
addIndex(Index.IndexType type,
java.lang.String name,
java.lang.String[][] fieldNames)
Create a TableChange for adding an index.
|
static TableChange |
deleteColumn(java.lang.String[] fieldName,
java.lang.Boolean ifExists)
Create a TableChange for deleting a field.
|
static TableChange |
deleteIndex(java.lang.String name,
java.lang.Boolean ifExists)
Create a TableChange for deleting an index.
|
static TableChange |
removeProperty(java.lang.String property)
Create a TableChange for removing a table property.
|
static TableChange |
rename(java.lang.String newName)
Create a TableChange for renaming a table.
|
static TableChange |
renameColumn(java.lang.String[] fieldName,
java.lang.String newName)
Create a TableChange for renaming a field.
|
static TableChange |
setProperty(java.lang.String property,
java.lang.String value)
Create a TableChange for setting a table property.
|
static TableChange |
updateColumnAutoIncrement(java.lang.String[] fieldName,
boolean autoIncrement)
Create a TableChange for updating the autoIncrement of a field.
|
static TableChange |
updateColumnComment(java.lang.String[] fieldName,
java.lang.String newComment)
Create a TableChange for updating the comment of a field.
|
static TableChange |
updateColumnDefaultValue(java.lang.String[] fieldName,
Expression newDefaultValue)
Create a TableChange for updating the default value of a field.
|
static TableChange |
updateColumnNullability(java.lang.String[] fieldName,
boolean nullable)
Create a TableChange for updating the nullability of a field.
|
static TableChange |
updateColumnPosition(java.lang.String[] fieldName,
TableChange.ColumnPosition newPosition)
Create a TableChange for updating the position of a field.
|
static TableChange |
updateColumnType(java.lang.String[] fieldName,
Type newDataType)
Create a TableChange for updating the type of a field that is nullable.
|
static TableChange |
updateComment(java.lang.String newComment)
Create a TableChange for updating the comment.
|
static TableChange rename(java.lang.String newName)
newName
- The new table name.static TableChange updateComment(java.lang.String newComment)
newComment
- The new comment.static TableChange setProperty(java.lang.String property, java.lang.String value)
If the property already exists, it will be replaced with the new value.
property
- The property name.value
- The new property value.static TableChange removeProperty(java.lang.String property)
If the property does not exist, the change will succeed.
property
- The property name.static TableChange addColumn(java.lang.String[] fieldName, Type dataType)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- The field name of the new column.dataType
- The new column's data type.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- The field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, TableChange.ColumnPosition position)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- The field name of the new column.dataType
- The new column's data type.position
- The new column's position.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, TableChange.ColumnPosition position)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.position
- The new column's position.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, boolean nullable)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- Field name of the new column.dataType
- The new column's data type.nullable
- The new column's nullable.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, boolean nullable)
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.nullable
- The new column's nullable.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, Expression defaultValue)
fieldName
- Field name of the new column.dataType
- The new column's data type.defaultValue
- The new column's default value.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, Expression defaultValue)
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.defaultValue
- The new column's default value.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, TableChange.ColumnPosition position, Expression defaultValue)
fieldName
- Field name of the new column.dataType
- The new column's data type.position
- The new column's position.defaultValue
- The new column's default value.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, TableChange.ColumnPosition position, Expression defaultValue)
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.position
- The new column's position.defaultValue
- The new column's default value.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, TableChange.ColumnPosition position, boolean nullable)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.position
- The new column's position.nullable
- The new column's nullable.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, TableChange.ColumnPosition position, boolean nullable, boolean autoIncrement)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.position
- The new column's position.nullable
- The new column's nullable.autoIncrement
- The new column's autoIncrement.static TableChange addColumn(java.lang.String[] fieldName, Type dataType, java.lang.String comment, TableChange.ColumnPosition position, boolean nullable, boolean autoIncrement, Expression defaultValue)
If the field already exists, the change will result in an IllegalArgumentException
.
If the new field is nested and its parent does not exist or is not a struct, the change will
result in an IllegalArgumentException
.
fieldName
- Field name of the new column.dataType
- The new column's data type.comment
- The new field's comment string.position
- The new column's position.nullable
- The new column's nullable.autoIncrement
- The new column's autoIncrement.defaultValue
- The new column's default value.static TableChange renameColumn(java.lang.String[] fieldName, java.lang.String newName)
The name is used to find the field to rename. The new name will replace the leaf field name. For example, renameColumn(["a", "b", "c"], "x") should produce column a.b.x.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The current field name.newName
- The new name.static TableChange updateColumnDefaultValue(java.lang.String[] fieldName, Expression newDefaultValue)
The name is used to find the field to update.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The field name of the column to update.newDefaultValue
- The new default value.static TableChange updateColumnType(java.lang.String[] fieldName, Type newDataType)
The field name are used to find the field to update.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The field name of the column to update.newDataType
- The new data type.static TableChange updateColumnComment(java.lang.String[] fieldName, java.lang.String newComment)
The name is used to find the field to update.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The field name of the column to update.newComment
- The new comment.static TableChange updateColumnPosition(java.lang.String[] fieldName, TableChange.ColumnPosition newPosition)
The name is used to find the field to update.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The field name of the column to update.newPosition
- The new position.static TableChange deleteColumn(java.lang.String[] fieldName, java.lang.Boolean ifExists)
If the field does not exist, the change will result in an IllegalArgumentException
unless ifExists
is true.
fieldName
- Field name of the column to delete.ifExists
- If true, silence the error if column does not exist during drop. Otherwise, an
IllegalArgumentException
will be thrown.static TableChange updateColumnNullability(java.lang.String[] fieldName, boolean nullable)
The name are used to find the field to update.
If the field does not exist, the change will result in an IllegalArgumentException
.
fieldName
- The field name of the column to update.nullable
- The new nullability.static TableChange addIndex(Index.IndexType type, java.lang.String name, java.lang.String[][] fieldNames)
type
- The type of the index.name
- The name of the index.fieldNames
- The field names of the index.static TableChange deleteIndex(java.lang.String name, java.lang.Boolean ifExists)
name
- The name of the index to be dropped.ifExists
- If true, silence the error if column does not exist during drop. Otherwise, an
IllegalArgumentException
will be thrown.static TableChange updateColumnAutoIncrement(java.lang.String[] fieldName, boolean autoIncrement)
fieldName
- The field name of the column to update.autoIncrement
- Whether the column is auto-incremented.