Source:
protected void createInputFile() throws IOException { TypeDescription schema = TypeDescription.createStruct(); schema.addField("userID", TypeDescription.createInt()); schema.addField("firstName", TypeDescription.createString()); schema.addField("lastName", TypeDescription.createString()); TypeDescription typeBids = TypeDescription.createList(TypeDescription.createInt()); schema.addField("bids", typeBids); schema.addField("campaignInfo", TypeDescription.createString()); schema.addField("cost", TypeDescription.createDouble()); schema.addField("timestamp", TypeDescription.createLong()); Writer writer = OrcFile.createWriter(new Path(_dataFile.getAbsolutePath()), OrcFile.writerOptions(new Configuration()).setSchema(schema)); OrcMapredRecordWriter mrRecordWriter = new OrcMapredRecordWriter(writer); for (Map<String, Object> inputRecord : _inputRecords) { OrcStruct struct = new OrcStruct(schema); Integer userID = (Integer) inputRecord.get("userID"); struct.setFieldValue("userID", userID == null ? null : new IntWritable(userID)); String firstName = (String) inputRecord.get("firstName"); struct.setFieldValue("firstName", firstName == null ? null : new Text(firstName)); struct.setFieldValue("lastName", new Text((String) inputRecord.get("lastName"))); List<Integer> bids = (List<Integer>) inputRecord.get("bids"); if (bids != null) { OrcList<IntWritable> bidsList = new OrcList<>(typeBids); for (Integer bid : bids) { bidsList.add(new IntWritable(bid)); } struct.setFieldValue("bids", bidsList); } else { struct.setFieldValue("bids", null); } struct.setFieldValue("campaignInfo", new Text((String) inputRecord.get("campaignInfo"))); struct.setFieldValue("cost", new DoubleWritable((Double) inputRecord.get("cost"))); struct.setFieldValue("timestamp", new LongWritable((Long) inputRecord.get("timestamp"))); mrRecordWriter.write(null, struct); } mrRecordWriter.close(null); }

Target:
protected void createInputFile() throws IOException { TypeDescription schema = TypeDescription.createStruct(); schema.addField("user_id", TypeDescription.createInt()); schema.addField("firstName", TypeDescription.createString()); schema.addField("lastName", TypeDescription.createString()); TypeDescription typeBids = TypeDescription.createList(TypeDescription.createInt()); schema.addField("bids", typeBids); schema.addField("campaignInfo", TypeDescription.createString()); schema.addField("cost", TypeDescription.createDouble()); schema.addField("timestamp", TypeDescription.createLong()); Writer writer = OrcFile.createWriter(new Path(_dataFile.getAbsolutePath()), OrcFile.writerOptions(new Configuration()).setSchema(schema)); OrcMapredRecordWriter mrRecordWriter = new OrcMapredRecordWriter(writer); for (Map<String, Object> inputRecord : _inputRecords) { OrcStruct struct = new OrcStruct(schema); Integer userID = (Integer) inputRecord.get("user_id"); struct.setFieldValue("user_id", userID == null ? null : new IntWritable(userID)); String firstName = (String) inputRecord.get("firstName"); struct.setFieldValue("firstName", firstName == null ? null : new Text(firstName)); struct.setFieldValue("lastName", new Text((String) inputRecord.get("lastName"))); List<Integer> bids = (List<Integer>) inputRecord.get("bids"); if (bids != null) { OrcList<IntWritable> bidsList = new OrcList<>(typeBids); for (Integer bid : bids) { bidsList.add(new IntWritable(bid)); } struct.setFieldValue("bids", bidsList); } else { struct.setFieldValue("bids", null); } struct.setFieldValue("campaignInfo", new Text((String) inputRecord.get("campaignInfo"))); struct.setFieldValue("cost", new DoubleWritable((Double) inputRecord.get("cost"))); struct.setFieldValue("timestamp", new LongWritable((Long) inputRecord.get("timestamp"))); mrRecordWriter.write(null, struct); } mrRecordWriter.close(null); }