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

Public Member Functions

abstract int getNumNodes ()
 
abstract TTableDescriptor toThriftDescriptor (Set< Long > referencedPartitions)
 
abstract TCatalogObjectType getCatalogObjectType ()
 
abstract void load (Table oldValue, HiveMetaStoreClient client, org.apache.hadoop.hive.metastore.api.Table msTbl) throws TableLoadingException
 
void addColumn (Column col)
 
void clearColumns ()
 
void updateLastDdlTime (long ddlTime)
 
void validate () throws TableLoadingException
 
TTable toThrift ()
 
TCatalogObject toTCatalogObject ()
 
Db getDb ()
 
String getName ()
 
String getFullName ()
 
TableName getTableName ()
 
String getOwner ()
 
ArrayList< ColumngetColumns ()
 
List< String > getColumnNames ()
 
String getStorageHandlerClassName ()
 
ArrayList< ColumngetColumnsInHiveOrder ()
 
List< ColumngetNonClusteringColumns ()
 
Column getColumn (String name)
 
org.apache.hadoop.hive.metastore.api.Table getMetaStoreTable ()
 
int getNumClusteringCols ()
 
TableId getId ()
 
long getNumRows ()
 
ArrayType getType ()
 
long getCatalogVersion ()
 
void setCatalogVersion (long catalogVersion)
 
boolean isLoaded ()
 

Static Public Member Functions

static Table fromMetastoreTable (TableId id, Db db, org.apache.hadoop.hive.metastore.api.Table msTbl)
 
static Table fromThrift (Db parentDb, TTable thriftTable) throws TableLoadingException
 

Protected Member Functions

 Table (TableId id, org.apache.hadoop.hive.metastore.api.Table msTable, Db db, String name, String owner)
 
List< String > getColumnNamesWithHmsStats ()
 
void loadAllColumnStats (HiveMetaStoreClient client)
 
void loadFromThrift (TTable thriftTable) throws TableLoadingException
 
Type parseColumnType (FieldSchema fs) throws TableLoadingException
 

Static Protected Member Functions

static long getRowCount (Map< String, String > parameters)
 

Protected Attributes

final
org.apache.hadoop.hive.metastore.api.Table 
msTable_
 
final TableId id_
 
final Db db_
 
final String name_
 
final String owner_
 
TTableDescriptor tableDesc_
 
List< FieldSchema > fields_
 
TAccessLevel accessLevel_ = TAccessLevel.READ_WRITE
 
int numClusteringCols_
 
long numRows_ = -1
 
final ArrayType type_ = new ArrayType(new StructType())
 
long lastDdlTime_
 

Static Protected Attributes

static EnumSet< TableType > SUPPORTED_TABLE_TYPES
 

Private Attributes

long catalogVersion_ = Catalog.INITIAL_CATALOG_VERSION
 
final ArrayList< ColumncolsByPos_ = Lists.newArrayList()
 
final Map< String, ColumncolsByName_ = Maps.newHashMap()
 

Static Private Attributes

static final Logger LOG = Logger.getLogger(Table.class)
 
static final Object metastoreAccessLock_ = new Object()
 

Detailed Description

Base class for table metadata.

This includes the concept of clustering columns, which are columns by which the table data is physically clustered. In other words, if two rows share the same values for the clustering columns, those two rows are most likely colocated. Note that this is more general than Hive's CLUSTER BY ... INTO BUCKETS clause (which partitions a key range into a fixed number of buckets).

Definition at line 51 of file Table.java.

Constructor & Destructor Documentation

com.cloudera.impala.catalog.Table.Table ( TableId  id,
org.apache.hadoop.hive.metastore.api.Table  msTable,
Db  db,
String  name,
String  owner 
)
inlineprotected

Member Function Documentation

void com.cloudera.impala.catalog.Table.clearColumns ( )
inline
static Table com.cloudera.impala.catalog.Table.fromMetastoreTable ( TableId  id,
Db  db,
org.apache.hadoop.hive.metastore.api.Table  msTbl 
)
inlinestatic

Creates a table of the appropriate type based on the given hive.metastore.api.Table object.

Definition at line 207 of file Table.java.

References com.cloudera.impala.catalog.DataSourceTable.isDataSourceTable(), com.cloudera.impala.catalog.HBaseTable.isHBaseTable(), and com.cloudera.impala.catalog.HdfsFileFormat.isHdfsFormatClass().

static Table com.cloudera.impala.catalog.Table.fromThrift ( Db  parentDb,
TTable  thriftTable 
) throws TableLoadingException
inlinestatic

Factory method that creates a new Table from its Thrift representation. Determines the type of table to create based on the Thrift table provided.

Definition at line 231 of file Table.java.

abstract TCatalogObjectType com.cloudera.impala.catalog.Table.getCatalogObjectType ( )
abstract
Column com.cloudera.impala.catalog.Table.getColumn ( String  name)
inline
List<String> com.cloudera.impala.catalog.Table.getColumnNamesWithHmsStats ( )
inlineprotected
ArrayList<Column> com.cloudera.impala.catalog.Table.getColumnsInHiveOrder ( )
inline

Returns the list of all columns, but with partition columns at the end of the list rather than the beginning. This is equivalent to the order in which Hive enumerates columns.

Definition at line 373 of file Table.java.

References com.cloudera.impala.catalog.Table.colsByPos_, com.cloudera.impala.catalog.Table.getNonClusteringColumns(), and com.cloudera.impala.catalog.Table.numClusteringCols_.

