Examples of exec()


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

   public void testgetExponent() throws Exception{
       EvalFunc<DataAtom> getExponent = new getExponent();
          Tuple tup = new Tuple(1);
          tup.setField(0, -0.5);
          DataAtom output = new DataAtom();
          getExponent.exec(tup, output);
          double expected = Math.getExponent(-0.5);
          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
   }
  
View Full Code Here

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

          EvalFunc<DataAtom> nextAfter = new nextAfter();
          Tuple tup = new Tuple(2);
          tup.setField(0, -0.5);
          tup.setField(1,0.6);
          DataAtom output = new DataAtom();
          nextAfter.exec(tup, output);
          double expected = Math.nextAfter(-0.5,0.6);
          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
      }
  
View Full Code Here

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

   public void testtoDegree() throws Exception{
       EvalFunc<DataAtom> toDegrees = new toDegrees();
          Tuple tup = new Tuple(1);
          tup.setField(0, 0.5);
          DataAtom output = new DataAtom();
          toDegrees.exec(tup, output);
          double expected = Math.toDegrees(0.5);
          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
   }
  
View Full Code Here

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

   public void testtoRadians() throws Exception{
       EvalFunc<DataAtom> toRadians = new toRadians();
          Tuple tup = new Tuple(1);
          tup.setField(0, 0.5);
          DataAtom output = new DataAtom();
          toRadians.exec(tup, output);
          double expected = Math.toRadians(0.5);
          double actual = (new Double(output.strval())).doubleValue();
          assertEquals(actual, expected, delta);
   }
  
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.stats.COR.exec()

    dBag1.add(tup1);
    Tuple input = new Tuple(2);
    input.setField(0, dBag);
    input.setField(1, dBag1);
    DataBag output = new DefaultDataBag();
    COR.exec(input, output);
    Iterator<Tuple> it = output.iterator();
    Tuple ans = (Tuple) it.next();
    assertEquals(ans.getAtomField(0).toString(),"a");
    assertEquals(ans.getAtomField(1).toString(),"b");
    assertEquals(0.582222509739582, ans.getAtomField(2).numval(),0.0005);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.stats.COV.exec()

    dBag1.add(tup1);
    Tuple input = new Tuple(2);
    input.setField(0, dBag);
    input.setField(1, dBag1);
    DataBag output = new DefaultDataBag();
    COV.exec(input, output);
    Iterator<Tuple> it = output.iterator();
    Tuple ans = (Tuple) it.next();
    assertEquals(ans.getAtomField(0).toString(),"a");
    assertEquals(ans.getAtomField(1).toString(),"b");
    assertEquals(1.11111, ans.getAtomField(2).numval(),0.0005);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.string.HashFNV1.exec()

        assertTrue(r==31);
        r = func2.exec(t3);
        assertTrue(r==null);
       
        HashFNV1 func1 = new HashFNV1();
        r = func1.exec(t4);
        assertTrue(r==1669505231);
    }
}
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.string.HashFNV2.exec()

       
        Tuple t4 = TupleFactory.getInstance().newTuple(1);
        t4.set(0, "024ulhl0dq1tl&b=2");
       
        HashFNV2 func2 = new HashFNV2();
        Long r = func2.exec(t1);
        assertTrue(r==6228);
        r = func2.exec(t2);
        assertTrue(r==31);
        r = func2.exec(t3);
        assertTrue(r==null);
View Full Code Here

Examples of org.apache.pig.piggybank.evaluation.string.RegexExtract.exec()

        t3.set(1, "^\\/search\\/iy\\/(.*?)\\/.*");
        t3.set(2, 2);

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

Examples of org.apache.pig.piggybank.evaluation.string.RegexExtractAll.exec()

        Tuple t3 = tupleFactory.newTuple(2);
        t3.set(0, null);
        t3.set(1, matchRegex);
    
        RegexExtractAll func = new RegexExtractAll();
        Tuple r = func.exec(t1);
        assertEquals(r.size(), 2);
        assertEquals("this", r.get(0));
        assertEquals("match", r.get(1));
       
        r = func.exec(t2);
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.