Examples of HCatClient


Examples of org.apache.hcatalog.api.HCatClient

        LOG.info("List partitions for : " + tableName + ", partition filter: " + filter);

        try {
            List<CatalogPartition> catalogPartitionList = new ArrayList<CatalogPartition>();

            HCatClient client = get(catalogUrl);
            List<HCatPartition> hCatPartitions = client.listPartitionsByFilter(database, tableName, filter);
            for (HCatPartition hCatPartition : hCatPartitions) {
                LOG.info("Partition: " + hCatPartition.getValues());
                CatalogPartition partition = createCatalogPartition(hCatPartition);
                catalogPartitionList.add(partition);
            }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

                                  String tableName, Map<String, String> partitions)
        throws FalconException {
        LOG.info("Dropping partitions for : " + tableName + ", partitions: " + partitions);

        try {
            HCatClient client = get(catalogUrl);
            client.dropPartitions(database, tableName, partitions, true);
        } catch (HCatException e) {
            throw new FalconException("Exception dropping partitions:" + e.getMessage(), e);
        }

        return true;
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

    public CatalogPartition getPartition(String catalogUrl, String database, String tableName,
                                         Map<String, String> partitionSpec) throws FalconException {
        LOG.info("Fetch partition for : " + tableName + ", partition spec: " + partitionSpec);

        try {
            HCatClient client = get(catalogUrl);
            HCatPartition hCatPartition = client.getPartition(database, tableName, partitionSpec);
            return createCatalogPartition(hCatPartition);
        } catch (HCatException e) {
            throw new FalconException("Exception fetching partition:" + e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

    public List<String> getTablePartitionCols(String catalogUrl, String database,
                                            String tableName) throws FalconException {
        LOG.info("Fetching partition columns of table: " + tableName);

        try {
            HCatClient client = get(catalogUrl);
            HCatTable table = client.getTable(database, tableName);
            List<HCatFieldSchema> partSchema = table.getPartCols();
            List<String> partCols = new ArrayList<String>();
            for (HCatFieldSchema part : partSchema) {
                partCols.add(part.getName());
            }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

        throw new UnsupportedOperationException("Creation of partition is not supported for " + uri);
    }

    @Override
    public boolean delete(URI uri, Configuration conf) throws LauncherException {
        HCatClient client = getHCatClient(uri, conf);
        try {
            HCatURI hcatURI = new HCatURI(uri.toString());
            client.dropPartitions(hcatURI.getDb(), hcatURI.getTable(), hcatURI.getPartitionMap(), true);
            System.out.println("Dropped partitions for " + uri);
            return true;
        }
        catch (ConnectionFailureException e) {
            throw new LauncherException("Error trying to drop " + uri, e);
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

        catch (URISyntaxException e) {
            throw new URIHandlerException(ErrorCode.E0906, uri, e);
        }
        HCatAccessorService hcatService = Services.get().get(HCatAccessorService.class);
        if (!hcatService.isRegisteredForNotification(hcatURI)) {
            HCatClient client = getHCatClient(uri, conf, user);
            try {
                String topic = client.getMessageBusTopicName(hcatURI.getDb(), hcatURI.getTable());
                if (topic == null) {
                    return;
                }
                hcatService.registerForNotification(hcatURI, topic, new HCatMessageHandler(uri.getAuthority()));
            }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

        return pdmService.removeMissingDependency(hcatURI, actionID);
    }

    @Override
    public Context getContext(URI uri, Configuration conf, String user) throws URIHandlerException {
        HCatClient client = getHCatClient(uri, conf, user);
        return new HCatContext(conf, user, client);
    }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

        return new HCatContext(conf, user, client);
    }

    @Override
    public boolean exists(URI uri, Context context) throws URIHandlerException {
        HCatClient client = ((HCatContext) context).getHCatClient();
        return exists(uri, client, false);
    }
View Full Code Here

Examples of org.apache.hcatalog.api.HCatClient

        return exists(uri, client, false);
    }

    @Override
    public boolean exists(URI uri, Configuration conf, String user) throws URIHandlerException {
        HCatClient client = getHCatClient(uri, conf, user);
        return exists(uri, client, true);
    }
View Full Code Here

Examples of org.apache.hive.hcatalog.api.HCatClient

        catch (URISyntaxException e) {
            throw new URIHandlerException(ErrorCode.E0906, uri, e);
        }
        HCatAccessorService hcatService = Services.get().get(HCatAccessorService.class);
        if (!hcatService.isRegisteredForNotification(hcatURI)) {
            HCatClient client = getHCatClient(uri, conf, user);
            try {
                String topic = client.getMessageBusTopicName(hcatURI.getDb(), hcatURI.getTable());
                if (topic == null) {
                    return;
                }
                hcatService.registerForNotification(hcatURI, topic, new HCatMessageHandler(uri.getAuthority()));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.