Examples of LogicalPlan


Examples of org.apache.drill.common.logical.LogicalPlan

public class Simple {
  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Simple.class);
 
  public static void main(String[] args) throws Exception {
    DrillConfig c = DrillConfig.create();
    LogicalPlan plan = LogicalPlan.parse(c, FileUtils.getResourceAsString("/jdbc_plan.json"));
    System.out.println(plan.toJsonString(c));
  }
View Full Code Here

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

    LogicalRelationalOperator filter = null;
    LogicalRelationalOperator join = null;
    LogicalRelationalOperator store = null;   
   
    private void prep() {
        plan = new LogicalPlan();
        LogicalSchema schema = new LogicalSchema();
        schema.addField(new LogicalSchema.LogicalFieldSchema("id", null, DataType.INTEGER));
        schema.addField(new LogicalSchema.LogicalFieldSchema("name", null, DataType.CHARARRAY));
        schema.addField(new LogicalSchema.LogicalFieldSchema("age", null, DataType.INTEGER));   
        schema.getField(0).uid = 1;
View Full Code Here

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

            this.batchMode = batchMode;
            this.processedStores = 0;
            this.ignoreNumStores = 0;
            this.jobName = pigContext.getProperties().getProperty(PigContext.JOB_NAME,
                                                                  PigContext.JOB_NAME_PREFIX+":DefaultJobName");
            this.lp = new LogicalPlan();
        };
View Full Code Here

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

        public void setJobPriority(String priority){
            jobPriority = priority;
        }

        LogicalPlan getPlan(String alias) throws IOException {
            LogicalPlan plan = lp;
               
            if (alias != null) {
                LogicalOperator op = aliasOp.get(alias);
                if(op == null) {
                    int errCode = 1003;
View Full Code Here

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

            return plan;
        }

        void registerQuery(String query, int startLine) throws IOException {
           
            LogicalPlan tmpLp = parseQuery(query, startLine);
           
            // store away the query for use in cloning later
            scriptCache.add(query);
            if (tmpLp.getLeaves().size() == 1) {
                LogicalOperator op = tmpLp.getSingleLeafPlanOutputOp();
               
                // Check if we just processed a LOStore i.e. STORE
                if (op instanceof LOStore) {

                    if (!batchMode) {
                        lp = tmpLp;
                        try {
                            execute();
                        } catch (Exception e) {
                            int errCode = 1002;
                            String msg = "Unable to store alias "
                                    + op.getOperatorKey().getId();
                            throw new FrontendException(msg, errCode,
                                    PigException.INPUT, e);
                        }
                    } else {
                        if (0 == ignoreNumStores) {
                            storeOpTable.put((LOStore)op, tmpLp);
                            lp.mergeSharedPlan(tmpLp);
                            List<LogicalOperator> roots = tmpLp.getRoots();
                            for (LogicalOperator root : roots) {
                                if (root instanceof LOLoad) {
                                    loadOps.add((LOLoad)root);
                                }
                            }
View Full Code Here

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

    }

    @Test
    public void testLimit() throws VisitorException, IOException {
        String query = "limit (load 'a') 5;";
        LogicalPlan plan = buildPlan(query);
        PhysicalPlan pp = buildPhysicalPlan(plan);

        int MAX_SIZE = 100000;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        pp.explain(baos);
View Full Code Here

Examples of org.apache.pig.newplan.logical.relational.LogicalPlan

        planTester.buildPlan("A = load 'myfile' as (name, age, gpa);");
        planTester.buildPlan("B = foreach A generate $1, $2;");       
        planTester.buildPlan("C = filter B by " + Identity.class.getName() + "($1) ;");
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = planTester.buildPlan( "D = STORE C INTO 'empty';" );

        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator fe = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( fe instanceof LOForEach );
        Operator store = newLogicalPlan.getSuccessors( fe ).get( 0 );
        Assert.assertTrue( store instanceof LOStore );
    }
View Full Code Here

Examples of org.apache.pig.newplan.logical.relational.LogicalPlan

        planTester.buildPlan("A = load 'myfile' as (name, age, gpa);");
        planTester.buildPlan("B = foreach A generate $1, flatten($2);");       
        planTester.buildPlan("C = filter B by $0 < 18;");
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = planTester.buildPlan( "D = STORE C INTO 'empty';" );

        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator fe = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( fe instanceof LOForEach );
        Operator store = newLogicalPlan.getSuccessors( fe ).get( 0 );
        Assert.assertTrue( store instanceof LOStore );
    }
View Full Code Here

Examples of org.apache.pig.newplan.logical.relational.LogicalPlan

        planTester.buildPlan("c = foreach b generate AVG(a.age) as age;");
        planTester.buildPlan("d = foreach a generate name, age;");
        planTester.buildPlan("e = filter d by age > c.age;");
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = planTester.buildPlan("f = store e into 'empty';");

        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator store = newLogicalPlan.getSinks().get( 0 );
        Operator foreach = newLogicalPlan.getPredecessors(store).get(0);
        Assert.assertTrue( foreach instanceof LOForEach );
    }
View Full Code Here

Examples of org.apache.pig.newplan.logical.relational.LogicalPlan

        planTester.buildPlan("data = LOAD 'data.txt' as (referrer:chararray, canonical_url:chararray, ip:chararray);");
        planTester.buildPlan("best_url = FOREACH data GENERATE ((canonical_url != '' and canonical_url is not null) ? canonical_url : referrer) AS url, ip;");
        planTester.buildPlan("filtered = FILTER best_url BY url == 'badsite.com';");
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = planTester.buildPlan("store filtered into 'empty';");

        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator store = newLogicalPlan.getSinks().get( 0 );
        Operator filter = newLogicalPlan.getPredecessors(store).get(0);
        Assert.assertTrue( filter instanceof LOFilter );
    }
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.