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

Code Block

/**
 * The Interface HCatClient containing APIs for HCatalog DDL commands.
 */
public interface HCatClient {

     /**
     * Creates an instance of HCatClient.
     *
     * @param conf An instance of configuration.
     * @return An instance of HCatClient.
     */
    public HCatClient create(Configuration conf){
         return null;
    }

    /**
     * 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) throws HCatException;

    /**
     * Gets the database.
     *
     * @param dbName The name of 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
     * @throws HCatException
     */
    public boolean createDatabase(HCatCreateDBDesc dbInfo)
            throws HCatException;

    /**
     * Deletes a database.
     *
     * @param dbName The name of the database to delete.
     * @param ifExists Hive returns an error if the database specified does not exist,
     *                 unless ifExists 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.
     * @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 deleteDatabase(String dbName, boolean ifExists, String mode,
            String userGroup, String permissions) throws HCatException;

    /**
     * Gets the tables like a pattern specified.
     *
     * @param dbName The name of the database.
     * @param regex The regular expression. Providing "*" would retrieve all the names
     *              of  the table.
     * @return A list of all table names matching the specified pattern.
     * @throws HCatException
     */
    public List<String> 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.
     * @throws HCatException the h cat exception
     */
    public boolean 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 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 createTableLike(String dbName, String existingTblName,
            String newTableName, boolean ifExists, boolean isExternal,
            String location) throws HCatException;

    /**
     * Delete a table.
     *
     * @param dbName The name of the database.
     * @param tableName The name of the table.
     * @param ifExists Hive returns an error if the database specified does not exist,
     *                 unless ifExists is set to true.
     * @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 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 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 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.
     * @throws HCatException
     */
    public HCatPartitionInfo getPartition(String dbName, String tableName,
            String partitionName) throws HCatException;

    /**
     * Adds the partition.
     *
     * @param partInfo An instance of HCatAddPartitionDesc.
     * @return true, if successful
     * @throws HCatException the h cat exception
     */
    public boolean addPartition(HCatAddPartitionDesc partInfo) throws HCatException;

