Package cascading.scheme.hadoop

Examples of cascading.scheme.hadoop.SequenceFile


  private final String OUTPUT_PATH = getTestRoot() + "/output";

  @Test
  public void testMain() throws IOException {

    Hfs source = new Hfs(new SequenceFile(new Fields("key", "a", "b")), INPUT_PATH);
    TupleEntryCollector tc = source.openForWrite(CascadingUtil.get().getFlowProcess());
    tc.add(new Tuple("k0", 1, 1));
    tc.add(new Tuple("k0", 2, 5));
    tc.add(new Tuple("k1", 1, 7));
    tc.add(new Tuple("k1", -2, 10));
    tc.add(new Tuple("k1", -2, -9));
    tc.close();

    Tap sink = new Hfs(new SequenceFile(new Fields("key", "a_sum", "b_sum", "a_b_sum", "a_b_sum_doubled")), OUTPUT_PATH);

    Pipe pipe = new Pipe("pipe");
    pipe = Combiner.assembly(pipe,
        new MultiExactAggregator(
            new ExactAggregatorDefinition(new Fields("a"), new Fields("a_sum"), new Aggregator()),
View Full Code Here


  private final String SOURCE2 = getTestRoot() + "/mgb_source2";

  @Before
  public void setUp() throws IOException {

    source1 = new Hfs(new SequenceFile(new Fields("key", "num")), SOURCE1);
    TapHelper.writeToTap(source1,
        new Tuple(1, 1),
        new Tuple(1, 3),
        new Tuple(1, 2),
        new Tuple(2, 5),
        new Tuple(3, 3),
        new Tuple(3, 3));

    source2 = new Hfs(new SequenceFile(new Fields("key", "num1", "num2")), SOURCE2);
    TapHelper.writeToTap(source2,
        new Tuple(1, 101, 1),
        new Tuple(5, 5, 2),
        new Tuple(3, 0, 0));
  }
View Full Code Here

  @Test
  public void testSimple3() throws Exception {

    final String OUTPUT = getTestRoot() + "/mgb_output";

    Hfs sink = new Hfs(new SequenceFile(new Fields("key", "result", " result1", "result2", "result3", "result4", "result5")), OUTPUT);

    Map<String, Tap> sources = new HashMap<String, Tap>();
    sources.put("s1", source1);
    sources.put("s2", source2);
View Full Code Here

  @Test
  public void testSimple() throws Exception {
    final String OUTPUT = getTestRoot() + "/mgb_output";

    Hfs sink = new Hfs(new SequenceFile(new Fields("key-rename", "result", " result1", "result2", "result3", "result4", "result5")), OUTPUT);

    Map<String, Tap> sources = new HashMap<String, Tap>();
    sources.put("s1", source1);
    sources.put("s2", source2);
View Full Code Here

  @Test
  public void testSimple2() throws Exception {
    final String OUTPUT = getTestRoot() + "/mgb_output";

    Hfs sink = new Hfs(new SequenceFile(new Fields("key-rename", "result")), OUTPUT);

    Map<String, Tap> sources = new HashMap<String, Tap>();
    sources.put("s1", source1);
    sources.put("s2", source2);
View Full Code Here

    verifyRequestsPerDay(sinks.get(def4.getName()));
    verifyRequestsPerAttribute(sinks.get(def5.getName()));
  }

  private Tap getTupleOutputTap(String testname, String name, Fields fields) {
    return new Hfs(new SequenceFile(fields), getTestRoot() + "/multi_combiner_output/" + testname + "/" + name);
  }
View Full Code Here

  private final String INPUT_PATH = getTestRoot() + "/input";
  private final String OUTPUT_PATH = getTestRoot() + "/output";

  @Test
  public void testMain() throws IOException {
    Hfs source = new Hfs(new SequenceFile(new Fields("key")), INPUT_PATH);
    TupleEntryCollector tc = source.openForWrite(CascadingUtil.get().getFlowProcess());
    tc.add(new Tuple("k0"));
    tc.add(new Tuple("k0"));
    tc.add(new Tuple("k1"));
    tc.add(new Tuple("k1"));
    tc.add(new Tuple("k1"));
    tc.add(new Tuple("k2"));
    tc.add(new Tuple("k2"));
    tc.close();

    Tap sink = new Hfs(new SequenceFile(new Fields("key", "count")), OUTPUT_PATH);
   
    Pipe pipe = new Pipe("pipe");
    pipe = Combiner.assembly(pipe, new CountExactAggregator(), new Fields("key"), new Fields(), new Fields("count"));

    CascadingUtil.get().getFlowConnector().connect(source, sink, pipe).complete();
View Full Code Here

  @Before
  public void bloomAssemblySetUp() throws Exception {
    CascadingUtil.get().setDefaultProperty(BloomProps.KEY_SAMPLE_RATE, 1.0);

    lhsStore = new Hfs(new SequenceFile(new Fields("key", "key2", "lhs-value")), getTestRoot() + "/lhs");
    lhs2Store = new Hfs(new SequenceFile(new Fields("key", "key2", "lhs-value")), getTestRoot() + "/lhs2");
    rhsStore = new Hfs(new SequenceFile(new Fields("key", "key2", "rhs-value")), getTestRoot() + "/rhs");
    rhs2Store = new Hfs(new SequenceFile(new Fields("key", "key2", "rhs-value")), getTestRoot() + "/rhs2");

    TapHelper.writeToTap(rhsStore,
        new Tuple(bytes("1"), bytes("11"), "a-rhs"),
        new Tuple(bytes("1"), bytes("11"), "b-rhs"),
        new Tuple(bytes("2"), bytes("12"), "c-rhs"),
View Full Code Here

  protected Hfs output3;

  @Before
  public void setUp() throws Exception {

    output = new Hfs(new SequenceFile(new Fields("lhs-key", "lhs-key2", "lhs-value", "rhs-key", "rhs-key2", "rhs-value")),
        getTestRoot() + "/output1");

    output2 = new Hfs(new SequenceFile(new Fields("lhs-key-renamed", "lhs-value-renamed", "lhs-key", "rhs-value")),
        getTestRoot() + "/output2");

    output3 = new Hfs(new SequenceFile(new Fields("key", "key2", "v1", "key3", "key4", "v2")),
        getTestRoot() + "/output3");
  }
View Full Code Here

public class TestRenameInPlace extends BaseTestCase {

  @Test
  public void testIt() throws IOException {

    Hfs source1 = new Hfs(new SequenceFile(new Fields("key", "num")), getTestRoot()+"/input");
    TapHelper.writeToTap(source1,
        new Tuple(3, 4));

    Hfs sink = new Hfs(new SequenceFile(new Fields("key2", "num")), getTestRoot()+"/output");

    Pipe input = new Pipe("input");
    input = new RenameInPlace(input, new Fields("key", "num"), new Fields("key"), new Fields("key2"));

View Full Code Here

TOP

Related Classes of cascading.scheme.hadoop.SequenceFile

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.