Package org.apache.pig.data

Examples of org.apache.pig.data.TupleFactory.newTuple()


            // create a new POCast each time since we
            // maintain a state variable per POCast object
            // indicating if cast is really required
            POCast newOp = new POCast(new OperatorKey("", r.nextLong()), -1);
            plan = constructPlan(newOp);
            Tuple t = tf.newTuple();
            Double input = new Double(r.nextDouble());
            t.append(input);
            plan.attachInput(t);
            Result res = newOp.getNext(new Double(0));
            if(res.returnStatus == POStatus.STATUS_OK) {
View Full Code Here


            // create a new POCast each time since we
            // maintain a state variable per POCast object
            // indicating if cast is really required
            POCast newOp = new POCast(new OperatorKey("", r.nextLong()), -1);
            plan = constructPlan(newOp);
            Tuple t = tf.newTuple();
            Tuple input = GenRandomData.genRandSmallTuple("test", 1);
            t.append(input);
            plan.attachInput(t);
            Result res = newOp.getNext(tf.newTuple());
            if(res.returnStatus == POStatus.STATUS_OK) {
View Full Code Here

            plan = constructPlan(newOp);
            Tuple t = tf.newTuple();
            Tuple input = GenRandomData.genRandSmallTuple("test", 1);
            t.append(input);
            plan.attachInput(t);
            Result res = newOp.getNext(tf.newTuple());
            if(res.returnStatus == POStatus.STATUS_OK) {
                //System.out.println(res.result + " : " + str);
                assertEquals(input, res.result);
            }
        }
View Full Code Here

            // create a new POCast each time since we
            // maintain a state variable per POCast object
            // indicating if cast is really required
            POCast newOp = new POCast(new OperatorKey("", r.nextLong()), -1);
            plan = constructPlan(newOp);
            Tuple t = tf.newTuple();
            DataBag input = GenRandomData.genRandSmallTupDataBag(r, 10, 100);
            t.append(input);
            plan.attachInput(t);
            Result res = newOp.getNext(DefaultBagFactory.getInstance().newDefaultBag());
            if(res.returnStatus == POStatus.STATUS_OK) {
View Full Code Here

        t.set(1, new Integer(1));
        result = d.exec(t);
        assertEquals(0, result.size());

        // Test it in the case of two objects that are not equal
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(2));
        result = d.exec(t);
        assertEquals(2, result.size());
    }
View Full Code Here

            // create a new POCast each time since we
            // maintain a state variable per POCast object
            // indicating if cast is really required
            POCast newOp = new POCast(new OperatorKey("", r.nextLong()), -1);
            plan = constructPlan(newOp);
            Tuple t = tf.newTuple();
            Map<String, Object> input = new HashMap<String, Object>();
            input.put("key1", "value1");
            input.put("key2", "value2");
            t.append(input);
            plan.attachInput(t);
View Full Code Here

    //for example casting of values coming out of map lookup.
    POCast opWithInputTypeAsBA = new POCast(new OperatorKey("", r.nextLong()), -1);
    PhysicalPlan planToTestBACasts = constructPlan(opWithInputTypeAsBA);
   
    {
      Tuple t = tf.newTuple();
      t.append(GenRandomData.genRandString(r));
      Tuple tNew = tf.newTuple();
      tNew.append(t);
      plan.attachInput(tNew);
      Map map = null;
View Full Code Here

    PhysicalPlan planToTestBACasts = constructPlan(opWithInputTypeAsBA);
   
    {
      Tuple t = tf.newTuple();
      t.append(GenRandomData.genRandString(r));
      Tuple tNew = tf.newTuple();
      tNew.append(t);
      plan.attachInput(tNew);
      Map map = null;
      Result res = op.getNext(map);
      assertEquals(POStatus.STATUS_ERR, res.returnStatus);
View Full Code Here

      Result res = op.getNext(map);
      assertEquals(POStatus.STATUS_ERR, res.returnStatus);
    }
   
    {
      Tuple t = tf.newTuple();
      t.append(GenRandomData.genRandString(r));
      Tuple tNew = tf.newTuple();
      tNew.append(t);
      plan.attachInput(tNew);
      Result res = op.getNext(t);
View Full Code Here

    }
   
    {
      Tuple t = tf.newTuple();
      t.append(GenRandomData.genRandString(r));
      Tuple tNew = tf.newTuple();
      tNew.append(t);
      plan.attachInput(tNew);
      Result res = op.getNext(t);
      //System.out.println(res.result + " : " + t);
      assertEquals(t, res.result);
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.