Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Overview

There are presently three ways to issue HCatalog DDL commands:

  1. Command line interface
  2. REST APIs (upcoming)
  3. HiveMetaStore Client

Presently, java developers go through the Hive meta store (HMS) client interface to issue HCatalog DDl commands. Though the HMS client interface is public, it is not intended for public users. According to the hive user mailing list, the HMS client is not a public API and is subject to change in the future. So, it will be a good idea to have a java APIs in HCatalog which will provide a protect users from the changes made to the hive meta store client. Also, the under the covers either the Rest APIS or the hive metastore client can be used to provide end users with the required data.

Design

Image Added

– This document is a work in progress.

Overview

Templeton provides a REST-like web API for HCatalog and related Hadoop components. Developers can make HTTP requests to the Templeton web server to execute HCatalog DDL commands. With the REST APIs in place for HCatalog DDL commands, it is desirable to have a JAVA APIs in HCAT which can help end users to execute DDL commands without using CLI.

Design

Image Removed

New Classes

HCatClient

The HCatClient is an interface abstract class containing all the APIs permitted HCatalog DDL commands. The implementation class will be provided as a configuration property, which will be used by the
"create" method. In this way, the implementation details will be masked to the users.

Code Block
/**
 * The Interface HCatClient containing APIs for HCatalog DDL commands.
 */
