My Hadoop MR job emits a value with three primitives via a custom Writable (see
below). How do I write a corresponding custom SerDe so that Hive can read the
output from HDFS? I can find complex SerDe examples (RegEx, JSON), but I can't
find something simple to model from.
I think that my create table should look like this, correct?
CREATE EXTERNAL TABLE rats (time INT, frequency SMALLINT, convolution FLOAT)
ROW FORMAT SERDE 'neurohadoop.RatSerde'
STORED AS SEQUENCEFILE LOCATION '/neuro/output/rats';
----------
public class RatWritable implements Writable {
int timestamp;
short frequency;
float convolution;
public void readFields(DataInput in) throws IOException {
timestamp = in.readInt();
frequency = in.readShort();
convolution = in.readFloat();
}
public void write(DataOutput out) throws IOException {
out.writeInt(timestamp);
out.writeShort(frequency);
out.writeFloat(convolution);
}
}
-- Brad