Package cascading.tuple

Examples of cascading.tuple.TupleEntryIterator


    Tap<JobConf, RecordReader, OutputCollector> dst = new Lfs(new SequenceFile(OUT_FIELD), getTestRoot()+"/out");

    Flow f = CascadingUtil.get().getFlowConnector().connect(src, dst, pipe);
    f.complete();

    TupleEntryIterator tupleEntryIterator = dst.openForRead(CascadingUtil.get().getFlowProcess());
    List<BytesWritable> outStrings = new ArrayList<BytesWritable>(6);
    while (tupleEntryIterator.hasNext()) {
      TupleEntry next = tupleEntryIterator.next();
      BytesWritable bytes = (BytesWritable) next.getObject(OUT_FIELD);
      outStrings.add(bytes);
    }

    assertEquals(outStrings,
View Full Code Here


        new CustomBuffer(new Fields("result", " result1", "result2", "result3", "result4", "result5")));
    results = new Each(results, new Fields("key"), new FilterNull());

    CascadingUtil.get().getFlowConnector().connect(sources, sink, results).complete();

    TupleEntryIterator iter = sink.openForRead(CascadingUtil.get().getFlowProcess());

    assertEquals(new Tuple(1, 108, 108, 108, 108, 108, 108), iter.next().getTuple());
    assertEquals(new Tuple(2, 5, 5, 5, 5, 5, 5), iter.next().getTuple());
    assertEquals(new Tuple(3, 6, 6, 6, 6, 6, 6), iter.next().getTuple());
    assertEquals(new Tuple(5, 7, 7, 7, 7, 7, 7), iter.next().getTuple());

    assertFalse(iter.hasNext());
  }
View Full Code Here

    Pipe results = new MultiGroupBy(s1, new Fields("key"), s2, new Fields("key"),
        new Fields("key-rename"), new CustomBuffer(new Fields("result", " result1", "result2", "result3", "result4", "result5")));

    CascadingUtil.get().getFlowConnector().connect(sources, sink, results).complete();

    TupleEntryIterator iter = sink.openForRead(CascadingUtil.get().getFlowProcess());

    assertEquals(new Tuple(1, 108, 108, 108, 108, 108, 108), iter.next().getTuple());
    assertEquals(new Tuple(2, 5, 5, 5, 5, 5, 5), iter.next().getTuple());
    assertEquals(new Tuple(3, 6, 6, 6, 6, 6, 6), iter.next().getTuple());
    assertEquals(new Tuple(5, 7, 7, 7, 7, 7, 7), iter.next().getTuple());

    assertFalse(iter.hasNext());
  }
View Full Code Here

    Pipe results = new MultiGroupBy(s1, new Fields("key"), s2, new Fields("key"),
        new Fields("key-rename"), new CustomBuffer(new Fields("result")));

    CascadingUtil.get().getFlowConnector().connect(sources, sink, results).complete();

    TupleEntryIterator iter = sink.openForRead(CascadingUtil.get().getFlowProcess());

    assertEquals(new Tuple(1, 108), iter.next().getTuple());
    assertEquals(new Tuple(2, 5), iter.next().getTuple());
    assertEquals(new Tuple(3, 6), iter.next().getTuple());
    assertEquals(new Tuple(5, 7), iter.next().getTuple());

    assertFalse(iter.hasNext());
  }
View Full Code Here

    }
    collector.close();
  }

  public static List<TupleEntry> getAllTupleEntries(Tap<JobConf, ?, ?> t) throws IOException {
    TupleEntryIterator iter = t.openForRead(CascadingUtil.get().getFlowProcess());
    List<TupleEntry> tuples = new ArrayList<TupleEntry>();
    while (iter.hasNext()) {
      tuples.add(new TupleEntry(iter.next()));
    }
    return tuples;
  }
View Full Code Here

  public static List<Tuple> getAllTuples(Tap<JobConf, ?, ?> t) throws IOException {
    return getAllTuples(t, CascadingUtil.get().getFlowProcess());
  }

  public static List<Tuple> getAllTuples(Tap<JobConf, ?, ?> t, FlowProcess<JobConf> conf) throws IOException {
    TupleEntryIterator iter = t.openForRead(conf);
    List<Tuple> tuples = new ArrayList<Tuple>();
    while (iter.hasNext()) {
      tuples.add(iter.next().getTupleCopy());
    }
    return tuples;
  }
View Full Code Here

    return getConnection().createStatement().executeUpdate( sql );
    }

  protected void assertTableValuesEqual( String tableName, String sqlQuery ) throws Exception
    {
    TupleEntryIterator entryIterator = getTable( tableName );
    Table expectedTable = createTable( entryIterator, true );

    assertTableValuesEqual( expectedTable, sqlQuery );
    }
View Full Code Here

    assertTableValuesEqual( expectedTable, sqlQuery );
    }

  protected void assertTablesEqual( String tableName, String sqlQuery ) throws Exception
    {
    TupleEntryIterator entryIterator = getTable( tableName );
    Table expectedTable = createTable( entryIterator );

    assertTablesEqual( expectedTable, sqlQuery );
    }
View Full Code Here

    assertNull( "should not have gotten connection", connection6 );
    }

  protected void assertTablesEqual( String tableName, String sqlQuery, boolean closeConnection, boolean expectSuccess ) throws Exception
    {
    TupleEntryIterator entryIterator = getTable( tableName );
    Table expectedTable = createTable( entryIterator );

    assertTablesEqual( expectedTable, sqlQuery, closeConnection, expectSuccess );
    }
View Full Code Here

    Flow flow = flowConnector.connect( flowDef );

    flow.complete();

    TupleEntryIterator iterator = resultsTap.openForRead( flow.getFlowProcess() );

    while( iterator.hasNext() )
      System.out.println( iterator.next() );

    iterator.close();
    }
View Full Code Here

TOP

Related Classes of cascading.tuple.TupleEntryIterator

Copyright © 2018 www.massapicom. 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.