Class InMemoryCatalog
- java.lang.Object
-
- org.apache.beam.sdk.extensions.sql.meta.catalog.InMemoryCatalog
-
-
Field Summary
Fields Modifier and Type Field Description protected @Nullable java.lang.StringcurrentDatabaseprotected java.util.Map<java.lang.String,TableProvider>tableProviders
-
Constructor Summary
Constructors Constructor Description InMemoryCatalog(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)InMemoryCatalog(java.lang.String name, MetaStore defaultMetastore, java.util.Map<java.lang.String,java.lang.String> properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancreateDatabase(java.lang.String database)Creates a database with this name.@Nullable java.lang.StringcurrentDatabase()Produces the currently active database.booleandatabaseExists(java.lang.String db)Returns true if the database exists.java.util.Collection<java.lang.String>databases()Returns a collection of existing database names.booleandropDatabase(java.lang.String database, boolean cascade)Drops the database with this name.MetaStoremetaStore(java.lang.String db)Returns the underlyingMetaStorefor this database.java.lang.Stringname()The name of this catalog, specified by the user.java.util.Map<java.lang.String,java.lang.String>properties()User-specified configuration properties.voidregisterTableProvider(TableProvider provider)Registers thisTableProviderand propagates it to underlyingMetaStores.java.util.Map<java.lang.String,TableProvider>tableProviders()Returns all theTableProviders available to thisCatalog, organized by type.java.lang.StringtoString()java.lang.Stringtype()A type that defines this catalog.voiduseDatabase(java.lang.String database)Switches to use the specified database.
-
-
-
Field Detail
-
tableProviders
protected final java.util.Map<java.lang.String,TableProvider> tableProviders
-
currentDatabase
protected @Nullable java.lang.String currentDatabase
-
-
Constructor Detail
-
InMemoryCatalog
public InMemoryCatalog(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)
-
InMemoryCatalog
public InMemoryCatalog(java.lang.String name, MetaStore defaultMetastore, java.util.Map<java.lang.String,java.lang.String> properties)
-
-
Method Detail
-
type
public java.lang.String type()
Description copied from interface:CatalogA type that defines this catalog.
-
name
public java.lang.String name()
Description copied from interface:CatalogThe name of this catalog, specified by the user.
-
metaStore
public MetaStore metaStore(java.lang.String db)
Description copied from interface:Catalog
-
properties
public java.util.Map<java.lang.String,java.lang.String> properties()
Description copied from interface:CatalogUser-specified configuration properties.- Specified by:
propertiesin interfaceCatalog
-
createDatabase
public boolean createDatabase(java.lang.String database)
Description copied from interface:CatalogCreates a database with this name.- Specified by:
createDatabasein interfaceCatalog- Returns:
- true if the database was created, false otherwise.
-
databaseExists
public boolean databaseExists(java.lang.String db)
Description copied from interface:CatalogReturns true if the database exists.- Specified by:
databaseExistsin interfaceCatalog
-
useDatabase
public void useDatabase(java.lang.String database)
Description copied from interface:CatalogSwitches to use the specified database.- Specified by:
useDatabasein interfaceCatalog
-
currentDatabase
public @Nullable java.lang.String currentDatabase()
Description copied from interface:CatalogProduces the currently active database. Can be null if no database is active.- Specified by:
currentDatabasein interfaceCatalog- Returns:
- the current active database
-
databases
public java.util.Collection<java.lang.String> databases()
Description copied from interface:CatalogReturns a collection of existing database names.
-
dropDatabase
public boolean dropDatabase(java.lang.String database, boolean cascade)Description copied from interface:CatalogDrops the database with this name. If cascade is true, the catalog should first drop all tables contained in this database.- Specified by:
dropDatabasein interfaceCatalog- Returns:
- true if the database was dropped, false otherwise.
-
registerTableProvider
public void registerTableProvider(TableProvider provider)
Description copied from interface:CatalogRegisters thisTableProviderand propagates it to underlyingMetaStores.- Specified by:
registerTableProviderin interfaceCatalog
-
tableProviders
public java.util.Map<java.lang.String,TableProvider> tableProviders()
Description copied from interface:CatalogReturns all theTableProviders available to thisCatalog, organized by type.- Specified by:
tableProvidersin interfaceCatalog
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-