Examples of exec()


Examples of org.apache.pig.impl.builtin.PartitionSkewedKeys.exec()

            else
                sample.append((long)30);
            db.add(sample);
        }
        t.append(db);
        Map<String, Object> output = udf.exec(t);
        DataBag parList = (DataBag)output.get(PartitionSkewedKeys.PARTITION_LIST);
        for (Tuple par : parList) {
            if (par.get(0).equals("1")) {
                par.get(1).equals(0);
                par.get(2).equals(2);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.ExtremalTupleByNthField.exec()

    }

    Tuple tupleInput = TupleFactory.getInstance().newTuple();
    tupleInput.append(input);

    Tuple out = o.exec(tupleInput);

    Assert.assertEquals(" 1", (String) out.get(1));
  }

  @Test
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.datetime.DiffDate.exec()

        Tuple t4 = TupleFactory.getInstance().newTuple(2);
        t4.set(0, "20090608");
        t4.set(1, null);
       
        DiffDate func = new DiffDate();
        Integer r = func.exec(t1);
        assertTrue(r==-23);
       
        r = func.exec(t2);
        assertTrue(r==426);
       
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.datetime.convert.CustomFormatToISO.exec()

    public void testBadFormat() throws Exception {
        Tuple t1 = TupleFactory.getInstance().newTuple(2);
        t1.set(0, "2011-01-01");
        t1.set(1, "MMMM, yyyy");
        CustomFormatToISO convert = new CustomFormatToISO();
        assertNull("Input that doesn't match format should result in null", convert.exec(t1));
        t1.set(0, "July, 2012");
        assertEquals("Matching format should work correctly", "2012-07-01T00:00:00.000Z", convert.exec(t1));
    }

    @Test
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.datetime.convert.ISOToUnix.exec()

        // Verify that ISO string datetimes convert to Unix (long) datetimes
        Tuple t2 = TupleFactory.getInstance().newTuple(1);
        t2.set(0, "2009-01-07T01:07:01.000Z");
        ISOToUnix func2 = new ISOToUnix();
        Long unix = func2.exec(t2);

        assertTrue(unix == 1231290421000L);

    }
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO.exec()

        // Verify that (long) unix datetimes convert to ISO datetimes
        Tuple t1 = TupleFactory.getInstance().newTuple(1);
        t1.set(0, 1231290421000L);

        UnixToISO func = new UnixToISO();
        String iso = func.exec(t1);

        assertTrue(iso.equals("2009-01-07T01:07:01.000Z"));
    }

    @Test
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.decode.Bin.exec()

        Bin func = new Bin();
        String r = func.exec(t1);
        assertTrue(r.equals("young"));
       
        r = func.exec(t2);
        assertTrue(r.equals("M"));
       
        r = func.exec(t3);
        assertTrue(r==null);
       
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.decode.BinCond.exec()

        t3.set(4, true);
        t3.set(5, "s");
        t3.set(6, "n");
       
        BinCond func = new BinCond();
        String r = func.exec(t1);
        assertTrue(r.equals("s"));
        r = func.exec(t2);
        assertTrue(r==null);
        try {
            r = func.exec(t3);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.decode.Decode.exec()

        t4.set(3, 1);
        t4.set(4, "Engineering");
        t4.set(5, "Other");
       
        Decode func = new Decode();
        String r = func.exec(t1);
        assertTrue(r.equals("Engineering"));       
        r = func.exec(t2);
        assertTrue(r.equals("Other"));
        r = func.exec(t3);
        assertTrue(r==null);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.math.ABS.exec()

   public void testABS() throws Exception {
          EvalFunc<DataAtom> ABS = new ABS();
          Tuple tup = new Tuple(1);
          tup.setField(0, -1.0);
          DataAtom output = new DataAtom();
          ABS.exec(tup, output);
          double expected = 1.0;
          double actual = (new Double(output.strval())).doubleValue();
            assertEquals(actual, expected, delta);
      }
  
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.