Package org.apache.hive.hcatalog.common

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


    String token = null;
    try {
      token = hmsClient.getDelegationToken(owner,
        renewerKerberosPrincipalName);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while getting delegation token.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while getting delegation token.", e);
    }
View Full Code Here


  public long renewDelegationToken(String tokenStrForm) throws HCatException {
    long time = 0;
    try {
      time = hmsClient.renewDelegationToken(tokenStrForm);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while renewing delegation token.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while renewing delegation token.", e);
    }
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());
      ArrayList<Partition> ptnList = new ArrayList<Partition>();
      for (HCatAddPartitionDesc desc : partInfoList) {
        ptnList.add(desc.toHivePartition(tbl));
      }
      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 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

    List<String> pvals = new ArrayList<String>();
    for (FieldSchema field : hiveTable.getPartitionKeys()) {
      String val = partSpec.get(field.getName());
      if (val == null || val.length() == 0) {
        throw new HCatException("create partition: Value for key "
          + field.getName() + " is null or empty");
      }
      pvals.add(val);
    }

    hivePtn.setValues(pvals);
    StorageDescriptor sd = new StorageDescriptor(hiveTable.getSd());
    hivePtn.setSd(sd);
    hivePtn.setParameters(hiveTable.getParameters());
    if (this.location != null) {
      hivePtn.getSd().setLocation(this.location);
    } else {
      String partName;
      try {
        partName = Warehouse.makePartName(
          hiveTable.getPartitionKeys(), pvals);
        LOG.info("Setting partition location to :" + partName);
      } catch (MetaException e) {
        throw new HCatException("Exception while creating partition name.", e);
      }
      Path partPath = new Path(hiveTable.getSd().getLocation(), partName);
      hivePtn.getSd().setLocation(partPath.toString());
    }
    hivePtn.setCreateTime((int) (System.currentTimeMillis() / 1000));
View Full Code Here

//      }
//      doHarCheck(fs,harFile);
//      LOG.info("Nuking " + dir);
      fs.delete(new Path(dir), true);
    } catch (Exception e) {
      throw new HCatException("Error creating Har [" + harFile + "] from [" + dir + "]", e);
    }
  }
View Full Code Here

      HiveConf hiveConf = HCatUtil.getHiveConf(conf);
      HiveMetaStoreClient client = HCatUtil.getHiveClient(hiveConf);
      Table table = client.getTable(outputJobInfo.getDatabaseName(), outputJobInfo.getTableName());
      StorageDescriptor tblSD = table.getSd();
      if (tblSD == null) {
        throw new HCatException(
            "Cannot construct partition info from an empty storage descriptor.");
      }
      HCatSchema tableSchema = new HCatSchema(HCatUtil.getHCatFieldSchemaList(tblSD.getCols()));
      outputJobInfo.setOutputSchema(tableSchema);
    }
    catch(Exception e) {
      if( e instanceof HCatException ) {
        throw (HCatException) e;
      } else {
        throw new HCatException(ErrorType.ERROR_SET_OUTPUT, e);
      }
    }
    conf.set(HBaseSerDe.HBASE_TABLE_NAME,outputJobInfo.getDatabaseName()+ "." + outputJobInfo.getTableName());
    conf.set(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME,outputJobInfo.getDatabaseName()+ "." + outputJobInfo.getTableName());
    conf.set(TableOutputFormat.OUTPUT_TABLE, outputJobInfo.getDatabaseName() + "."+ outputJobInfo.getTableName());
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.