org.apache.hadoop.hive.metastore
Class FileStore

java.lang.Object
  extended by org.apache.hadoop.hive.metastore.FileStore
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, RawStore

public class FileStore
extends Object
implements RawStore


Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
FileStore(org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
 boolean addPartition(Partition part)
           
 void alterTable(String dbname, String name, Table newTable)
           
 boolean commitTransaction()
          if this is the commit of the first open call then an actual commit is called.
 boolean createDatabase(Database db)
           
 boolean createDatabase(String name)
           
 void createTable(Table tbl)
           
 boolean createType(Type type)
           
 boolean dbExists(String dbName)
          dbExists
 void drop(DB db, String tableName)
           
 boolean dropDatabase(String dbname)
           
 boolean dropPartition(String dbName, String tableName, List<String> part_vals)
           
 boolean dropTable(String dbName, String tableName)
           
 boolean dropType(String typeName)
           
 org.apache.hadoop.conf.Configuration getConf()
           
 Database getDatabase(String name)
           
 List<String> getDatabases()
          getDatabases
 Partition getPartition(String dbName, String tableName, List<String> part_vals)
           
 List<Partition> getPartitions(String dbName, String tableName, int max)
           
 Table getTable(String dbName, String tableName)
           
 List<String> getTables(String dbName, String pattern)
           
 ArrayList<String> getTablesByPattern(DB parent, String tablePattern)
          getTablesByPattern Looks at metastore directories
 Type getType(String typeName)
           
 List<String> listPartitionNames(String db_name, String tbl_name, short max_parts)
           
protected  Properties load(DB parent, String tableName)
           
 boolean openTransaction()
          Opens a new one or the one already created Every call of this function must have corresponding commit or rollback function call
protected  void rename(DB parent, String tableName, DB newParent, String newTableName)
           
 void rollbackTransaction()
          Rolls back the current transaction if it is active
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 void shutdown()
           
protected  void store(DB parent, String tableName, Properties schema, boolean overwrite)
           
 boolean tableExists(String dbName, String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

FileStore

public FileStore(org.apache.hadoop.conf.Configuration conf)
Method Detail

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

createDatabase

public boolean createDatabase(Database db)
                       throws MetaException
Specified by:
createDatabase in interface RawStore
Throws:
MetaException

createDatabase

public boolean createDatabase(String name)
                       throws MetaException
Specified by:
createDatabase in interface RawStore
Throws:
MetaException

load

protected Properties load(DB parent,
                          String tableName)
                   throws MetaException,
                          UnknownTableException
Throws:
MetaException
UnknownTableException

store

protected void store(DB parent,
                     String tableName,
                     Properties schema,
                     boolean overwrite)
              throws MetaException
Throws:
MetaException

rename

protected void rename(DB parent,
                      String tableName,
                      DB newParent,
                      String newTableName)
               throws MetaException
Throws:
MetaException

drop

public void drop(DB db,
                 String tableName)
          throws IOException
Throws:
IOException

getTablesByPattern

public ArrayList<String> getTablesByPattern(DB parent,
                                            String tablePattern)
                                     throws MetaException
getTablesByPattern Looks at metastore directories

Parameters:
parent -
tablePattern -
Returns:
the list of tables
Throws:
MetaException

getTables

public List<String> getTables(String dbName,
                              String pattern)
                       throws MetaException
Specified by:
getTables in interface RawStore
Throws:
MetaException

dbExists

public boolean dbExists(String dbName)
                 throws MetaException
dbExists

Returns:
boolean whether the db exists
Throws:
MetaException - (for future use possibly) NOTE - there is no strict version of this now. Strict meaning no extraneous .table.field1.field11...

dropDatabase

public boolean dropDatabase(String dbname)
Specified by:
dropDatabase in interface RawStore

getDatabase

public Database getDatabase(String name)
                     throws NoSuchObjectException
Specified by:
getDatabase in interface RawStore
Throws:
NoSuchObjectException

getDatabases

public List<String> getDatabases()
                          throws MetaException
getDatabases

Specified by:
getDatabases in interface RawStore
Returns:
the list of dbs. is never null.
Throws:
MetaException - Assuming 1 level here - bugbug

tableExists

public boolean tableExists(String dbName,
                           String tableName)

alterTable

public void alterTable(String dbname,
                       String name,
                       Table newTable)
                throws InvalidObjectException,
                       MetaException
Specified by:
alterTable in interface RawStore
Throws:
InvalidObjectException
MetaException

createTable

public void createTable(Table tbl)
                 throws InvalidObjectException,
                        MetaException
Specified by:
createTable in interface RawStore
Throws:
InvalidObjectException
MetaException

dropTable

public boolean dropTable(String dbName,
                         String tableName)
                  throws MetaException
Specified by:
dropTable in interface RawStore
Throws:
MetaException

getTable

public Table getTable(String dbName,
                      String tableName)
               throws MetaException
Specified by:
getTable in interface RawStore
Throws:
MetaException

createType

public boolean createType(Type type)
Specified by:
createType in interface RawStore

dropType

public boolean dropType(String typeName)
Specified by:
dropType in interface RawStore

addPartition

public boolean addPartition(Partition part)
                     throws InvalidObjectException,
                            MetaException
Specified by:
addPartition in interface RawStore
Throws:
InvalidObjectException
MetaException

dropPartition

public boolean dropPartition(String dbName,
                             String tableName,
                             List<String> part_vals)
                      throws MetaException
Specified by:
dropPartition in interface RawStore
Throws:
MetaException

getPartition

public Partition getPartition(String dbName,
                              String tableName,
                              List<String> part_vals)
                       throws MetaException
Specified by:
getPartition in interface RawStore
Throws:
MetaException

getPartitions

public List<Partition> getPartitions(String dbName,
                                     String tableName,
                                     int max)
                              throws MetaException
Specified by:
getPartitions in interface RawStore
Throws:
MetaException

getType

public Type getType(String typeName)
Specified by:
getType in interface RawStore

openTransaction

public boolean openTransaction()
Description copied from interface: RawStore
Opens a new one or the one already created Every call of this function must have corresponding commit or rollback function call

Specified by:
openTransaction in interface RawStore
Returns:
an active transaction

rollbackTransaction

public void rollbackTransaction()
Description copied from interface: RawStore
Rolls back the current transaction if it is active

Specified by:
rollbackTransaction in interface RawStore

commitTransaction

public boolean commitTransaction()
Description copied from interface: RawStore
if this is the commit of the first open call then an actual commit is called.

Specified by:
commitTransaction in interface RawStore
Returns:
true or false

shutdown

public void shutdown()
Specified by:
shutdown in interface RawStore

listPartitionNames

public List<String> listPartitionNames(String db_name,
                                       String tbl_name,
                                       short max_parts)
                                throws MetaException
Specified by:
listPartitionNames in interface RawStore
Throws:
MetaException


Copyright © 2009 The Apache Software Foundation