Package org.apache.pig.experimental.logical.relational

Examples of org.apache.pig.experimental.logical.relational.LOCogroup


       
        uids.add(Long.valueOf( schema.getField(0).uid ) );
        assertEquals( false, uids.contains( schema.getField(1).uid ) );
       
        assertEquals( LOCogroup.class, newPlan.getSuccessors(newPlan.getSources().get(0)).get(0).getClass() );
        LOCogroup cogroup = (LOCogroup) newPlan.getSuccessors(newPlan.getSources().get(0)).get(0);
       
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cogroup.getExpressionPlans();
        assertEquals( 1, expressionPlans.size() );
        List<LogicalExpressionPlan> plans = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(0));
        assertEquals( 1, plans.size() );
       
        LogicalExpressionPlan exprPlan = plans.get(0);
View Full Code Here


        assertEquals( false, uids.contains( schema.getField(0).schema.getField(1).uid ) );
        uids.add( Long.valueOf( schema.getField(0).schema.getField(1).uid ) );       
        assertEquals( false, uids.contains( schema.getField(1).uid ) );
       
        assertEquals( LOCogroup.class, newPlan.getSuccessors(newPlan.getSources().get(0)).get(0).getClass() );
        LOCogroup cogroup = (LOCogroup) newPlan.getSuccessors(newPlan.getSources().get(0)).get(0);
       
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cogroup.getExpressionPlans();
        assertEquals( 1, expressionPlans.size() );
        List<LogicalExpressionPlan> plans = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(0));
        assertEquals( 2, plans.size() );
       
        LogicalExpressionPlan exprPlan = plans.get(0);
View Full Code Here

       
        // check basics
        org.apache.pig.experimental.logical.relational.LogicalPlan newPlan = migratePlan(plan);
       
        assertEquals( LOCogroup.class, newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0).getClass() );
        LOCogroup cogroup = (LOCogroup) newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0);
       
        // Reason for this strange way of getting the load schema is to maintain the sequence correctly       
        LogicalSchema loadSchema =
            ((LogicalRelationalOperator)newPlan.getPredecessors(cogroup).get(0)).getSchema();
       
        LogicalSchema load2Schema =
            ((LogicalRelationalOperator)newPlan.getPredecessors(cogroup).get(1)).getSchema();
       
        Set<Long> uids = getAllUids(loadSchema);
        uids.addAll( getAllUids( load2Schema ) );
       
        LogicalRelationalOperator op = (LogicalRelationalOperator)
            newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0);
        assertEquals( LOCogroup.class, op.getClass() );
        LogicalSchema schema = op.getSchema();
       
        assertEquals( 3, schema.size() );
        assertEquals( DataType.CHARARRAY, schema.getField(0).type );
        assertEquals( false, uids.contains( schema.getField(0).uid ) );
        assertEquals( 0, schema.getField(0).alias.compareTo("group") );

        assertEquals( DataType.BAG, schema.getField(1).type );
       
        assertEquals( DataType.CHARARRAY, schema.getField(1).schema.getField(0).type );
        assertEquals( 0, schema.getField(1).schema.getField(0).alias.compareTo("name") );
        assertEquals( loadSchema.getField(0).uid, schema.getField(1).schema.getField(0).uid );
        assertEquals( DataType.INTEGER, schema.getField(1).schema.getField(1).type );
        assertEquals( 0, schema.getField(1).schema.getField(1).alias.compareTo("age") );
        assertEquals( loadSchema.getField(1).uid, schema.getField(1).schema.getField(1).uid );
        assertEquals( DataType.FLOAT, schema.getField(1).schema.getField(2).type );
        assertEquals( 0, schema.getField(1).schema.getField(2).alias.compareTo("gpa") );
        assertEquals( loadSchema.getField(2).uid, schema.getField(1).schema.getField(2).uid );
       
        assertEquals( DataType.BAG, schema.getField(2).type );
       
        assertEquals( DataType.CHARARRAY, schema.getField(2).schema.getField(0).type );
        assertEquals( 0, schema.getField(2).schema.getField(0).alias.compareTo("name") );
        assertEquals( load2Schema.getField(0).uid, schema.getField(2).schema.getField(0).uid );
        assertEquals( DataType.CHARARRAY, schema.getField(2).schema.getField(1).type );
        assertEquals( 0, schema.getField(2).schema.getField(1).alias.compareTo("blah") );
        assertEquals( load2Schema.getField(1).uid, schema.getField(2).schema.getField(1).uid );       
       
       
        // We are doing Uid tests at the end as the uids should not repeat               
        assertEquals( false, uids.contains( schema.getField(1).uid ) );
        uids.add( schema.getField(1).uid );
        assertEquals( false, uids.contains( schema.getField(2).uid) );
       
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cogroup.getExpressionPlans();
        assertEquals( 2, expressionPlans.size() );
        List<LogicalExpressionPlan> plans = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(0));
        assertEquals( 1, plans.size() );
       
        List<LogicalExpressionPlan> plans2 = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(1));
