Examples of POProject


Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

        attachBinaryComparisonOperator(op, exprOp);
    }
   
    @Override
    public void visit(ProjectExpression op) throws FrontendException {
        POProject exprOp;
      
        if(op.getAttachedRelationalOp() instanceof LOGenerate && op.getPlan().getSuccessors(op)==null &&
            !(op.findReferent() instanceof LOInnerLoad)) {
            exprOp = new PORelationToExprProject(new OperatorKey(DEFAULT_SCOPE, nodeGen
                .getNextNodeId(DEFAULT_SCOPE)));
         } else {
            exprOp = new POProject(new OperatorKey(DEFAULT_SCOPE, nodeGen
                .getNextNodeId(DEFAULT_SCOPE)));
        }
       
        exprOp.setResultType(op.getType());
        exprOp.setColumn(op.getColNum());
        exprOp.setStar(op.isProjectStar());
        // TODO implement this
//        exprOp.setOverloaded(op.getOverloaded());
        logToPhyMap.put(op, exprOp);
        currentPlan.add(exprOp);       
    }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

        }
    }
   
    @Override
    public void visit( DereferenceExpression op ) throws FrontendException {
        POProject exprOp = new POProject(new OperatorKey(DEFAULT_SCOPE, nodeGen
                .getNextNodeId(DEFAULT_SCOPE)));

        exprOp.setResultType(op.getType());
        exprOp.setColumns((ArrayList<Integer>)op.getBagColumns());       
        exprOp.setStar(false);
        logToPhyMap.put(op, exprOp);
        currentPlan.add(exprOp);
       
        PhysicalOperator from = logToPhyMap.get( op.getReferredExpression() );
       
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

  Map<String, Object> map;// = GenRandomData.genRandMap(r, 10);
 
  @Test
  public void testMapLookUp() throws PlanException, ExecException {
   
    POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
    POMapLookUp op = new POMapLookUp(new OperatorKey("", r.nextLong()), -1);
    PhysicalPlan plan = new PhysicalPlan();
    plan.add(op);
    plan.add(prj);
    plan.connect(prj, op);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

        @Test
  public void testCast() throws ExecException {

    POCast cast = new POCast(newOperatorKey(), -1);
    POProject proj = new POProject(newOperatorKey(), -1, 0);
    proj.setResultType(DataType.CHARARRAY);
    List<PhysicalOperator> inputs = new ArrayList<PhysicalOperator>();
    inputs.add(proj);
    cast.setInputs(inputs);

    // cast to double
    String[] items = { "12.0", "-13.2", "0.1f", "1.3e2", "zjf",
        MaxDouble.toString(), MinDouble.toString() };
    Double[] doubleExpected = { 12.0, -13.2, 0.1, 1.3e2, null, MaxDouble,
        MinDouble };
    for (int i = 0; i < items.length; ++i) {
      Tuple tuple = TupleFactory.getInstance().newTuple(1);
      tuple.set(0, items[i]);
      proj.attachInput(tuple);
      Double actual = (Double) cast.getNext(dummyDouble).result;
      if (doubleExpected[i] != null) {
        assertEquals(doubleExpected[i], actual, 1e-6);
      } else {
        assertNull(actual);
      }
    }

    // cast to float
    items = new String[] { "12.0", "-13.2", "0.1f", "1.3e2",
        MaxFloat.toString(), MinFloat.toString(), "zjf" };
    Float[] floatExpected = { 12.0f, -13.2f, 0.1f, 1.3e2f, MaxFloat,
        MinFloat, null };
    for (int i = 0; i < items.length; ++i) {
      Tuple tuple = TupleFactory.getInstance().newTuple(1);
      tuple.set(0, items[i]);
      proj.attachInput(tuple);
      Float actual = (Float) cast.getNext(dummyFloat).result;
      if (floatExpected[i] != null) {
        assertEquals(floatExpected[i], actual, 1e-6);
      } else {
        assertNull(actual);
      }
    }

    // cast to long
    items = new String[] { "1", "-1", "12.2", "12.8", MaxLong.toString(),
        MinLong.toString(), "df1.2" };
    Long[] longExpected = { 1L, -1L, 12L, 12L, MaxLong, MinLong, null };
    for (int i = 0; i < items.length; ++i) {
      Tuple tuple = TupleFactory.getInstance().newTuple(1);
      tuple.set(0, items[i]);
      proj.attachInput(tuple);
      Long actual = (Long) cast.getNext(dummyLong).result;
      if (longExpected[i] != null) {
        assertEquals(longExpected[i], actual);
      } else {
        assertNull(actual);
      }
    }

    // cast to int
    items = new String[] { "1", "-1", "12.2", "12.8",
        MaxInteger.toString(), MinInteger.toString(), "ff4332" };
    Integer[] intExpected = { 1, -1, 12, 12, MaxInteger, MinInteger, null };
    for (int i = 0; i < items.length; ++i) {
      Tuple tuple = TupleFactory.getInstance().newTuple(1);
      tuple.set(0, items[i]);
      proj.attachInput(tuple);
      Integer actual = (Integer) cast.getNext(dummyInteger).result;
      if (intExpected[i] != null) {
        assertEquals(intExpected[i], actual);
      } else {
        assertNull(actual);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

            Tuple t = tf.newTuple();
            t.append(r.nextInt());
            bag.add(t);
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.INTEGER);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.INTEGER);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

              t.append(null);
              bag.add(t);
            }
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.INTEGER);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.INTEGER);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

            Tuple t = tf.newTuple();
            t.append(r.nextLong());
            bag.add(t);
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.LONG);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.LONG);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

              t.append(null);
              bag.add(t);
            }
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.LONG);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.LONG);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

            Tuple t = tf.newTuple();
            t.append(r.nextDouble());
            bag.add(t);
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.DOUBLE);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.DOUBLE);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject

              t.append(null);
              bag.add(t);
            }
        }
       
        POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
        prj.setResultType(DataType.DOUBLE);
        PONegative pn = new PONegative(new OperatorKey("", r.nextLong()), -1, prj);
        pn.setResultType(DataType.DOUBLE);
       
        PhysicalPlan plan = new PhysicalPlan();
        plan.add(prj); plan.add(pn);
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.