Referenced by com.cloudera.impala.service.DescribeResultFactory.describeTableMinimal(), com.cloudera.impala.service.Frontend.getColumnStats(), and com.cloudera.impala.analysis.InsertStmt.prepareExpressions().

TableId com.cloudera.impala.catalog.Table.getId ( )
inline
List<Column> com.cloudera.impala.catalog.Table.getNonClusteringColumns ( )
inline

Returns the list of all columns excluding any partition columns.

Definition at line 385 of file Table.java.

References com.cloudera.impala.catalog.Table.numClusteringCols_.

Referenced by com.cloudera.impala.analysis.ComputeStatsStmt.analyze(), and com.cloudera.impala.catalog.Table.getColumnsInHiveOrder().

abstract int com.cloudera.impala.catalog.Table.getNumNodes ( )
abstract
long com.cloudera.impala.catalog.Table.getNumRows ( )
inline
String com.cloudera.impala.catalog.Table.getOwner ( )
inline

Definition at line 348 of file Table.java.

References com.cloudera.impala.catalog.Table.owner_.

static long com.cloudera.impala.catalog.Table.getRowCount ( Map< String, String >  parameters)
inlinestaticprotected
String com.cloudera.impala.catalog.Table.getStorageHandlerClassName ( )
inline

Subclasses should override this if they provide a storage handler class. Currently only HBase tables need to provide a storage handler.

Definition at line 366 of file Table.java.

ArrayType com.cloudera.impala.catalog.Table.getType ( )
inline
abstract void com.cloudera.impala.catalog.Table.load ( Table  oldValue,
HiveMetaStoreClient  client,
org.apache.hadoop.hive.metastore.api.Table  msTbl 
) throws TableLoadingException
abstract

Populate members of 'this' from metastore info. Reuse metadata from oldValue if the metadata is still valid.

void com.cloudera.impala.catalog.Table.loadAllColumnStats ( HiveMetaStoreClient  client)
inlineprotected
Type com.cloudera.impala.catalog.Table.parseColumnType ( FieldSchema  fs) throws TableLoadingException
inlineprotected

Gets the ColumnType from the given FieldSchema by using Impala's SqlParser. Throws a TableLoadingException if the FieldSchema could not be parsed. The type can either be:

  • Supported by Impala, in which case the type is returned.
  • A type Impala understands but is not yet implemented (e.g. date), the type is returned but type.IsSupported() returns false.
  • A type Impala can't understand at all, and a TableLoadingException is thrown.

Definition at line 331 of file Table.java.

References com.cloudera.impala.catalog.Table.getName().

Referenced by com.cloudera.impala.catalog.View.load(), com.cloudera.impala.catalog.HBaseTable.load(), com.cloudera.impala.catalog.DataSourceTable.loadColumns(), com.cloudera.impala.catalog.HdfsTable.loadColumns(), and com.cloudera.impala.catalog.HBaseTable.supportsBinaryEncoding().

void com.cloudera.impala.catalog.Table.setCatalogVersion ( long  catalogVersion)
inline
TCatalogObject com.cloudera.impala.catalog.Table.toTCatalogObject ( )
inline
abstract TTableDescriptor com.cloudera.impala.catalog.Table.toThriftDescriptor ( Set< Long >  referencedPartitions)
abstract
void com.cloudera.impala.catalog.Table.updateLastDdlTime ( long  ddlTime)
inline

Updates the lastDdlTime for this Table, if the new value is greater than the existing value. Does nothing if the new value is less than or equal to the existing value.

Definition at line 132 of file Table.java.

References com.cloudera.impala.catalog.Table.lastDdlTime_.

void com.cloudera.impala.catalog.Table.validate ( ) throws TableLoadingException
inline

Checks preconditions for this table to function as expected. Currently only checks that all entries in colsByName_ use lower case keys.

Definition at line 279 of file Table.java.

References com.cloudera.impala.catalog.Table.colsByName_.

Member Data Documentation

long com.cloudera.impala.catalog.Table.catalogVersion_ = Catalog.INITIAL_CATALOG_VERSION
private
final Map<String, Column> com.cloudera.impala.catalog.Table.colsByName_ = Maps.newHashMap()
private
final ArrayList<Column> com.cloudera.impala.catalog.Table.colsByPos_ = Lists.newArrayList()
private
List<FieldSchema> com.cloudera.impala.catalog.Table.fields_
protected
long com.cloudera.impala.catalog.Table.lastDdlTime_
protected
final Logger com.cloudera.impala.catalog.Table.LOG = Logger.getLogger(Table.class)
staticprivate

Definition at line 52 of file Table.java.

final Object com.cloudera.impala.catalog.Table.metastoreAccessLock_ = new Object()
staticprivate

Definition at line 56 of file Table.java.

final org.apache.hadoop.hive.metastore.api.Table com.cloudera.impala.catalog.Table.msTable_
protected
final String com.cloudera.impala.catalog.Table.owner_
protected
EnumSet<TableType> com.cloudera.impala.catalog.Table.SUPPORTED_TABLE_TYPES
staticprotected
Initial value:
= EnumSet.of(
TableType.EXTERNAL_TABLE, TableType.MANAGED_TABLE, TableType.VIRTUAL_VIEW)

Definition at line 88 of file Table.java.

TTableDescriptor com.cloudera.impala.catalog.Table.tableDesc_
protected

Definition at line 64 of file Table.java.


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