Package org.apache.pig

Examples of org.apache.pig.PigServer.openIterator()


            "B = foreach A generate minelogs(source) as sportslogs;" };
        PigServer ps = new PigServer(ExecType.LOCAL);
        for (String line : queryLines) {
            ps.registerQuery(line);
        }
        Iterator<Tuple> it = ps.openIterator("B");
        int[] expectedResults = new int[] {2,0,1,0,0};
        int i = 0;
        while(it.hasNext()) {
            Tuple t = it.next();
            assertEquals(expectedResults[i++], t.get(0));
View Full Code Here


    PigServer pig = new PigServer(LOCAL);
    filename = filename.replace("\\", "\\\\");
    patternString = patternString.replace("\\", "\\\\");
    String query = "A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.XMLLoader('property') as (doc:chararray);";
    pig.registerQuery(query);
    Iterator<?> it = pig.openIterator("A");
    int tupleCount = 0;
    while (it.hasNext()) {
      Tuple tuple = (Tuple) it.next();
      if (tuple == null)
        break;
View Full Code Here

    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '"
    + datePartitionedDir.getAbsolutePath() + "' using "
    + funcSpecString + ";");
  Iterator<Tuple> result = server.openIterator("a");

  while ((result.next()) != null) {
      count++;
  }
View Full Code Here

    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '"
    + datePartitionedDir.getAbsolutePath() + "' using "
    + funcSpecString + ";");
  Iterator<Tuple> result = server.openIterator("a");

  while ((result.next()) != null) {
      count++;
  }
View Full Code Here

        String filename = TestHelper.createTempFile(data, "");
        ArrayList<DataByteArray[]> expected = TestHelper.getExpected(data, pattern);
       
        pigServer.registerQuery("A = LOAD 'file:" + Util.encodeEscape(filename) +
                "' USING " + DummyRegExLoader.class.getName() + "() AS (key, val);");
        Iterator<?> it = pigServer.openIterator("A");
        int tupleCount = 0;
        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
            if (tuple == null)
              break;
View Full Code Here

        dataE.add(new String[] { "3,three;iii" });
         ArrayList<DataByteArray[]> expected = TestHelper.getExpected(dataE, pattern2);
       
        pigServer.registerQuery("A = LOAD 'file:" + Util.encodeEscape(filename) +
                "' USING " + DummyRegExLoader2.class.getName() + "() AS (key, val);");
        Iterator<?> it = pigServer.openIterator("A");
        int tupleCount = 0;
        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
            if (tuple == null)
              break;
View Full Code Here

    public void testLoadFromPigServer() throws Exception {
        String filename = TestHelper.createTempFile(data, " ");
        PigServer pig = new PigServer(ExecType.LOCAL);
        filename = filename.replace("\\", "\\\\");
        pig.registerQuery("A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.apachelog.CombinedLogLoader();");
        Iterator<?> it = pig.openIterator("A");

        int tupleCount = 0;

        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
View Full Code Here

    public void testLoadFromPigServer() throws Exception {
        String filename = TestHelper.createTempFile(data, " ");
        PigServer pig = new PigServer(ExecType.LOCAL);
        filename = filename.replace("\\", "\\\\");
        pig.registerQuery("A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.apachelog.CommonLogLoader();");
        Iterator<?> it = pig.openIterator("A");

        int tupleCount = 0;

        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
View Full Code Here

    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '" + singlePartitionedFile + "' using "
    + funcSpecString + ";");

  Iterator<Tuple> result = server.openIterator("a");

  int count = 0;
  Tuple t = null;
  while ((t = result.next()) != null) {
      assertEquals(3, t.size());
View Full Code Here

  server.registerQuery("a = LOAD '" + singlePartitionedDir + "' using "
    + funcSpecString + ";");

  server.registerQuery("b = foreach a generate f1;");

  Iterator<Tuple> result = server.openIterator("b");

  int count = 0;
  Tuple t = null;
  while ((t = result.next()) != null) {
      assertEquals(1, t.size());
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.