Package org.apache.hive.hcatalog.common

Examples of org.apache.hive.hcatalog.common.HCatException


    this.createTime = (int) (System.currentTimeMillis() / 1000);
    this.lastAccessTime = -1;
    this.values = new ArrayList<String>(hcatTable.getPartCols().size());
    for (HCatFieldSchema partField : hcatTable.getPartCols()) {
      if (!partitionKeyValues.containsKey(partField.getName())) {
        throw new HCatException("Missing value for partition-key \'" + partField.getName()
            + "\' in table: " + hcatTable.getDbName() + "." + hcatTable.getTableName());
      } else {
        values.add(partitionKeyValues.get(partField.getName()));
      }
    }
View Full Code Here


      try {
        String partName = Warehouse.makePartName(HCatSchemaUtils.getFieldSchemas(hcatTable.getPartCols()), values);
        sd.setLocation(new Path(hcatTable.getSd().getLocation(), partName).toString());
      }
      catch(MetaException exception) {
        throw new HCatException("Could not construct default partition-path for "
            + hcatTable.getDbName() + "." + hcatTable.getTableName() + "[" + values + "]");
      }
    }
    hivePtn.setSd(sd);
View Full Code Here

   * Setter for partition key-values.
   */
  public HCatPartition setPartitionKeyValues(Map<String, String> partitionKeyValues) throws HCatException {
    for (HCatFieldSchema partField : hcatTable.getPartCols()) {
      if (!partitionKeyValues.containsKey(partField.getName())) {
        throw new HCatException("Missing value for partition-key \'" + partField.getName()
            + "\' in table: " + hcatTable.getDbName() + "." + hcatTable.getTableName());
      }
      else {
        values.add(partitionKeyValues.get(partField.getName()));
        // Keep partKeyValMap in synch as well.
View Full Code Here

  public void cancelDelegationToken(String tokenStrForm)
    throws HCatException {
    try {
      hmsClient.cancelDelegationToken(tokenStrForm);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while canceling delegation token.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while canceling delegation token.", e);
    }
View Full Code Here

    this.config = conf;
    try {
      hiveConfig = HCatUtil.getHiveConf(config);
      hmsClient = HCatUtil.getHiveClient(hiveConfig);
    } catch (MetaException exp) {
      throw new HCatException("MetaException while creating HMS client",
        exp);
    } catch (IOException exp) {
      throw new HCatException("IOException while creating HMS client",
        exp);
    }

  }
View Full Code Here

    Table oldtbl = null;
    Table newTable = null;
    try {
      oldtbl = hmsClient.getTable(checkDB(dbName), existingTblName);
    } catch (MetaException e1) {
      throw new HCatException(
        "MetaException while retrieving existing table.", e1);
    } catch (NoSuchObjectException e1) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while retrieving existing table.",
        e1);
View Full Code Here

  @Override
  public int addPartitions(List<HCatAddPartitionDesc> partInfoList)
    throws HCatException {
    int numPartitions = -1;
    if ((partInfoList == null) || (partInfoList.size() == 0)) {
      throw new HCatException("The partition list is null or empty.");
    }

    Table tbl = null;
    try {
      tbl = hmsClient.getTable(partInfoList.get(0).getDatabaseName(),
        partInfoList.get(0).getTableName());
      HCatTable hcatTable = new HCatTable(tbl);
      ArrayList<Partition> ptnList = new ArrayList<Partition>();
      for (HCatAddPartitionDesc desc : partInfoList) {
        HCatPartition hCatPartition = desc.getHCatPartition();

        // TODO: Remove in Hive 0.16.
        // This is required only to support the deprecated HCatAddPartitionDesc.Builder interfaces.
        if (hCatPartition == null) {
          hCatPartition = desc.getHCatPartition(hcatTable);
        }

        ptnList.add(hCatPartition.toHivePartition());
      }
      numPartitions = hmsClient.add_partitions(ptnList);
    } catch (InvalidObjectException e) {
      throw new HCatException(
        "InvalidObjectException while adding partition.", e);
    } catch (AlreadyExistsException e) {
      throw new HCatException(
        "AlreadyExistsException while adding partition.", e);
    } catch (MetaException e) {
      throw new HCatException("MetaException while adding partition.", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException("The table "
        + partInfoList.get(0).getTableName()
        + " is could not be found.", e);
    } catch (TException e) {
View Full Code Here

  public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException {

    try {
      return hmsClient.add_partitions_pspec(partitionSpec.toPartitionSpecProxy());
    } catch (InvalidObjectException e) {
      throw new HCatException(
          "InvalidObjectException while adding partition.", e);
    } catch (AlreadyExistsException e) {
      throw new HCatException(
          "AlreadyExistsException while adding partition.", e);
    } catch (MetaException e) {
      throw new HCatException("MetaException while adding partition.", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException("The table "
          + "could not be found.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
View Full Code Here

  public String getMessageBusTopicName(String dbName, String tableName) throws HCatException {
    try {
      return hmsClient.getTable(dbName, tableName).getParameters().get(HCatConstants.HCAT_MSGBUS_TOPIC_NAME);
    }
    catch (MetaException e) {
      throw new HCatException("MetaException while retrieving JMS Topic name.", e);
    } catch (NoSuchObjectException e) {
      throw new HCatException("Could not find DB:" + dbName + " or Table:" + tableName, e);
    } catch (TException e) {
      throw new ConnectionFailureException(
          "TException while retrieving JMS Topic name.", e);
    }
  }
View Full Code Here

        if (partition.getDatabaseName().equals(table.getDbName())
            && partition.getTableName().equals(table.getTableName())) {
          partition.hcatTable(table);
        }
        else {
          throw new HCatException("All partitions are not of the same table: "
              + table.getDbName() + "." + table.getTableName());
        }
      }
      partitions.add(partition);
    }
View Full Code Here

TOP

Related Classes of org.apache.hive.hcatalog.common.HCatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.