Search in sources :

Example 1 with ThriftBlockWriter

use of com.twitter.elephantbird.mapreduce.io.ThriftBlockWriter in project elephant-bird by twitter.

the class TestThriftMultiFormatLoader method setUp.

@Before
public void setUp() throws Exception {
    Configuration conf = new Configuration();
    Assume.assumeTrue(CoreTestUtil.okToRunLzoTests(conf));
    pigServer = PigTestUtil.makePigServer();
    inputDir.mkdirs();
    // write to block file
    ThriftBlockWriter<TestPerson> blk_writer = new ThriftBlockWriter<TestPerson>(createLzoOut("1-block.lzo", conf), TestPerson.class);
    for (TestPerson rec : records) {
        blk_writer.write(rec);
    }
    blk_writer.close();
    // write tb64 lines
    LzoBinaryB64LineRecordWriter<TestPerson, ThriftWritable<TestPerson>> b64_writer = LzoBinaryB64LineRecordWriter.newThriftWriter(TestPerson.class, createLzoOut("2-b64.lzo", conf));
    for (TestPerson rec : records) {
        thriftWritable.set(rec);
        b64_writer.write(null, thriftWritable);
    }
    b64_writer.close(null);
}
Also used : ThriftWritable(com.twitter.elephantbird.mapreduce.io.ThriftWritable) Configuration(org.apache.hadoop.conf.Configuration) TestPerson(com.twitter.elephantbird.thrift.test.TestPerson) ThriftBlockWriter(com.twitter.elephantbird.mapreduce.io.ThriftBlockWriter) Before(org.junit.Before)

Aggregations

ThriftBlockWriter (com.twitter.elephantbird.mapreduce.io.ThriftBlockWriter)1 ThriftWritable (com.twitter.elephantbird.mapreduce.io.ThriftWritable)1 TestPerson (com.twitter.elephantbird.thrift.test.TestPerson)1 Configuration (org.apache.hadoop.conf.Configuration)1 Before (org.junit.Before)1