public interfacepublic abstract class HCatClient {

     /**
     * Creates an instance of HCatClient.
     *
     * @param conf An instance of configuration.
     * @return An instance of HCatClient.
     * @throws IOException
     */
    public static HCatClient create(Configuration conf) throws IOException{
      HCatClient client  return null= HCatUtil.getHCatClient(conf);
    }

    /**
     * Gets the database like.
     *
     * @param regex The regular expression. Providing "*" would retrieve all the names
     *              of the databases.
     * @return The list of all the database names.
     * @throws HCatException
     */
    public List<String> getDatabaseLike(String regex) if(client != null){
            client.initialize(conf);
        }
        return client;
    }

    abstract void initialize(Configuration conf) throws HCatException;

       /**
     * Gets the database.
     *
     *Get @paramall dbNameexisting Thedatabases namethat ofmatch the database.
     * @return An instance of HCatDatabaseInfo.
     * @throws HCatException
     */
    public HCatDatabaseInfo getDatabase(String dbName) throws HCatException;

    /**
     * Creates the database.
     *
     * @param dbInfo An instance of HCatCreateDBDesc.
     * @return true, if successful
    given
     * pattern. The matching occurs as per Java regular expressions
     *
     * @param databasePattern
     *          java re pattern
     * @return list of database names
     * @throws HCatException
         */
       public abstract booleanList<String> createDatabaselistDatabaseNamesByPattern(HCatCreateDBDescString dbInfopattern)
            throws HCatException;

       /**
         * DeletesGets athe database.
         *
         * @param dbName The name of the database to delete.
     * @param ifExists Hive returns* an@return errorAn ifinstance theof databaseHCatDatabaseInfo.
 specified does not exist,
     *                 unless@throws ifExistsHCatException
 is set to true.
     */
 @param mode This ispublic setabstract toHCatDatabase either "restrict" or "cascade". Restrict will
     *             remove the schema if all the tables are empty. Cascade removes
     *             everything including data and definitions.
    getDatabase(String dbName) throws HCatException;

    /**
     * Creates the database.
     *
     * @param userGroupdbInfo TheAn userinstance group to use
     * @param permissions The permissions string to use. The format is "rwxrw-r-x".
     * @return true, if successful
     * @throws HCatException
     */
    public boolean deleteDatabase(String dbName, boolean ifExists, String mode,
            String userGroup, String permissions) of HCatCreateDBDesc.
     * @throws HCatException
     */
    public abstract void createDatabase(HCatCreateDBDesc dbInfo)
            throws HCatException;

       /**
      * Gets the tables* likeDrops a pattern specified.
    database.
     *
         * @param dbName The name of the database to delete.
         * @param regexifExists Hive Thereturns regularan expression.error Providingif "*"the woulddatabase retrievespecified alldoes thenot namesexist,
     *              of  the table.
     * @return  A list of all table names matching the specified pattern.
     * @throws HCatException
     */
    publicunless List<String>ifExists getTablesLike(String dbName, String regex)
            throws HCatException;

    /**
     * Gets the table.
     *
     * @param dbName The name of the database.
     * @param tableName The name of the table.
     * @return An instance of HCatTableInfo.
     * @throws HCatException
     */
    public HCatTableInfo getTable(String dbName, String tableName)
            throws HCatException;

    /**
     * Creates the table.
     *
     * @param createTableDesc An instance of HCatCreateTableDesc class.
     * @return true, if successful.
    is set to true.
     * @param mode This is set to either "restrict" or "cascade". Restrict will
     *             remove the schema if all the tables are empty. Cascade removes
     *             everything including data and definitions.
     * @throws HCatException
 the h cat exception
     */
       public abstract void dropDatabase(String dbName, boolean createTable(HCatCreateTableDesc createTableDesc)
           ifExists, String mode) throws HCatException;

       /**
      * Creates the table* likeReturns anall existing table.
     *
     * @param dbName The name of the database.
     * @param existingTblName The name of the existing table.
     * @param newTableName The name of the new table.
     * @param ifExists the if exists
     * @param isExternal Set to "true", if table has be created at a different
     *                   location other than default.
     * @param location The location for the table.
     * @return true, if successful
     * @throws HCatException
     */
    public boolean createTableLiketables from the specified database which match the given
     * pattern. The matching occurs as per Java regular expressions.
     * @param dbName
     * @param tablePattern
     * @return list of table names
     * @throws HCatException
     */
    public abstract List<String> listTableNamesByPattern(String dbName, String existingTblName,
            String newTableName, boolean ifExists, boolean isExternal,
            String location)tablePattern)
            throws HCatException;

     /  /**
         * DeleteGets athe table.
         *
         * @param dbName The name of the database.
         * @param tableName The name of the table.
     * @param ifExists Hive returns* an@return errorAn ifinstance theof databaseHCatTableInfo.
 specified does not exist,
     *                 unless@throws ifExistsHCatException
 is set to true.
     */
 @param userGroup The userpublic groupabstract to use.
     * @param permissions The permissions string to use. The format is "rwxrw-r-x".
     * @return true, if successful
     * @throws HCatException
     */
    public boolean deleteTable(String dbName, String tableName,
            boolean ifExists, String userGroup, String permissions)
            throws HCatException;

    /**
     * Renames a table.
     *
     * @param dbName The name of the database.
     * @param oldName The name of the table to be renamed.
     * @param newName The new name of the table.
     * @param userGroup The user group to use.
     * @param permissions The permissions string to use. The format is "rwxrw-r-x".
     * @return true, if successful
     * @throws HCatException
     */
    public boolean renameTable(String dbName, String oldName, String newName,
            String userGroup, String permissions) throws HCatException;

    /**
     * Gets all the partitions.
     *
     * @param dbNameHCatTable getTable(String dbName, String tableName)
            throws HCatException;

    /**
     * Creates the table.
     *
     * @param createTableDesc An instance of HCatCreateTableDesc class.
     * @throws HCatException the h cat exception
     */
    public abstract void createTable(HCatCreateTableDesc createTableDesc)
            throws HCatException;

    /**
     * Creates the table like an existing table.
     *
     * @param dbName The name of the database.
     * @param existingTblName The name of the databaseexisting table.
         * @param tblNamenewTableName The name of the new table.
     * @return A list of* partition names.
     * @throws HCatException the h cat exception
     */
    public List<HCatPartitionInfo> getPartitions(String dbName, String tblName)
            throws HCatException;

    /**
     * Gets the partition.
     *
     * @param dbName The database name.
     * @param tableName The table name.
     * @param partitionName The partition name, Comma separated list of col_name='value'.
     * @return An instance of HCatPartitionInfo.
    @param ifNotExists If true, then error related to already table existing is skipped.
     * @param isExternal Set to "true", if table has be created at a different
     *                   location other than default.
     * @param location The location for the table.
     * @throws HCatException
         */
       public abstract HCatPartitionInfovoid getPartitioncreateTableLike(String dbName, String tableNameexistingTblName,
            String partitionName) throws HCatException;

    /**
     * Adds the partition.
     *
     * @paramString partInfonewTableName, Anboolean instanceifNotExists, ofboolean HCatAddPartitionDesc.isExternal,
     * @return true, if successful
     * @throws HCatException the h cat exception
     */
    public boolean addPartition(HCatAddPartitionDesc partInfoString location) throws HCatException;

       /**
         * DeletesDrop partitiontable.
         *
         * @param dbName The database name.
    name of the database.
     * @param tableName The name of the table name.
         * @param partitionNameifExists TheHive partitionreturns name,an Commaerror separatedif listthe of col_name='value'.
     * @param ifExists Hive returns an error if the partition specified does not exist,database specified does not exist,
     *                 unless ifExists is set to true.
     * @param userGroup The user* group@throws to use.
     * @param permissions The permissions string to use. The format is "rwxrw-r-x".
     * @return true, if successful
     * @throws HCatException
     */
    public boolean deletePartition(String dbName, String tableName,
            String partitionName, boolean ifExists, String userGroup,
            String permissionsHCatException
     */
    public abstract void dropTable(String dbName, String tableName,
            boolean ifExists) throws HCatException;

       /**
         * ListRenames partitionsa by filtertable.
         *
         * @param dbName The name of the database name.
         * @param tblNameoldName The name of the table to namebe renamed.
         * @param filternewName The filter string,
     *    for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can
     *    be done only on string partition keys.
     * @return list of partitions
     * @throws HCatException the h cat exception
     */
    public List<HCatPartitionInfo> listPartitionsByFilter(String dbName, String tblName,
            String filter) throws HCatException;

    /**
     * Mark partition for event.
     *
     * @param dbName The database name.
     * @param tblName The table name.
     * @param partKVs the part k vs
     * @param eventType the event type
     * @throws HCatException the h cat exception
     */
    public void markPartitionForEventnew name of the table.
     * @throws HCatException
     */
    public abstract void renameTable(String dbName, String oldName, String newName) throws HCatException;

    /**
     * Gets all the partitions.
     *
     * @param dbName The name of the database.
     * @param tblName The name of the table.
     * @return A list of partition names.
     * @throws HCatException the h cat exception
     */
    public abstract List<HCatPartition> getPartitions(String dbName, String tblName,
            Map<String, String> partKVs, PartitionEventType eventType)
           )
            throws HCatException;

       /**
     * Checks if is partition* markedGets forthe eventpartition.
         *
         * @param dbName theThe dbdatabase name.
         * @param tblNametableName theThe tbltable name.
         * @param partitionName The partKVspartition thename, partComma kseparated vs
    list * @param eventType the event type
    of col_name='value'.
     * @return true, if is partition marked for event
    An instance of HCatPartitionInfo.
     * @throws HCatException
 the h cat exception
     */
       public booleanabstract HCatPartition isPartitionMarkedForEventgetPartition(String dbName, String tblNametableName,
            Map<String, String> partKVs, PartitionEventType eventType)
                       String partitionName) throws HCatException;

}
HCatTempletonClient

