Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.catalog.Db Class Reference
Inheritance diagram for com.cloudera.impala.catalog.Db:
Collaboration diagram for com.cloudera.impala.catalog.Db:

Public Member Functions

 Db (String name, Catalog catalog)
 
void setIsSystemDb (boolean b)
 
boolean isSystemDb ()
 
TDatabase toThrift ()
 
String getName ()
 
TCatalogObjectType getCatalogObjectType ()
 
void addTable (Table table)
 
List< String > getAllTableNames ()
 
boolean containsTable (String tableName)
 
Table getTable (String tblName)
 
Table removeTable (String tableName)
 
int numFunctions ()
 
boolean containsFunction (String name)
 
Function getFunction (Function desc, Function.CompareMode mode)
 
Function getFunction (String signatureString)
 
boolean addFunction (Function fn)
 
Function removeFunction (Function desc)
 
Function removeFunction (String signatureStr)
 
void addScalarBuiltin (String fnName, String symbol, boolean varArgs, Type retType, Type...args)
 
void addScalarBuiltin (String fnName, String symbol, String prepareFnSymbol, String closeFnSymbol, boolean varArgs, Type retType, Type...args)
 
void addBuiltin (Function fn)
 
List< FunctiongetFunctions (TFunctionCategory category, PatternMatcher fnPattern)
 
long getCatalogVersion ()
 
void setCatalogVersion (long newVersion)
 
Catalog getParentCatalog ()
 
boolean isLoaded ()
 

Static Public Member Functions

static Db fromTDatabase (TDatabase db, Catalog parentCatalog)
 

Protected Member Functions

HashMap< String, List< Function > > getAllFunctions ()
 

Private Attributes

final Catalog parentCatalog_
 
final TDatabase thriftDb_
 
long catalogVersion_ = Catalog.INITIAL_CATALOG_VERSION
 
final CatalogObjectCache< TabletableCache_
 
final HashMap< String, List
< Function > > 
functions_
 
boolean isSystemDb_ = false
 

Static Private Attributes

static final Logger LOG = Logger.getLogger(Db.class)
 

Detailed Description

Internal representation of db-related metadata. Owned by Catalog instance. Not thread safe.

The static initialisation method loadDb is the only way to construct a Db object.

Tables are stored in a map from the table name to the table object. They may be loaded 'eagerly' at construction or 'lazily' on first reference. Tables are accessed via getTable which may trigger a metadata read in two cases:

  • if the table has never been loaded
  • if the table loading failed on the previous attempt

Definition at line 44 of file Db.java.

Constructor & Destructor Documentation

Member Function Documentation

void com.cloudera.impala.catalog.Db.addBuiltin ( Function  fn)
inline
void com.cloudera.impala.catalog.Db.addScalarBuiltin ( String  fnName,
String  symbol,
boolean  varArgs,
Type  retType,
Type...  args 
)
inline

Add a builtin with the specified name and signatures to this db. This defaults to not using a Prepare/Close function.

Definition at line 228 of file Db.java.

void com.cloudera.impala.catalog.Db.addScalarBuiltin ( String  fnName,
String  symbol,
String  prepareFnSymbol,
String  closeFnSymbol,
boolean  varArgs,
Type  retType,
Type...  args 
)
inline

Add a builtin with the specified name and signatures to this db.

Definition at line 236 of file Db.java.

References com.cloudera.impala.catalog.Db.addBuiltin(), com.cloudera.impala.catalog.ScalarFunction.createBuiltin(), and com.cloudera.impala.catalog.Db.isSystemDb().

void com.cloudera.impala.catalog.Db.addTable ( Table  table)
inline

Adds a table to the table cache.

Definition at line 89 of file Db.java.

boolean com.cloudera.impala.catalog.Db.containsFunction ( String  name)
inline
boolean com.cloudera.impala.catalog.Db.containsTable ( String  tableName)
inline
static Db com.cloudera.impala.catalog.Db.fromTDatabase ( TDatabase  db,
Catalog  parentCatalog 
)
inlinestatic

Creates a Db object with no tables based on the given TDatabase thrift struct.

Definition at line 75 of file Db.java.

References com.cloudera.impala.catalog.Db.Db().

