public class RelationalCatalog extends CatalogDTO implements TableCatalog
Catalog.Type
Modifier and Type | Field and Description |
---|---|
protected RESTClient |
restClient
The REST client to send the requests.
|
PROPERTY_PACKAGE
Modifier and Type | Method and Description |
---|---|
Schema |
alterSchema(NameIdentifier ident,
SchemaChange... changes)
Alter the schema with specified identifier by applying the changes.
|
Table |
alterTable(NameIdentifier ident,
TableChange... changes)
Alter the table with specified identifier by applying the changes.
|
SupportsSchemas |
asSchemas()
Return the
SupportsSchemas if the catalog supports schema operations. |
TableCatalog |
asTableCatalog() |
static com.datastrato.gravitino.client.RelationalCatalog.Builder |
builder()
Create a new builder for the relational catalog.
|
Schema |
createSchema(NameIdentifier ident,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties)
Create a new schema with specified identifier, comment and metadata.
|
Table |
createTable(NameIdentifier ident,
Column[] columns,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties,
Transform[] partitioning,
Distribution distribution,
SortOrder[] sortOrders,
Index[] indexes)
Create a new table with specified identifier, columns, comment and properties.
|
boolean |
dropSchema(NameIdentifier ident,
boolean cascade)
Drop the schema with specified identifier.
|
boolean |
dropTable(NameIdentifier ident)
Drop the table with specified identifier.
|
NameIdentifier[] |
listSchemas(Namespace namespace)
List all the schemas under the given catalog namespace.
|
NameIdentifier[] |
listTables(Namespace namespace)
List all the tables under the given Schema namespace.
|
Schema |
loadSchema(NameIdentifier ident)
Load the schema with specified identifier.
|
Table |
loadTable(NameIdentifier ident)
Load the table with specified identifier.
|
boolean |
purgeTable(NameIdentifier ident)
Purge the table with specified identifier.
|
auditInfo, comment, name, properties, provider, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTable, createTable, createTable, createTable, createTable, createTable, tableExists
schemaExists
asFilesetCatalog, asTopicCatalog
protected final RESTClient restClient
public TableCatalog asTableCatalog()
asTableCatalog
in interface Catalog
TableCatalog
if the catalog supports table operations.public NameIdentifier[] listTables(Namespace namespace) throws NoSuchSchemaException
listTables
in interface TableCatalog
namespace
- The namespace to list the tables under it.NameIdentifier
of the tables under the given namespace.NoSuchSchemaException
- if the schema with specified namespace does not exist.public Table loadTable(NameIdentifier ident) throws NoSuchTableException
loadTable
in interface TableCatalog
ident
- The identifier of the table to load.Table
with specified identifier.NoSuchTableException
- if the table with specified identifier does not exist.public Table createTable(NameIdentifier ident, Column[] columns, java.lang.String comment, java.util.Map<java.lang.String,java.lang.String> properties, Transform[] partitioning, Distribution distribution, SortOrder[] sortOrders, Index[] indexes) throws NoSuchSchemaException, TableAlreadyExistsException
createTable
in interface TableCatalog
ident
- The identifier of the table.columns
- The columns of the table.comment
- The comment of the table.properties
- The properties of the table.partitioning
- The partitioning of the table.indexes
- The indexes of the table.distribution
- The distribution of the tablesortOrders
- The sort orders of the tableTable
.NoSuchSchemaException
- if the schema with specified namespace does not exist.TableAlreadyExistsException
- if the table with specified identifier already exists.public Table alterTable(NameIdentifier ident, TableChange... changes) throws NoSuchTableException, java.lang.IllegalArgumentException
alterTable
in interface TableCatalog
ident
- The identifier of the table.changes
- Table changes to apply to the table.Table
.NoSuchTableException
- if the table with specified identifier does not exist.java.lang.IllegalArgumentException
- if the changes are invalid.public boolean dropTable(NameIdentifier ident)
dropTable
in interface TableCatalog
ident
- The identifier of the table.public boolean purgeTable(NameIdentifier ident) throws java.lang.UnsupportedOperationException
purgeTable
in interface TableCatalog
ident
- The identifier of the table.java.lang.UnsupportedOperationException
- If the catalog does not support to purge a table.public static com.datastrato.gravitino.client.RelationalCatalog.Builder builder()
public SupportsSchemas asSchemas() throws java.lang.UnsupportedOperationException
Catalog
SupportsSchemas
if the catalog supports schema operations.asSchemas
in interface Catalog
SupportsSchemas
if the catalog supports schema operations.java.lang.UnsupportedOperationException
- if the catalog does not support schema operations.public NameIdentifier[] listSchemas(Namespace namespace) throws NoSuchCatalogException
listSchemas
in interface SupportsSchemas
namespace
- The namespace of the catalog.NameIdentifier
of the schemas under the given catalog namespace.NoSuchCatalogException
- if the catalog with specified namespace does not exist.public Schema createSchema(NameIdentifier ident, java.lang.String comment, java.util.Map<java.lang.String,java.lang.String> properties) throws NoSuchCatalogException, SchemaAlreadyExistsException
createSchema
in interface SupportsSchemas
ident
- The name identifier of the schema.comment
- The comment of the schema.properties
- The properties of the schema.Schema
.NoSuchCatalogException
- if the catalog with specified namespace does not exist.SchemaAlreadyExistsException
- if the schema with specified identifier already exists.public Schema loadSchema(NameIdentifier ident) throws NoSuchSchemaException
loadSchema
in interface SupportsSchemas
ident
- The name identifier of the schema.Schema
with specified identifier.NoSuchSchemaException
- if the schema with specified identifier does not exist.public Schema alterSchema(NameIdentifier ident, SchemaChange... changes) throws NoSuchSchemaException
alterSchema
in interface SupportsSchemas
ident
- The name identifier of the schema.changes
- The metadata changes to apply.Schema
.NoSuchSchemaException
- if the schema with specified identifier does not exist.public boolean dropSchema(NameIdentifier ident, boolean cascade) throws NonEmptySchemaException
dropSchema
in interface SupportsSchemas
ident
- The name identifier of the schema.cascade
- Whether to drop all the tables under the schema.NonEmptySchemaException
- if the schema is not empty and cascade is false.