Package io.trino.plugin.iceberg.catalog
Interface TrinoCatalog
- All Known Implementing Classes:
AbstractTrinoCatalog,TrinoGlueCatalog,TrinoHiveCatalog,TrinoJdbcCatalog,TrinoRestCatalog
public interface TrinoCatalog
An interface to allow different Iceberg catalog implementations in IcebergMetadata.
It mimics the Iceberg catalog interface, with the following modifications:
- ConnectorSession is added at the front of each method signature
- String is used to identify namespace instead of Iceberg Namespace, Optional.empty() is used to represent Namespace.empty(). This delegates the handling of multi-level namespace to each implementation
- Similarly, SchemaTableName is used to identify table instead of Iceberg TableIdentifier
- Metadata is a map of string to object instead of string to string
- Additional methods related to authorization are added
- View related methods are currently mostly the same as ones in ConnectorMetadata. These methods will likely be updated once Iceberg view interface is added.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateMaterializedView(ConnectorSession session, SchemaTableName viewName, ConnectorMaterializedViewDefinition definition, boolean replace, boolean ignoreExisting) voidcreateNamespace(ConnectorSession session, String namespace, Map<String, Object> properties, TrinoPrincipal owner) voidcreateView(ConnectorSession session, SchemaTableName schemaViewName, ConnectorViewDefinition definition, boolean replace) defaultTableLocation(ConnectorSession session, SchemaTableName schemaTableName) voiddropMaterializedView(ConnectorSession session, SchemaTableName viewName) voiddropNamespace(ConnectorSession session, String namespace) voiddropTable(ConnectorSession session, SchemaTableName schemaTableName) voiddropView(ConnectorSession session, SchemaTableName schemaViewName) getMaterializedView(ConnectorSession session, SchemaTableName viewName) getNamespacePrincipal(ConnectorSession session, String namespace) getView(ConnectorSession session, SchemaTableName viewName) getViews(ConnectorSession session, Optional<String> namespace) listMaterializedViews(ConnectorSession session, Optional<String> namespace) listNamespaces(ConnectorSession session) listTables(ConnectorSession session, Optional<String> namespace) listViews(ConnectorSession session, Optional<String> namespace) loadNamespaceMetadata(ConnectorSession session, String namespace) org.apache.iceberg.TableloadTable(ConnectorSession session, SchemaTableName schemaTableName) load an Iceberg tablebooleannamespaceExists(ConnectorSession session, String namespace) org.apache.iceberg.TransactionnewCreateTableTransaction(ConnectorSession session, SchemaTableName schemaTableName, org.apache.iceberg.Schema schema, org.apache.iceberg.PartitionSpec partitionSpec, org.apache.iceberg.SortOrder sortOrder, String location, Map<String, String> properties) redirectTable(ConnectorSession session, SchemaTableName tableName) voidregisterTable(ConnectorSession session, SchemaTableName tableName, String tableLocation, String metadataLocation) voidrenameMaterializedView(ConnectorSession session, SchemaTableName source, SchemaTableName target) voidrenameNamespace(ConnectorSession session, String source, String target) voidrenameTable(ConnectorSession session, SchemaTableName from, SchemaTableName to) voidrenameView(ConnectorSession session, SchemaTableName source, SchemaTableName target) voidsetNamespacePrincipal(ConnectorSession session, String namespace, TrinoPrincipal principal) voidsetTablePrincipal(ConnectorSession session, SchemaTableName schemaTableName, TrinoPrincipal principal) voidsetViewPrincipal(ConnectorSession session, SchemaTableName schemaViewName, TrinoPrincipal principal) voidunregisterTable(ConnectorSession session, SchemaTableName tableName) voidupdateColumnComment(ConnectorSession session, SchemaTableName schemaTableName, ColumnIdentity columnIdentity, Optional<String> comment) voidupdateTableComment(ConnectorSession session, SchemaTableName schemaTableName, Optional<String> comment) voidupdateViewColumnComment(ConnectorSession session, SchemaTableName schemaViewName, String columnName, Optional<String> comment) voidupdateViewComment(ConnectorSession session, SchemaTableName schemaViewName, Optional<String> comment)
-
Method Details
-
namespaceExists
-
listNamespaces
-
dropNamespace
-
loadNamespaceMetadata
-
getNamespacePrincipal
-
createNamespace
void createNamespace(ConnectorSession session, String namespace, Map<String, Object> properties, TrinoPrincipal owner) -
setNamespacePrincipal
-
renameNamespace
-
listTables
-
newCreateTableTransaction
org.apache.iceberg.Transaction newCreateTableTransaction(ConnectorSession session, SchemaTableName schemaTableName, org.apache.iceberg.Schema schema, org.apache.iceberg.PartitionSpec partitionSpec, org.apache.iceberg.SortOrder sortOrder, String location, Map<String, String> properties) -
registerTable
void registerTable(ConnectorSession session, SchemaTableName tableName, String tableLocation, String metadataLocation) -
unregisterTable
-
dropTable
-
renameTable
-
loadTable
load an Iceberg table- Parameters:
session- Trino sessionschemaTableName- Trino schema and table name- Returns:
- Iceberg table loaded
- Throws:
UnknownTableTypeException- if table is not of Iceberg type in the metastore
-
updateTableComment
void updateTableComment(ConnectorSession session, SchemaTableName schemaTableName, Optional<String> comment) -
updateViewComment
void updateViewComment(ConnectorSession session, SchemaTableName schemaViewName, Optional<String> comment) -
updateViewColumnComment
void updateViewColumnComment(ConnectorSession session, SchemaTableName schemaViewName, String columnName, Optional<String> comment) -
defaultTableLocation
-
setTablePrincipal
void setTablePrincipal(ConnectorSession session, SchemaTableName schemaTableName, TrinoPrincipal principal) -
createView
void createView(ConnectorSession session, SchemaTableName schemaViewName, ConnectorViewDefinition definition, boolean replace) -
renameView
-
setViewPrincipal
void setViewPrincipal(ConnectorSession session, SchemaTableName schemaViewName, TrinoPrincipal principal) -
dropView
-
listViews
-
getViews
Map<SchemaTableName,ConnectorViewDefinition> getViews(ConnectorSession session, Optional<String> namespace) -
getView
-
listMaterializedViews
-
createMaterializedView
void createMaterializedView(ConnectorSession session, SchemaTableName viewName, ConnectorMaterializedViewDefinition definition, boolean replace, boolean ignoreExisting) -
dropMaterializedView
-
getMaterializedView
Optional<ConnectorMaterializedViewDefinition> getMaterializedView(ConnectorSession session, SchemaTableName viewName) -
renameMaterializedView
void renameMaterializedView(ConnectorSession session, SchemaTableName source, SchemaTableName target) -
updateColumnComment
void updateColumnComment(ConnectorSession session, SchemaTableName schemaTableName, ColumnIdentity columnIdentity, Optional<String> comment) -
redirectTable
-