Examples of PigTest


Examples of org.apache.pig.pigunit.PigTest

public class QuantileTests  extends PigTests
{
  @Test
  public void quantileTest() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/quantileTest.pig",
                                 "QUANTILES='0.0','0.25','0.5','0.75','1.0'");

    String[] input = {"1","2","3","4","10","5","6","7","8","9"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(1.0,3.0,5.5,8.0,10.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void quantile2Test() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/quantileTest.pig",
                                 "QUANTILES='5'");

    String[] input = {"1","2","3","4","10","5","6","7","8","9"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(1.0,3.0,5.5,8.0,10.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void medianTest() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/medianTest.pig");

    String[] input = {"4","5","6","9","10","7","8","2","3","1"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(5.5)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

  }
 
  @Test
  public void streamingMedianTest() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/streamingMedianTest.pig");

    String[] input = {"0","4","5","6","9","10","7","8","2","3","1"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(5.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

    assertEquals(output.get(0).toString(), "(5.0)");
  }

  @Test
  public void streamingQuantileTest() throws Exception {
    PigTest test = createPigTest("datafu/stats/streamingQuantileTest.pig",
                                 "QUANTILES='5'");

    String[] input = {"1","2","3","4","10","5","6","7","8","9"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(1.0,3.0,5.0,8.0,10.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

    assertEquals(output.get(0).toString(), "(1.0,3.0,5.0,8.0,10.0)");
  }
 
  @Test
  public void streamingQuantile2Test() throws Exception {
    PigTest test = createPigTest("datafu/stats/streamingQuantileTest.pig",
                                 "QUANTILES='0.5','0.75','1.0'");

    String[] input = {"1","2","3","4","10","5","6","7","8","9"};
    writeLinesToFile("input", input);
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(5.0,8.0,10.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

    assertEquals(output.get(0).toString(), "(5.0,8.0,10.0)");
  }
 
  @Test
  public void streamingQuantile3Test() throws Exception {
    PigTest test = createPigTest("datafu/stats/streamingQuantileTest.pig",
                                 "QUANTILES='0.07','0.03','0.37','1.0','0.0'");

    List<String> input = new ArrayList<String>();
    for (int i=1000; i>=1; i--)
    {
      input.add(Integer.toString(i));
    }
   
    writeLinesToFile("input", input.toArray(new String[0]));
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(70.0,30.0,370.0,1000.0,1.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

    assertEquals(output.get(0).toString(), "(70.0,30.0,370.0,1000.0,1.0)");
  }
 
  @Test
  public void streamingQuantile4Test() throws Exception {
    PigTest test = createPigTest("datafu/stats/streamingQuantileTest.pig",
                                 "QUANTILES='0.0013','0.0228','0.1587','0.5','0.8413','0.9772','0.9987'");

    List<String> input = new ArrayList<String>();
    for (int i=100000; i>=0; i--)
    {
      input.add(Integer.toString(i));
    }
   
    writeLinesToFile("input", input.toArray(new String[0]));
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(130.0,2280.0,15870.0,50000.0,84130.0,97720.0,99870.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

 

 
  @Test
  public void quantile3Test() throws Exception {
    PigTest test = createPigTest("datafu/stats/quantileTest.pig",
                                 "QUANTILES='0.0013','0.0228','0.1587','0.5','0.8413','0.9772','0.9987'");

    List<String> input = new ArrayList<String>();
    for (int i=100000; i>=0; i--)
    {
      input.add(Integer.toString(i));
    }
   
    writeLinesToFile("input", input.toArray(new String[0]));
       
    test.runScript();
   
    List<Tuple> output = getLinesForAlias(test, "data_out", true);
   
    assertEquals(output.size(),1);
    assertEquals(output.get(0).toString(), "(130.0,2280.0,15870.0,50000.0,84130.0,97720.0,99870.0)");
View Full Code Here

Examples of org.apache.pig.pigunit.PigTest

public class MarkovPairTests extends PigTests
{
  @Test
  public void markovPairDefaultTest() throws Exception
  {
    PigTest test = createPigTest("datafu/stats/markovPairDefault.pig",
                                 "schema=(data: bag {t: tuple(val:int)})");
   
    writeLinesToFile("input", "{(10),(20),(30),(40),(50),(60)}");
   
    String[] expectedOutput = {
        "({((10),(20)),((20),(30)),((30),(40)),((40),(50)),((50),(60))})"
      };
   
    test.runScript();
   
    Iterator<Tuple> actualOutput = test.getAlias("data_out");
   
    assertTuplesMatch(expectedOutput, actualOutput);
  }
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.