Package org.apache.hive.hcatalog.common

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


    if (hiveTable != null) {
      try {
        hmsClient.createTable(hiveTable);
      } catch (AlreadyExistsException e) {
        if (!ifNotExists) {
          throw new HCatException(
            "A table already exists with the name "
              + newTableName, e);
        }
      } catch (InvalidObjectException e) {
        throw new HCatException(
          "InvalidObjectException in create table like command.",
          e);
      } catch (MetaException e) {
        throw new HCatException(
          "MetaException in create table like command.", e);
      } catch (NoSuchObjectException e) {
        throw new ObjectNotFoundException(
          "NoSuchObjectException in create table like command.",
          e);
View Full Code Here


      if (!ifExists) {
        throw new ObjectNotFoundException(
          "NoSuchObjectException while dropping table.", e);
      }
    } catch (MetaException e) {
      throw new HCatException("MetaException while dropping table.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while dropping table.", e);
    }
  }
View Full Code Here

      if (oldtbl != null) {
        // TODO : Should be moved out.
        if (oldtbl
          .getParameters()
          .get(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE) != null) {
          throw new HCatException(
            "Cannot use rename command on a non-native table");
        }
        tbl = new Table(oldtbl);
        tbl.setTableName(newName);
        hmsClient.alter_table(checkDB(dbName), oldName, tbl);
      }
    } catch (MetaException e) {
      throw new HCatException("MetaException while renaming table", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while renaming table", e);
    } catch (InvalidOperationException e) {
      throw new HCatException(
        "InvalidOperationException while renaming table", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
          "TException while renaming table", e);
    }
View Full Code Here

      }
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while retrieving partition.", e);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while retrieving partition.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while retrieving partition.", e);
    }
View Full Code Here

                    Map<String, String> partitionSpec) throws HCatException {
    HCatPartition partition = null;
    try {
      List<HCatFieldSchema> partitionColumns = getTable(checkDB(dbName), tableName).getPartCols();
      if (partitionColumns.size() != partitionSpec.size()) {
        throw new HCatException("Partition-spec doesn't have the right number of partition keys.");
      }

      ArrayList<String> ptnValues = new ArrayList<String>();
      for (HCatFieldSchema partitionColumn : partitionColumns) {
        String partKey = partitionColumn.getName();
        if (partitionSpec.containsKey(partKey)) {
          ptnValues.add(partitionSpec.get(partKey)); // Partition-keys added in order.
        }
        else {
          throw new HCatException("Invalid partition-key specified: " + partKey);
        }
      }
      Partition hivePartition = hmsClient.getPartition(checkDB(dbName),
        tableName, ptnValues);
      if (hivePartition != null) {
        partition = new HCatPartition(hivePartition);
      }
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while retrieving partition.", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while retrieving partition.", e);
    } catch (TException e) {
View Full Code Here

    try {
      tbl = hmsClient.getTable(partInfo.getDatabaseName(),
        partInfo.getTableName());
      // TODO: Should be moved out.
      if (tbl.getPartitionKeysSize() == 0) {
        throw new HCatException("The table " + partInfo.getTableName()
          + " is not partitioned.");
      }

      hmsClient.add_partition(partInfo.toHivePartition(tbl));
    } 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 " + partInfo.getTableName()
        + " is could not be found.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
View Full Code Here

    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
          "NoSuchObjectException while dropping partition. " +
              "Either db(" + dbName + ") or table(" + tableName + ") missing.", e);
    } catch (MetaException e) {
      throw new HCatException("MetaException while dropping partition.",
        e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while dropping partition.", e);
    }
View Full Code Here

        checkDB(dbName), tblName, filter, (short) -1);
      for (Partition ptn : hivePtns) {
        hcatPtns.add(new HCatPartition(ptn));
      }
    } catch (MetaException e) {
      throw new HCatException("MetaException while fetching partitions.",
        e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while fetching partitions.", e);
    } catch (TException e) {
View Full Code Here

    throws HCatException {
    try {
      hmsClient.markPartitionForEvent(checkDB(dbName), tblName, partKVs,
        eventType);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while marking partition for event.", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while marking partition for event.",
        e);
    } catch (UnknownTableException e) {
      throw new HCatException(
        "UnknownTableException while marking partition for event.",
        e);
    } catch (UnknownDBException e) {
      throw new HCatException(
        "UnknownDBException while marking partition for event.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while marking partition for event.", e);
    }
View Full Code Here

    boolean isMarked = false;
    try {
      isMarked = hmsClient.isPartitionMarkedForEvent(checkDB(dbName),
        tblName, partKVs, eventType);
    } catch (MetaException e) {
      throw new HCatException(
        "MetaException while checking partition for event.", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while checking partition for event.",
        e);
    } catch (UnknownTableException e) {
      throw new HCatException(
        "UnknownTableException while checking partition for event.",
        e);
    } catch (UnknownDBException e) {
      throw new HCatException(
        "UnknownDBException while checking partition for event.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
        "TException while checking partition for event.", e);
    }
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.