Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

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

HCatAddPartitionDesc

...


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

}
HCatCreateDBDesc

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

Code Block

public class HCatCreateTableDesc extends HCatCommandDesc{

    private String tableName;
    private boolean isExternal;
    private ArrayList<HCatFieldSchema> cols;
    private ArrayList<HCatFieldSchema> partCols;
    private ArrayList<String> bucketCols;
    private ArrayList<Order> sortCols;
    private int numBuckets;
    private String dbName;
    private String comment;
    private String fileFormat;
    private String location;
    private String storageHandler;
    private Map<String, String> tblProps;
    private boolean ifNotExists;

    ArrayList<HCatFieldSchema> getColsString() {
      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;
    }

}
HCatDBInfo

Modification to Existing Classes:

...