Package org.apache.pig.impl.logicalLayer

Examples of org.apache.pig.impl.logicalLayer.LOFilter


        }
        return load ;
    }

    private LOFilter createLOFilter(DotNode node, LogicalPlan plan) {
        LOFilter filter = new LOFilter(plan, getKey(node.attributes), null) ;
        fillSchema(filter, node.attributes) ;
        return filter ;
    }
View Full Code Here


    public void testQueryFilterNoSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a';");
        LogicalPlan lp = planTester.buildPlan("b = filter a by $1 == '3';");
       
        LOFilter filter = (LOFilter)lp.getLeaves().get(0);
        List<RequiredFields> filterRelevantFields0 = filter.getRelevantInputs(0, 0);
        assertTrue(filterRelevantFields0.get(0).getFields().size() == 1);
        assertTrue(filterRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(filterRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(filterRelevantFields0.get(0).getFields().contains(new Pair<Integer, Integer>(0, 0)));
    }
View Full Code Here

    @Test
    public void testQueryFilterWithSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a' as (url,hitCount);");
        LogicalPlan lp = planTester.buildPlan("b = filter a by $1 == '3';");
       
        LOFilter filter = (LOFilter)lp.getLeaves().get(0);
        List<RequiredFields> filterRelevantFields0 = filter.getRelevantInputs(0, 0);
        assertTrue(filterRelevantFields0.get(0).getFields().size() == 1);
        assertTrue(filterRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(filterRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(filterRelevantFields0.get(0).getFields().contains(new Pair<Integer, Integer>(0, 0)));
    }
View Full Code Here

    @Test
    public void testQueryFilterWithStarNoSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a';");
        LogicalPlan lp = planTester.buildPlan("b = filter a by COUNT(*) == 3;");
       
        LOFilter filter = (LOFilter)lp.getLeaves().get(0);
        RequiredFields filterRelevantFields0 = filter.getRelevantInputs(0, 0).get(0);
        assertTrue(filterRelevantFields0.getNeedAllFields() == false);
        assertTrue(filterRelevantFields0.getNeedNoFields() == false);
        assertTrue(filterRelevantFields0.getFields().size() == 1);
        assertTrue(filterRelevantFields0.getFields().get(0).first == 0);
        assertTrue(filterRelevantFields0.getFields().get(0).second == 0);
       
        RequiredFields filterRelevantFields1 = filter.getRelevantInputs(0, 1).get(0);
        assertTrue(filterRelevantFields1.getNeedAllFields() == false);
        assertTrue(filterRelevantFields1.getNeedNoFields() == false);
        assertTrue(filterRelevantFields1.getFields().size() == 1);
        assertTrue(filterRelevantFields1.getFields().get(0).first == 0);
        assertTrue(filterRelevantFields1.getFields().get(0).second == 1);
View Full Code Here

    @Test
    public void testQueryFilterStarWithSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a' as (url,hitCount);");
        LogicalPlan lp = planTester.buildPlan("b = filter a by COUNT(*) == 3;");
       
        LOFilter filter = (LOFilter)lp.getLeaves().get(0);
        RequiredFields filterRelevantFields0 = filter.getRelevantInputs(0, 0).get(0);
        assertTrue(filterRelevantFields0.getNeedAllFields() == false);
        assertTrue(filterRelevantFields0.getNeedNoFields() == false);
        assertTrue(filterRelevantFields0.getFields().size() == 1);
        assertTrue(filterRelevantFields0.getFields().get(0).first == 0);
        assertTrue(filterRelevantFields0.getFields().get(0).second == 0);
       
        RequiredFields filterRelevantFields1 = filter.getRelevantInputs(0, 1).get(0);
        assertTrue(filterRelevantFields1.getNeedAllFields() == false);
        assertTrue(filterRelevantFields1.getNeedNoFields() == false);
        assertTrue(filterRelevantFields1.getFields().size() == 1);
        assertTrue(filterRelevantFields1.getFields().get(0).first == 0);
        assertTrue(filterRelevantFields1.getFields().get(0).second == 1);
View Full Code Here

    @Test
    public void testErrNull() throws VisitorException, IOException {
        String query = "filter (load 'a') by $0 is null;";
        LogicalPlan plan = buildPlan(query);
        LOFilter filter = (LOFilter)plan.getLeaves().get(0);
        LogicalPlan innerPlan = filter.getComparisonPlan();
        innerPlan.remove(innerPlan.getRoots().get(0));
        try {
            buildPhysicalPlan(plan);
            fail("Expected error.");
        } catch(VisitorException ve) {
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.logicalLayer.LOFilter

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.