HashMap<String, List<Function> > com.cloudera.impala.catalog.Db.getAllFunctions ( )
inlineprotected

Returns a map of functionNames to list of (overloaded) functions with that name. This is not thread safe so a higher level lock must be taken while iterating over the returned functions.

Definition at line 259 of file Db.java.

References com.cloudera.impala.catalog.Db.functions_.

List<String> com.cloudera.impala.catalog.Db.getAllTableNames ( )
inline

Gets all table names in the table cache.

Definition at line 96 of file Db.java.

Referenced by com.cloudera.impala.catalog.CatalogServiceCatalog.getCatalogObjects(), and com.cloudera.impala.testutil.BlockIdGenerator.main().

TCatalogObjectType com.cloudera.impala.catalog.Db.getCatalogObjectType ( )
inline

Implements com.cloudera.impala.catalog.CatalogObject.

Definition at line 82 of file Db.java.

Function com.cloudera.impala.catalog.Db.getFunction ( Function  desc,
Function.CompareMode  mode 
)
inline
Function com.cloudera.impala.catalog.Db.getFunction ( String  signatureString)
inline

Definition at line 165 of file Db.java.

References com.cloudera.impala.catalog.Db.functions_.

List<Function> com.cloudera.impala.catalog.Db.getFunctions ( TFunctionCategory  category,
PatternMatcher  fnPattern 
)
inline
Catalog com.cloudera.impala.catalog.Db.getParentCatalog ( )
inline

Definition at line 295 of file Db.java.

References com.cloudera.impala.catalog.Db.parentCatalog_.

Table com.cloudera.impala.catalog.Db.getTable ( String  tblName)
inline

Returns the Table with the given name if present in the table cache or null if the table does not exist in the cache.

Definition at line 108 of file Db.java.

boolean com.cloudera.impala.catalog.Db.isLoaded ( )
inline

Implements com.cloudera.impala.catalog.CatalogObject.

Definition at line 298 of file Db.java.

int com.cloudera.impala.catalog.Db.numFunctions ( )
inline

Returns the number of functions in this database.

Definition at line 122 of file Db.java.

References com.cloudera.impala.catalog.Db.functions_.

Referenced by com.cloudera.impala.analysis.DropDbStmt.analyze(), and com.cloudera.impala.service.CatalogOpExecutor.dropDatabase().

Function com.cloudera.impala.catalog.Db.removeFunction ( Function  desc)
inline
Function com.cloudera.impala.catalog.Db.removeFunction ( String  signatureStr)
inline

Removes a Function with the matching signature string. Returns the removed Function if a Function was removed as a result of this call, null otherwise. TODO: Move away from using signature strings and instead use Function IDs.

Definition at line 216 of file Db.java.

References com.cloudera.impala.catalog.Db.functions_, com.cloudera.impala.catalog.Db.getFunction(), and com.cloudera.impala.catalog.Db.removeFunction().

Table com.cloudera.impala.catalog.Db.removeTable ( String  tableName)
inline

Removes the table name and any cached metadata from the Table cache.

Definition at line 115 of file Db.java.

void com.cloudera.impala.catalog.Db.setCatalogVersion ( long  newVersion)
inline
void com.cloudera.impala.catalog.Db.setIsSystemDb ( boolean  b)
inline
TDatabase com.cloudera.impala.catalog.Db.toThrift ( )
inline

Definition at line 80 of file Db.java.

References com.cloudera.impala.catalog.Db.thriftDb_.

Member Data Documentation

long com.cloudera.impala.catalog.Db.catalogVersion_ = Catalog.INITIAL_CATALOG_VERSION
private
boolean com.cloudera.impala.catalog.Db.isSystemDb_ = false
private
final Logger com.cloudera.impala.catalog.Db.LOG = Logger.getLogger(Db.class)
staticprivate

Definition at line 45 of file Db.java.

final Catalog com.cloudera.impala.catalog.Db.parentCatalog_
private
final CatalogObjectCache<Table> com.cloudera.impala.catalog.Db.tableCache_
private

Definition at line 51 of file Db.java.

Referenced by com.cloudera.impala.catalog.Db.Db().

final TDatabase com.cloudera.impala.catalog.Db.thriftDb_
private

The documentation for this class was generated from the following file: