Package org.apache.oozie.util

Examples of org.apache.oozie.util.HCatURI


     *
     * @param dataOutName
     * @return Table name
     */
    public static String ph3_coord_tableOut(String dataName) {
        HCatURI hcatURI = getURIFromResolved(dataName, EventType.output);
        if (hcatURI != null) {
            return hcatURI.getTable();
        }
        else {
            return "";
        }
    }
View Full Code Here


        Boolean unresolved = (Boolean) eval.getVariable(".dataout." + dataOutName + ".unresolved");
        if (unresolved != null && unresolved.booleanValue() == true) {
            return "${coord:dataOutPartitionValue('" + dataOutName + "', '" + partitionName + "')}";
        }
        try {
            HCatURI hcatUri = new HCatURI(uri);
            return hcatUri.getPartitionValue(partitionName);
        }
        catch(URISyntaxException urie) {
            XLog.getLog(HCatELFunctions.class).warn("Exception with uriTemplate [{0}]. Reason [{1}]: ", uri, urie);
            throw new RuntimeException("HCat URI can't be parsed " + urie);
        }
View Full Code Here

        Boolean unresolved = (Boolean) eval.getVariable(".dataout." + dataOutName + ".unresolved");
        if (unresolved != null && unresolved.booleanValue() == true) {
            return "${coord:dataOutPartitions('" + dataOutName + "')}";
        }
        try {
            return new HCatURI(uri).toPartitionString();
        }
        catch (URISyntaxException e) {
            throw new RuntimeException("Parsing exception for HCatURI " + uri + ". details: " + e);
        }
    }
View Full Code Here

        if (uris != null) {
            String[] uriList = uris.split(CoordELFunctions.DIR_SEPARATOR);
            // get the partition values list and find minimum
            try {
                // initialize minValue with first partition value
                minPartition = new HCatURI(uriList[0]).getPartitionValue(partitionName);
                if (minPartition == null || minPartition.isEmpty()) {
                    throw new RuntimeException("No value in data-in uri for partition key: " + partitionName);
                }
                for (int i = 1; i < uriList.length; i++) {
                        String value = new HCatURI(uriList[i]).getPartitionValue(partitionName);
                        if(value.compareTo(minPartition) < 0) { //sticking to string comparison since some numerical date
                                                                //values can also contain letters e.g. 20120101T0300Z (UTC)
                            minPartition = value;
                        }
                }
View Full Code Here

        if (uris != null) {
            String[] uriList = uris.split(CoordELFunctions.DIR_SEPARATOR);
            // get the partition values list and find minimum
            try {
                // initialize minValue with first partition value
                maxPartition = new HCatURI(uriList[0]).getPartitionValue(partitionName);
                if (maxPartition == null || maxPartition.isEmpty()) {
                    throw new RuntimeException("No value in data-in uri for partition key: " + partitionName);
                }
                for(int i = 1; i < uriList.length; i++) {
                        String value = new HCatURI(uriList[i]).getPartitionValue(partitionName);
                        if(value.compareTo(maxPartition) > 0) {
                            maxPartition = value;
                        }
                }
            }
View Full Code Here

            for (String uri : uriList) {
                if (filter.length() > 0) {
                    filter.append(" OR ");
                }
                try {
                    filter.append(new HCatURI(uri).toPartitionFilter(type));
                }
                catch (URISyntaxException e) {
                    throw new RuntimeException("Parsing exception for HCatURI " + uri + ". details: " + e);
                }
            }
View Full Code Here

        else {
            LOG.warn("URI is NULL");
            return null;
        }
        LOG.info("uriTemplate [{0}] ", uriTemplate);
        HCatURI hcatURI;
        try {
            hcatURI = new HCatURI(uriTemplate.toString());
        }
        catch (URISyntaxException e) {
            LOG.info("uriTemplate [{0}]. Reason [{1}]: ", uriTemplate, e);
            throw new RuntimeException("HCat URI can't be parsed " + e);
        }
View Full Code Here

public class TestHCatURI {

    @Test
    public void testHCatURIParseValidURI() {
        String input = "hcat://hcat.server.com:5080/mydb/clicks/datastamp=12;region=us";
        HCatURI uri = null;
        try {
            uri = new HCatURI(input);
        }
        catch (Exception ex) {
            System.err.print(ex.getMessage());
        }
        assertEquals(uri.getServerEndPoint(), "hcat://hcat.server.com:5080");
        assertEquals(uri.getDb(), "mydb");
        assertEquals(uri.getTable(), "clicks");
        assertEquals(uri.getPartitionValue("datastamp"), "12");
        assertEquals(uri.getPartitionValue("region"), "us");

    }
View Full Code Here

    }

    @Test(expected = URISyntaxException.class)
    public void testHCatURIParseInvalidURI() throws Exception {
        String input = "hcat://hcat.server.com:5080/mydb/clicks/datastamp=12;region=us/invalid";
        new HCatURI(input);
    }
View Full Code Here

    }

    @Test(expected = URISyntaxException.class)
    public void testHCatURIParseInvalidPartition() throws Exception {
        String input = "hcat://hcat.server.com:5080/mydb/clicks/datastamp";
        new HCatURI(input);
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.util.HCatURI

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.