View Full Code Here

       
        // check basics
        org.apache.pig.experimental.logical.relational.LogicalPlan newPlan = migratePlan(plan);
       
        assertEquals( LOCogroup.class, newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0).getClass() );
        LOCogroup cogroup = (LOCogroup) newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0);
       
        // Reason for this strange way of getting the load schema is to maintain the sequence correctly       
        LogicalSchema loadSchema =
            ((LogicalRelationalOperator)newPlan.getPredecessors(cogroup).get(0)).getSchema();
       
        LogicalSchema load2Schema =
            ((LogicalRelationalOperator)newPlan.getPredecessors(cogroup).get(1)).getSchema();
       
        Set<Long> uids = getAllUids(loadSchema);
        uids.addAll( getAllUids( load2Schema ) );
       
        LogicalRelationalOperator op = (LogicalRelationalOperator)
            newPlan.getSuccessors( newPlan.getSources().get(0) ).get(0);
        assertEquals( LOCogroup.class, op.getClass() );
        LogicalSchema schema = op.getSchema();
       
        assertEquals( 3, schema.size() );
        assertEquals( DataType.TUPLE, schema.getField(0).type );
        assertEquals( false, uids.contains( schema.getField(0).uid ) );
        assertEquals( 0, schema.getField(0).alias.compareTo("group") );
        assertEquals( DataType.CHARARRAY, schema.getField(0).schema.getField(0).type );
        assertEquals( 0, schema.getField(0).schema.getField(0).alias.compareTo("name") );
        assertEquals( DataType.INTEGER, schema.getField(0).schema.getField(1).type );
        assertEquals( 0, schema.getField(0).schema.getField(1).alias.compareTo("age") );               
              

        assertEquals( DataType.BAG, schema.getField(1).type );
       
        assertEquals( DataType.CHARARRAY, schema.getField(1).schema.getField(0).type );
        assertEquals( 0, schema.getField(1).schema.getField(0).alias.compareTo("name") );
        assertEquals( loadSchema.getField(0).uid, schema.getField(1).schema.getField(0).uid );
        assertEquals( DataType.INTEGER, schema.getField(1).schema.getField(1).type );
        assertEquals( 0, schema.getField(1).schema.getField(1).alias.compareTo("age") );
        assertEquals( loadSchema.getField(1).uid, schema.getField(1).schema.getField(1).uid );
        assertEquals( DataType.FLOAT, schema.getField(1).schema.getField(2).type );
        assertEquals( 0, schema.getField(1).schema.getField(2).alias.compareTo("gpa") );
        assertEquals( loadSchema.getField(2).uid, schema.getField(1).schema.getField(2).uid );
       
        assertEquals( DataType.BAG, schema.getField(2).type );
       
        assertEquals( DataType.CHARARRAY, schema.getField(2).schema.getField(0).type );
        assertEquals( 0, schema.getField(2).schema.getField(0).alias.compareTo("name") );
        assertEquals( load2Schema.getField(0).uid, schema.getField(2).schema.getField(0).uid );
        assertEquals( DataType.INTEGER, schema.getField(2).schema.getField(1).type );
        assertEquals( 0, schema.getField(2).schema.getField(1).alias.compareTo("age") );
        assertEquals( load2Schema.getField(1).uid, schema.getField(2).schema.getField(1).uid );
        assertEquals( DataType.CHARARRAY, schema.getField(2).schema.getField(2).type );
        assertEquals( 0, schema.getField(2).schema.getField(2).alias.compareTo("blah") );
        assertEquals( load2Schema.getField(2).uid, schema.getField(2).schema.getField(2).uid );       
       
       
        // We are doing Uid tests at the end as the uids should not repeat
        assertEquals( false, uids.contains( schema.getField(0).schema.getField(0).uid ) );
        assertEquals( false, uids.contains( schema.getField(0).schema.getField(1).uid ) );
        assertEquals( false, uids.contains( schema.getField(1).uid ) );
        uids.add( schema.getField(1).uid );
        assertEquals( false, uids.contains( schema.getField(2).uid) );
       
       
        MultiMap<Integer, LogicalExpressionPlan> expressionPlans = cogroup.getExpressionPlans();
        assertEquals( 2, expressionPlans.size() );
        List<LogicalExpressionPlan> plans = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(0));
        assertEquals( 2, plans.size() );
       
        List<LogicalExpressionPlan> plans2 = (List<LogicalExpressionPlan>) expressionPlans.get(Integer.valueOf(1));
View Full Code Here

TOP

Related Classes of org.apache.pig.experimental.logical.relational.LOCogroup

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.