LOG.info("Deleting " + json);
FileUtils.deleteQuietly(new File(json));
}
private static void generateAvroFile(String schema, String json, String avro, String codec) throws IOException {
Tool tool = new DataFileWriteTool();
List<String> args = new ArrayList<String>();
args.add("--schema-file");
args.add(schema);
args.add(json);
if (codec != null) {
args.add("--codec");
args.add(codec);
}
try {
StringBuffer sb = new StringBuffer();
for (String a : args) {
sb.append(a);
sb.append(" ");
}
PrintStream out = new PrintStream(avro);
tool.run(System.in, out, System.err, args);
} catch (Exception e) {
LOG.info("Could not generate avro file: " + avro, e);
throw new IOException();
}
}