Package org.apache.hcatalog.common

Examples of org.apache.hcatalog.common.HCatException


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

        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

TOP

Related Classes of org.apache.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.