This class implements HCatClient interface.

HCatCommandDesc

This is an abstract class that helps in validating user input, building valid command descriptors and queries.

Code Block

/**
 * The Class HCatCommandDesc contains methods which help in validating,
 * building command descriptors and queries.
 */
public abstract class HCatCommandDesc{

       /**
     * Adds the partition.
     *
     * @param partInfo An instance of HCatAddPartitionDesc.
     * @throws HCatException the h cat exception
     */
    public abstract void validateCommandDescaddPartition(HCatAddPartitionDesc partInfo) throws HCatException;
    abstract String buildQuery() throws HCatException;
    abstract boolean isValidationComplete();

}
HCatCreateTableDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptor and validate it for the "create table" command.

Code Block

public class HCatCreateDBDesc extends HCatCommandDesc {

    /**
     * Drops partition.
     *
    private String* databaseName;
@param dbName The  private String locationUri;database name.
    private String* comment;
@param tableName The table privatename.
 Map<String, String> dbProperties;

  * @param /**
partitionName The partition name, Comma *separated Getslist the database propertiesof col_name='value'.
     *
 @param ifExists Hive returns *an error @returnif the database propertiespartition specified does not exist, unless ifExists is set to true.
     * @throws HCatException
     */
    Map<String, String> getDatabaseProperties() {
public abstract void dropPartition(String dbName, String tableName,
            return this.dbProperties;
    }String partitionName, boolean ifExists) throws HCatException;

