public interface UpdateSchema extends PendingUpdate<Schema>
When committing, these changes will be applied to the current table metadata. Commit conflicts
will not be resolved and will result in a CommitFailedException
.
Modifier and Type | Method and Description |
---|---|
default UpdateSchema |
addColumn(java.lang.String parent,
java.lang.String name,
Type type)
Add a new column to a nested struct.
|
UpdateSchema |
addColumn(java.lang.String parent,
java.lang.String name,
Type type,
java.lang.String doc)
Add a new column to a nested struct.
|
default UpdateSchema |
addColumn(java.lang.String name,
Type type)
Add a new top-level column.
|
UpdateSchema |
addColumn(java.lang.String name,
Type type,
java.lang.String doc)
Add a new top-level column.
|
UpdateSchema |
deleteColumn(java.lang.String name)
Delete a column in the schema.
|
UpdateSchema |
renameColumn(java.lang.String name,
java.lang.String newName)
Rename a column in the schema.
|
UpdateSchema |
updateColumn(java.lang.String name,
Type.PrimitiveType newType)
Update a column in the schema to a new primitive type.
|
default UpdateSchema |
updateColumn(java.lang.String name,
Type.PrimitiveType newType,
java.lang.String newDoc)
Update a column in the schema to a new primitive type.
|
UpdateSchema |
updateColumnDoc(java.lang.String name,
java.lang.String newDoc)
Update a column in the schema to a new primitive type.
|
apply, commit
default UpdateSchema addColumn(java.lang.String name, Type type)
Because "." may be interpreted as a column path separator or may be used in field names, it is
not allowed in names passed to this method. To add to nested structures or to add fields with
names that contain ".", use addColumn(String, String, Type)
.
If type is a nested type, its field IDs are reassigned when added to the existing schema.
name
- name for the new columntype
- type for the new columnjava.lang.IllegalArgumentException
- If name contains "."UpdateSchema addColumn(java.lang.String name, Type type, java.lang.String doc)
Because "." may be interpreted as a column path separator or may be used in field names, it is
not allowed in names passed to this method. To add to nested structures or to add fields with
names that contain ".", use addColumn(String, String, Type)
.
If type is a nested type, its field IDs are reassigned when added to the existing schema.
name
- name for the new columntype
- type for the new columndoc
- documentation string for the new columnjava.lang.IllegalArgumentException
- If name contains "."default UpdateSchema addColumn(java.lang.String parent, java.lang.String name, Type type)
The parent name is used to find the parent using Schema.findField(String)
. If the
parent name is null, the new column will be added to the root as a top-level column. If parent
identifies a struct, a new column is added to that struct. If it identifies a list, the column
is added to the list element struct, and if it identifies a map, the new column is added to
the map's value struct.
The given name is used to name the new column and names containing "." are not handled differently.
If type is a nested type, its field IDs are reassigned when added to the existing schema.
parent
- name of the parent struct to the column will be added toname
- name for the new columntype
- type for the new columnjava.lang.IllegalArgumentException
- If parent doesn't identify a structUpdateSchema addColumn(java.lang.String parent, java.lang.String name, Type type, java.lang.String doc)
The parent name is used to find the parent using Schema.findField(String)
. If the
parent name is null, the new column will be added to the root as a top-level column. If parent
identifies a struct, a new column is added to that struct. If it identifies a list, the column
is added to the list element struct, and if it identifies a map, the new column is added to
the map's value struct.
The given name is used to name the new column and names containing "." are not handled differently.
If type is a nested type, its field IDs are reassigned when added to the existing schema.
parent
- name of the parent struct to the column will be added toname
- name for the new columntype
- type for the new columndoc
- documentation string for the new columnjava.lang.IllegalArgumentException
- If parent doesn't identify a structUpdateSchema renameColumn(java.lang.String name, java.lang.String newName)
The name is used to find the column to rename using Schema.findField(String)
.
The new name may contain "." and such names are not parsed or handled differently.
Columns may be updated and renamed in the same schema update.
name
- name of the column to renamenewName
- replacement name for the columnjava.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this
change conflicts with other additions, renames, or updates.UpdateSchema updateColumn(java.lang.String name, Type.PrimitiveType newType)
The name is used to find the column to update using Schema.findField(String)
.
Only updates that widen types are allowed.
Columns may be updated and renamed in the same schema update.
name
- name of the column to renamenewType
- replacement type for the columnjava.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this
change introduces a type incompatibility or if it conflicts
with other additions, renames, or updates.default UpdateSchema updateColumn(java.lang.String name, Type.PrimitiveType newType, java.lang.String newDoc)
The name is used to find the column to update using Schema.findField(String)
.
Only updates that widen types are allowed.
Columns may be updated and renamed in the same schema update.
name
- name of the column to renamenewType
- replacement type for the columnnewDoc
- replacement documentation string for the columnjava.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this
change introduces a type incompatibility or if it conflicts
with other additions, renames, or updates.UpdateSchema updateColumnDoc(java.lang.String name, java.lang.String newDoc)
The name is used to find the column to update using Schema.findField(String)
.
Columns may be updated and renamed in the same schema update.
name
- name of the column to renamenewDoc
- replacement documentation string for the columnjava.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this
change introduces a type incompatibility or if it conflicts
with other additions, renames, or updates.UpdateSchema deleteColumn(java.lang.String name)
The name is used to find the column to delete using Schema.findField(String)
.
name
- name of the column to deletejava.lang.IllegalArgumentException
- If name doesn't identify a column in the schema or if this
change conflicts with other additions, renames, or updates.