    /**
     * Deletes partition.
     *
     * @param dbName The database name.
     * @param tableName The table name.
     * @param partitionName The partition name, Comma separated list of col_name='value'.
     * @param ifExists Hive returns an error if the partition specified does not exist, unless ifExists is set to true.
     * @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 deletePartition(String dbName, String tableName,
            String partitionName, boolean ifExists, String userGroup,
            String permissions) throws HCatException;

    /**
     * List partitions by filter.
     *
     * @param dbName The database name.
     * @param tblName The table name.
     * @param filter 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 markPartitionForEvent(String dbName, String tblName,
            Map<String, String> partKVs, PartitionEventType eventType)
            throws HCatException;

    /**
     * Checks if is partition marked for event.
     *
     * @param dbName the db name
     * @param tblName the tbl name
     * @param partKVs the part k vs
     * @param eventType the event type
     * @return true, if is partition marked for event
     * @throws HCatException the h cat exception
     */
    public boolean isPartitionMarkedForEvent(String dbName, String tblName,
            Map<String, String> partKVs, PartitionEventType eventType)
            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{

    public abstract void validateCommandDesc() 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.

"create" method. In this way, the implementation details will be masked to the users.

Code Block

public abstract class HCatClient {

    /**
     * Creates an instance of HCatClient.
     *
     * @param conf An instance of configuration.
     * @return An instance of HCatClient.
     * @throws IOException
Code Block

public class HCatCreateDBDesc extends HCatCommandDesc {

    private String databaseName;
    private String locationUri;
    private String comment;
    private Map<String, String> dbProperties;

    /**
     * Gets the database properties.
     *
     * @return the database properties
     */
    Map<String, String> getDatabaseProperties() {
        return this.dbProperties;
    }

    /**
     * Sets the database properties.
     *
     * @param dbProps the db props
     */
    public void setDatabaseProperties(Map<String, String> dbProps) {
        this.dbProperties = dbProps;
    }

    /**
     * Gets the name.
     *
     * @return the name
     */
    String getName() {
        return this.databaseName;
    }

    /**
     * Sets the name.
     *
     * @param databaseName the new name
     */
    public void setName(String databaseName) {
        this.databaseName = databaseName;
    }

    /**
     * Gets the comment.
     *
     * @return the comment
     */
    String getComment() {
        return this.comment;
    }

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

    /**
     * Gets the location.
     *
     * @return the location
     */
    String getLocation() {
        return this.locationUri;
    }

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

    /* @return
    /* @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildCommandDesc()
     */
    @Override
    public void validateCommandDesc()
            throws HCatException {

    }

    /* @param desc
    /* @return
    /* @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildQuery(java.lang.Class)
     */
    @Override
public static HCatClient  String buildQuery(create(Configuration conf) throws HCatException IOException{
      HCatClient client // TODO Auto-generated method stub
= HCatUtil.getHCatClient(conf);
        if(client return!= null;){
    }

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

    abstract void initialize(Configuration conf) returnthrows falseHCatException;

    }

}
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{

    private String tableName;/**
     * Get all existing databases that match the given
    private boolean isExternal;
    private ArrayList<HCatFieldSchema> cols; * pattern. The matching occurs as per Java regular expressions
    private ArrayList<HCatFieldSchema>*
 partCols;
    private* ArrayList<String>@param bucketCols;databasePattern
    private ArrayList<Order>* sortCols;
    private int numBuckets;
   java private String dbName;re pattern
    private String* comment;
@return list of database privatenames
 String fileFormat;
   * private String location;@throws HCatException
    private String storageHandler;
   */
  private Map<String, String>public tblProps;
abstract List<String> listDatabaseNamesByPattern(String pattern) privatethrows boolean ifNotExistsHCatException;

    ArrayList<HCatFieldSchema> getColsString() {
/**
     * Gets returnthe thisdatabase.getCols();
    } *

    boolean getIfNotExists() {
        return this.ifNotExists;* @param dbName The name of the database.
    }

 * @return  /**
An instance of HCatDatabaseInfo.
  * Sets the if* not@throws exists.HCatException
     */
 If true, the userpublic willabstract notHCatDatabase receive an error if the table already exists.getDatabase(String dbName) throws HCatException;

    /**
     * Creates @paramthe ifNotExistsdatabase.
 the new if not exists*
     */
 @param dbInfo An public void setIfNotExists(boolean ifNotExists) {instance of HCatCreateDBDesc.
     * this.ifNotExists = ifNotExists;
@throws HCatException
     }

   String getTableName() {*/
    public abstract void createDatabase(HCatCreateDBDesc dbInfo)
        return this.tableName;
   throws }HCatException;

    String getDatabaseName(){/**
     * Drops a return thisdatabase.dbName;
    } *

     /**
 @param dbName The name *of Sets the database to namedelete.
     *
 @param ifExists Hive returns *an @paramerror dbNameif the database specified newdoes databasenot nameexist,
     */
     public void setDatabaseName(String dbName){
        this.dbName =unless dbName;
ifExists is set to }true.

     /**
 @param mode This is *set to Setseither the"restrict" tableor name."cascade". Restrict will
     *
        * @param tableName the new tableremove name
the schema if all the */
tables are empty. Cascade publicremoves
 void setTableName(String tableName) {
 *     this.tableName = tableName;
    }

  everything including ArrayList<HCatFieldSchema>data getCols() {and definitions.
     * @throws //HCatException
  ArrayList<FieldSchema> cols = this.tableDesc.getCols(); */
    public abstract void dropDatabase(String dbName, return null;
    }boolean ifExists, String mode) throws HCatException;

    /**
     * Sets Returns all existing tables from the table columns. specified database which match the given
     *
 pattern. The matching occurs *as @paramper colsJava Listregular of columnsexpressions.
     */ @param dbName
    public void setCols(ArrayList<HCatFieldSchema> cols) {* @param tablePattern
     * @return list //convertof andtable set.names
     * this.cols = null;
@throws HCatException
     }*/

    public abstract ArrayList<HCatFieldSchema>List<String> getPartCols() {listTableNamesByPattern(String dbName, String tablePattern)
        return null;
   throws }HCatException;

    /**
     * SetsGets the part cols.
     *table.
     *
     * @param dbName The name of the database.
     * @param partColstableName The Listname of partitionthe columnstable.
     */
 @return An instance of publicHCatTableInfo.
 void setPartCols(ArrayList<HCatFieldSchema> partCols) {
 * @throws HCatException
   //this.partCols = partCols;*/
    }

public abstract HCatTable  ArrayList<String> getBucketCols() {getTable(String dbName, String tableName)
        return this.bucketCols;
   throws }HCatException;

    /**
     * SetsCreates the bucket colstable.
     *
     * @param bucketColscreateTableDesc TheAn listinstance of columns to be used for clustering. HCatCreateTableDesc class.
     * @throws HCatException the h cat exception
     */
    public abstract void setBucketColscreateTable(ArrayList<String>HCatCreateTableDesc bucketColscreateTableDesc)
 {
      this.bucketCols = bucketCols;
   throws }HCatException;

    int getNumBuckets() {
/**
     * Creates the table like returnan existing thistable.numBuckets;
    } *

     /**
 @param dbName The name *of Sets the num bucketsdatabase.
     * @param existingTblName The name of the existing table.
     * @param numBucketsnewTableName The numbername of the new bucketstable.
     */
    public void setNumBuckets(int numBuckets) { @param ifNotExists If true, then error related to already table existing is skipped.
     * this.numBuckets@param =isExternal numBuckets;
Set to "true", if }

table has be created Stringat getComment()a {different
     *   return this.comment;
    }

    /**
     * Sets thelocation comment.
other     *than default.
     * @param commentlocation The commentlocation for the table.
     */
    public void setComment(String comment) {
      this.comment = comment;
     * @throws HCatException
     */
    }


   public abstract void createTableLike(String dbName, String getStorageHandler() {existingTblName,
        return this.storageHandler;
   String }

newTableName, boolean ifNotExists, boolean /**isExternal,
     * Sets the storage handler.
   String  *
 location) throws HCatException;

    /**
 @param  storageHandler the new* storageDrop handlertable.
     */
    public void* setStorageHandler(String storageHandler) {
      this.storageHandler = storageHandler;
    }

    String getLocation() {@param dbName The name of the database.
     * @param tableName The name of the table.
     * @param ifExists return this.location;
    }

    /**Hive returns an error if the database specified does not exist,
     * Sets the location.
     *
     * @param location the newunless location
ifExists is set to  */true.
    public void* setLocation(String location) {@throws HCatException
      this.location = location;*/
    }

public abstract void dropTable(String boolean getExternal() {dbName, String tableName,
        return  this.isExternal;
  boolean ifExists) throws }HCatException;

    /**
     * SetsRenames thea externaltable.
     *
     * @param isExternal True/False, indicating if the table is an external table.
     */dbName The name of the database.
     * @param oldName The name of the table to be renamed.
    public void* setExternal(boolean isExternal) {
      this.isExternal = isExternal;
    }

    ArrayList<Order> getSortCols() {@param newName The new name of the table.
     * @throws HCatException
     */
    public abstract void renameTable(String dbName, return this.sortCols;
    }String oldName, String newName) throws HCatException;

    /**
     * SetsGets all the sort colspartitions.
     *
     * @param sortCols the sortCols to set dbName The name of the database.
     * @param tblName The name of the table.
     */
 @return A list publicof void setSortCols(ArrayList<Order> sortCols) {partition names.
     * this.sortCols@throws =HCatException sortCols;
the h cat exception
 }

    */**
    public abstract *List<HCatPartition> @return the table properties
getPartitions(String dbName, String tblName)
      */
    Map<String, String> getTblProps() {throws HCatException;

    /**
    return this.tblProps;
* Gets the partition.
 }

    /**
     * @param tblProps
dbName The database name.
  *   * @param tableName The table name.
  the table properties to* set
@param partitionName The partition name, */
Comma separated list  public void setTblProps(Map<String, String> tblProps) {
      this.tblProps = tblProps;
    }

of col_name='value'.
     * @return An instance of HCatPartitionInfo.
     * @throws HCatException
     */**
    public abstract *HCatPartition Sets the file format.getPartition(String dbName, String tableName,
     *
     * @param formatString thepartitionName) new file formatthrows HCatException;

     /**/
    public * voidAdds setFileFormat(String format){
the partition.
     *
     this.fileFormat* =@param format;
partInfo An instance of }HCatAddPartitionDesc.

     * String getFileFormat(){
    @throws HCatException the h cat exception
    return this.fileFormat; */
    }

    /* @returnpublic abstract void addPartition(HCatAddPartitionDesc partInfo) throws HCatException;

    /* @throws HCatException*
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildCommandDesc()Drops partition.
     */
    @Override
     * @param dbName The database name.
    public * void@param validateCommandDesc()tableName throwsThe HCatExceptiontable {name.
     * @param partitionName The  // TODO Auto-generated method stub
partition name, Comma separated list of col_name='value'.
      }


    /* @param desc
    /* @return
    /* @throws HCatException* @param ifExists Hive returns an error if the partition specified does not exist, unless ifExists is set to true.
     * @see org.apache.hcatalog.api.HCatCommandDescBuilder#buildQuery(org.apache.hcatalog.api.HCatCommandDescBuilder)@throws HCatException
     */
    @Override
public abstract void  dropPartition(String buildQuery() throws HCatException {
        // TODO Auto-generated method stub
dbName, String tableName,
            return null;
    }


String partitionName, boolean ifExists) throws HCatException;

    /* @return*
     * List @see org.apache.hcatalog.api.HCatCommandDesc#isValidationComplete()partitions by filter.
     */
    @Override
     * @param dbName The database name.
    boolean isValidationComplete() {
   * @param tblName The table name.
     * //@param TODOfilter Auto-generatedThe methodfilter stubstring,
     *   return false;
for example "part1  }

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 {
= \"p1_abc\" and part2 <= "\p2_test\"". Filtering can
    //private AddPartitionDesc* addPartDesc;
   be privatedone Stringonly dbName;
on string partition keys.
 private String tableName;
  * @return privatelist Stringof location;partitions
    private LinkedHashMap<String,String> partSpec;

    /** * @throws HCatException the h cat exception
     * @return database name/
    public */
abstract List<HCatPartition> listPartitionsByFilter(String  dbName, String getDbName() {
tblName,
          return this.dbName;
 String filter) throws }HCatException;

    /**
     * SetsMark thepartition dbfor nameevent.
     *
     * @param dbName The database name.
     */
 @param tblName The public void setDbName(String dbName) {
      this.dbName = dbName;table name.
    }

 * @param partKVs /**
the part   k *vs
 @return the table we're going* to@param addeventType the partitionsevent to.type
     */
 @throws HCatException the h String getTableName() {cat exception
     */
 return this.tableName;
  public abstract }

    /**void markPartitionForEvent(String dbName, String tblName,
     * Sets the table name.
   Map<String,  *
String> partKVs, PartitionEventType eventType)
      * @param tableName the table we're going to add the partitions to.throws HCatException;

    /**
     */
    public void setTableName(String tableName) {
   Checks if is partition marked for event.
     *
    this.tableName =* tableName;
@param dbName the db }name

    String getLocation() {
      return this.location;
    }

    /*** @param tblName the tbl name
     * @param partKVs the part k vs
     * @param SetseventType the event location.type
     *
     * @param location The location of partition in relation to table @return true, if is partition marked for event
     * @throws HCatException the h cat exception
     */
    public voidabstract boolean setLocationisPartitionMarkedForEvent(String location) {
      this.location = location;dbName, String tblName,
    }

    /**
    Map<String, *String> @returnpartKVs, partitionPartitionEventType specification.eventType)
     */
     LinkedHashMap<String, String> getPartSpec() {throws HCatException;

    /**
     * Gets the returndelegation thistoken.partSpec;
    } *

     /**
 @param owner the owner
 * Adds the partition name* and@param value.
renewerKerberosPrincipalName the renewer kerberos principal *name
     * @param@return colNamethe The column name.delegation token
     * @throws @paramHCatException the valueh Thecat value.exception
     */
    public voidabstract String addPartSpecgetDelegationToken(String colNameowner, String value) {
renewerKerberosPrincipalName) throws
        HCatException;

    /**
     *  this.partSpec.put(colName, value);Renew delegation token.
    } *

     @Override
* @param tokenStrForm the publictoken voidstr validateCommandDesc()form
     * @return the long
     * throws@throws HCatException {
 the h cat exception
     */
    }

    /* @returnpublic abstract long renewDelegationToken(String tokenStrForm) throws HCatException;

    /** @throws HCatException
     * @see org.apache.hcatalog.api.HCatCommandDesc#buildQuery()Cancel delegation token.
     */
    @Override
 * @param tokenStrForm Stringthe buildQuery()token throwsstr HCatExceptionform
 {
    * @throws HCatException the //h TODO Auto-generated method stub
cat exception
     */
    public returnabstract null;
    }void cancelDelegationToken(String tokenStrForm) throws HCatException;

    /* @return*
     * Close @seethe org.apache.hcatalog.api.HCatCommandDesc#isValidationComplete()hcatalog client.
     */
    @Override
 * @throws HCatException the booleanh isValidationComplete()cat {exception
        // TODO Auto-generated method stub*/
    public abstract void close() returnthrows 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.
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 AddedImage Removed

Usage

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

 HCatCreateTableDesc desc config = new HCatCreateTableDescConfiguration();
 descconfig.setTableNameadd("demo_tablehive-site.xml");
 desc.setDatabaseName("db1");
 desc.setFileFormat("rcfile"HCatClient client = HCatClient.create(config);
 ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
 cols.add(new HCatFieldSchema("col1id", Type.INT, "comment1id columns"));
 cols.add(new HCatFieldSchema("col2value", Type.STRING, "comment2id columns"));
 desc.setCols(cols);

 //Validate
 desc.validateCommandDescHCatCreateTableDesc tableDesc = HCatCreateTableDesc.create(db, "testtable", cols).fileFormat("rcfile").build();
 boolean success = client.createTable(desctableDesc);

Discussion Topics

...