Package org.apache.pig.impl.logicalLayer

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


    @Test
    public void testQueryDistinctNoSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a';");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here


    @Test
    public void testQueryDistinctWithSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a' as (url,hitCount);");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here

    @Test
    public void testQueryDistinctNoSchema() {
        planTester.buildPlan("a = load 'a';");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here

    @Test
    public void testQueryDistinctWithSchema() {
        planTester.buildPlan("a = load 'a' as (url,hitCount);");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here

        fillSchema(filter, node.attributes) ;
        return filter ;
    }

    private LODistinct createLODistinct(DotNode node, LogicalPlan plan) {
        LODistinct distinct = new LODistinct(plan, getKey(node.attributes)) ;
        fillSchema(distinct, node.attributes) ;
        return distinct ;
    }
View Full Code Here

    @Test
    public void testQueryDistinctNoSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a';");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here

    @Test
    public void testQueryDistinctWithSchema() throws FrontendException {
        planTester.buildPlan("a = load 'a' as (url,hitCount);");
        LogicalPlan lp = planTester.buildPlan("b = distinct a;");
       
        LODistinct distinct = (LODistinct)lp.getLeaves().get(0);
        List<RequiredFields> distinctRelevantFields0 = distinct.getRelevantInputs(0, 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields0.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields0.get(0).getFields().get(0).second == 0);
       
        List<RequiredFields> distinctRelevantFields1 = distinct.getRelevantInputs(0, 1);
        assertTrue(distinctRelevantFields1.get(0).getFields().size()==1);
        assertTrue(distinctRelevantFields1.get(0).getNeedAllFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getNeedNoFields()==false);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).first == 0);
        assertTrue(distinctRelevantFields1.get(0).getFields().get(0).second == 1);
View Full Code Here

TOP

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

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.