    /**
     * SetsList thepartitions databaseby propertiesfilter.
     *
     * @param dbPropsdbName theThe dbdatabase propsname.
     */
 @param tblName The public void setDatabaseProperties(Map<String, String> dbProps) {table name.
     * @param filter this.dbPropertiesThe =filter dbProps;string,
    }

    /**
    for *example Gets"part1 the name.
     *= \"p1_abc\" and part2 <= "\p2_test\"". Filtering can
     * @return   thebe name
done only on string partition */keys.
    String getName() {
   * @return list of partitions
     return this.databaseName;
    }

* @throws HCatException the h cat exception
     */**
     * Sets the name.public abstract List<HCatPartition> listPartitionsByFilter(String dbName, String tblName,
     *
     * @param databaseNameString thefilter) newthrows nameHCatException;

     /**/
    public * voidMark setName(String databaseName) {partition for event.
     *
    this.databaseName =* databaseName;
@param dbName The database }name.

     /*** @param tblName The table name.
     * @param GetspartKVs the comment.
part k    *vs
     * @return@param eventType the event commenttype
     */
 @throws HCatException the Stringh getComment()cat {exception
     */
    return this.comment;
    }

public abstract void markPartitionForEvent(String dbName, String tblName,
      /**
     * SetsMap<String, the comment.
  String> partKVs, PartitionEventType eventType)
   *
     * @param comment the newthrows commentHCatException;

     /*/*
    public * voidChecks setComment(String comment) {
   if is partition marked for event.
     this.comment*
 = comment;
   * }

@param dbName the db /**name
     * @param GetstblName the tbl location.name
     *
 @param partKVs the part * @return the locationk vs
     */
 @param eventType the String getLocation() {event type
     * @return true, return this.locationUri;
    }

if is partition marked for event
     /**
 @throws HCatException the h * Sets the location.cat exception
     */
    public *abstract @paramboolean location the new location
isPartitionMarkedForEvent(String dbName, String tblName,
        */
    public void setLocation(String location) {Map<String, String> partKVs, PartitionEventType eventType)
        this.locationUri = location;
  throws  }HCatException;

    /**
 @return
    /* Gets the @throwsdelegation HCatExceptiontoken.
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildCommandDesc()
     */
 @param owner the @Overrideowner
    public void validateCommandDesc()
      * @param renewerKerberosPrincipalName the renewer kerberos principal name
     * throws@return the HCatExceptiondelegation {token

    }

 * @throws HCatException /*the @paramh desccat exception
     */*
 @return
   public /*abstract @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildQuery(java.lang.Class)
String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws
        */HCatException;

    @Override/**
    String buildQuery()* throwsRenew HCatExceptiondelegation {token.
     *
   // TODO Auto-generated* method@param stub
tokenStrForm the token str form
    return null;
* @return the long
 }

    /* @return
@throws HCatException the h  * @see org.apache.hcatalog.api.HCatCommandDesc#isValidationComplete()cat exception
     */
    @Override
public abstract long renewDelegationToken(String boolean isValidationComplete() {tokenStrForm) throws HCatException;

    /**
    // TODO* Auto-generatedCancel methoddelegation stubtoken.
     *
   return false;
 * @param  }

}
HCatCreateDBDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptors and validate it for the "create database" command.

Code Block

public class HCatCreateTableDesc extends HCatCommandDesc{

tokenStrForm the token str form
    private String* tableName;
@throws HCatException the h private boolean isExternal;cat exception
    private ArrayList<HCatFieldSchema> cols; */
    privatepublic ArrayList<HCatFieldSchema>abstract partCols;
    private ArrayList<String> bucketCols;
    private ArrayList<Order> sortCols;
    private int numBuckets;void cancelDelegationToken(String tokenStrForm) throws HCatException;

    /**
     * Close the hcatalog client.
    private String dbName;*
    private String* comment;
@throws HCatException the h private String fileFormat;cat exception
    private String location; */
    privatepublic Stringabstract storageHandler;
    private Map<String, String> tblProps;
    private boolean ifNotExists;

    ArrayList<HCatFieldSchema> getColsStringvoid close() {
      return this.getCols();
    }

    boolean getIfNotExists() {
        return this.ifNotExists;
    }

    /**
     * Sets the if not exists.
     * If true, the user will not receive an error if the table already exists.
     * @param ifNotExists the new if not exists
     */
    public void setIfNotExists(boolean ifNotExists) {
      this.ifNotExists = ifNotExists;
    }

   String getTableName() {
        return this.tableName;
    }

    String getDatabaseName(){
        return this.dbName;
    }

    /**
     * Sets the database name.
     *
     * @param dbName the new database name
     */
    public void setDatabaseName(String dbName){
        this.dbName = dbName;
    }

    /**
     * Sets the table name.
     *
     * @param tableName the new table name
     */
    public void setTableName(String tableName) {
      this.tableName = tableName;
    }

    ArrayList<HCatFieldSchema> getCols() {
       // ArrayList<FieldSchema> cols = this.tableDesc.getCols();
        return null;
    }

    /**
     * Sets the table columns.
     *
     * @param cols List of columns.
     */
    public void setCols(ArrayList<HCatFieldSchema> cols) {
        //convert and set.
      this.cols = null;
    }

    ArrayList<HCatFieldSchema> getPartCols() {
        return null;
    }

    /**
     * Sets the part cols.
     *
     * @param partCols List of partition columns.
     */
    public void setPartCols(ArrayList<HCatFieldSchema> partCols) {
      //this.partCols = partCols;
    }

    ArrayList<String> getBucketCols() {
        return this.bucketCols;
    }

    /**
     * Sets the bucket cols.
     *
     * @param bucketCols The list of columns to be used for clustering.
     */
    public void setBucketCols(ArrayList<String> bucketCols) {
      this.bucketCols = bucketCols;
    }

    int getNumBuckets() {
        return this.numBuckets;
    }

    /**
     * Sets the num buckets.
     *
     * @param numBuckets The number of buckets.
     */
    public void setNumBuckets(int numBuckets) {
      this.numBuckets = numBuckets;
    }

    String getComment() {
        return this.comment;
    }

    /**
     * Sets the comment.
     *
     * @param comment The comment for the table.
     */
    public void setComment(String comment) {
      this.comment = comment;
    }


    String getStorageHandler() {
        return this.storageHandler;
    }

    /**
     * Sets the storage handler.
     *
     * @param storageHandler the new storage handler
     */
    public void setStorageHandler(String storageHandler) {
      this.storageHandler = storageHandler;
    }

    String getLocation() {
        return this.location;
    }

    /**
     * Sets the location.
     *
     * @param location the new location
     */
    public void setLocation(String location) {
      this.location = location;
    }

    boolean getExternal() {
        return this.isExternal;
    }

    /**
     * Sets the external.
     *
     * @param isExternal True/False, indicating if the table is an external table.
     */
    public void setExternal(boolean isExternal) {
      this.isExternal = isExternal;
    }

    ArrayList<Order> getSortCols() {
        return this.sortCols;
    }

    /**
     * Sets the sort cols.
     *
     * @param sortCols the sortCols to set
     */
    public void setSortCols(ArrayList<Order> sortCols) {
      this.sortCols = sortCols;
    }

    /**
     * @return the table properties
     */
    Map<String, String> getTblProps() {
        return this.tblProps;
    }

    /**
     * @param tblProps
     *          the table properties to set
     */
    public void setTblProps(Map<String, String> tblProps) {
      this.tblProps = tblProps;
    }

    /**
     * Sets the file format.
     *
     * @param format the new file format
     */
    public void setFileFormat(String format){
        this.fileFormat = format;
    }

    String getFileFormat(){
        return this.fileFormat;
    }

    /* @return
    /* @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildCommandDesc()
     */
    @Override
    public void validateCommandDesc() throws HCatException {
        // TODO Auto-generated method stub
    }


    /* @param desc
    /* @return
    /* @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildQuery(org.apache.hcatalog.api.HCatCommandDescBuilder)
     */
    @Override
    String buildQuery() throws HCatException {
        // TODO Auto-generated method stub
        return null;
    }


    /* @return
     * @see org.apache.hcatalog.api.HCatCommandDesc#isValidationComplete()
     */
    @Override
    boolean isValidationComplete() {
        // TODO Auto-generated method stub
        return false;
    }

HCatAddPartitionDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptos and validate it for the "add partition" command.

Code Block

public class HCatAddPartitionDesc extends HCatCommandDesc {

    //private AddPartitionDesc addPartDesc;
    private String dbName;
    private String tableName;
    private String location;
    private LinkedHashMap<String,String> partSpec;

    /**
     * @return database name
     */
     String getDbName() {
         return this.dbName;
    }

    /**
     * Sets the db name.
     *
     * @param dbName database name
     */
    public void setDbName(String dbName) {
      this.dbName = dbName;
    }

    /**
     * @return the table we're going to add the partitions to.
     */
     String getTableName() {
      return this.tableName;
    }

    /**
     * Sets the table name.
     *
     * @param tableName the table we're going to add the partitions to.
     */
    public void setTableName(String tableName) {
      this.tableName = tableName;
    }

    String getLocation() {
      return this.location;
    }

    /**
     * Sets the location.
     *
     * @param location The location of partition in relation to table
     */
    public void setLocation(String location) {
      this.location = location;
    }

    /**
     * @return partition specification.
     */
     LinkedHashMap<String, String> getPartSpec() {
         return this.partSpec;
    }

    /**
     * Adds the partition name and value.
     *
     * @param colName The column name.
     * @param value The value.
     */
    public void addPartSpec(String colName, String value) {
      this.partSpec.put(colName, value);
    }

    @Override
    public void validateCommandDesc()
            throws HCatException {

    }

    /* @return
    /* @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDesc#buildQuery()
     */
    @Override
    String buildQuery() throws HCatException {
        // TODO Auto-generated method stub
        return null;
    }

    /* @return
     * @see org.apache.hcatalog.api.HCatCommandDesc#isValidationComplete()
     */
    @Override
    boolean isValidationComplete() {
        // TODO Auto-generated method stub
        return false;
    }

}

Modification to Existing Classes:

In the current code base, HCatTableInfo class acts a wrapper for the Table class, providing only required information to the users. Similar classes
need to be added for database and partition. Also, there needs to appropriate builder methods to construct HCatTableInfo, HCatPartitionInfo and
HCatDatabaseInfo classes.

The current relationship between HCatTableInfo, StorerInfo and PartInfo is as follows: 

Image Removed

The "PartInfo" class can be modified to act as a wrapper to partition ( similar to HCatTableInfo). The following modifications need to be done:

  1. Remove job properties.
  2. All the properties required by the partition info are available with the Partition. HCatPartitionInfo( present PartInfo) should make use of it.
  3. There is no need to store HCatTableInfo as a member. It is only used to obtain data column and value mapping. There can be a method that can take a HCatTableInfo as input.

Image Removed

Usage

Code Block

 Configuration config = new Configuration();
 config.add("hive-site.xml");
 HCatClient client = HCatClient.create(config);

 HCatCreateTableDesc desc = new HCatCreateTableDesc();
 desc.setTableName("demo_table");
 desc.setDatabaseName("db1");
 desc.setFileFormat("rcfile");
 ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
 cols.add(new HCatFieldSchema("col1", Type.INT, "comment1"));
 cols.add(new HCatFieldSchema("col2", Type.STRING, "comment2"));
 desc.setCols(cols);

 //Validate
 desc.validateCommandDesc();
 boolean success = client.createTable(desc);

Discussion Topics

...

throws HCatException;
HCatCreateTableDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptor and validate it for the "create table" command.
Image Added

HCatCreateDBDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptors and validate it for the "create database" command.

!createdb.png|

HCatAddPartitionDesc

This class is a sub class of HCatCommandDesc and will be used by the users to create descriptors and validate it for the "add partition" command.

 Image Added

HCatTable

This class encapsulates the table information returned the HCatClient implementation class and provides a uniform view to the user.

Image Added

HCatDatabase

This class encapsulates the database information returned the HCatClient implementation class and provides a uniform view to the user.

Image Added

HCatPartition

This class encapsulates the partition information returned the HCatClient implementation class and provides a uniform view to the user.

Image Added

Usage

Code Block

 Configuration config = new Configuration();
 config.add("hive-site.xml");
HCatClient client = HCatClient.create(config);
ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
cols.add(new HCatFieldSchema("id", Type.INT, "id columns"));
cols.add(new HCatFieldSchema("value", Type.STRING, "id columns"));
HCatCreateTableDesc tableDesc = HCatCreateTableDesc.create(db, "testtable", cols).fileFormat("rcfile").build();
client.createTable(tableDesc);

Discussion Topics

...