Search in sources :

Example 1 with IDataWriter

use of org.apache.hyracks.api.dataflow.IDataWriter in project asterixdb by apache.

the class SerializationDeserializationTest method serdeser01.

@Test
public void serdeser01() throws Exception {
    RecordDescriptor rDes = new RecordDescriptor(new ISerializerDeserializer[] { new UTF8StringSerializerDeserializer(), IntegerSerializerDeserializer.INSTANCE });
    LineProcessor processor = new LineProcessor() {

        @Override
        public void process(String line, IDataWriter<Object[]> writer) throws Exception {
            String[] splits = line.split(" ");
            for (String s : splits) {
                writer.writeData(new Object[] { s, Integer.valueOf(1) });
            }
        }
    };
    run(rDes, processor);
}
Also used : RecordDescriptor(org.apache.hyracks.api.dataflow.value.RecordDescriptor) UTF8StringSerializerDeserializer(org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer) IDataWriter(org.apache.hyracks.api.dataflow.IDataWriter) Test(org.junit.Test)

Aggregations

IDataWriter (org.apache.hyracks.api.dataflow.IDataWriter)1 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)1 UTF8StringSerializerDeserializer (org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer)1 Test (org.junit.Test)1