Path schemaFile = new Path(tmpSingletonDir.getCanonicalPath(), LearnStructure.SCHEMA_FILENAME);
Path parseTreeFile = new Path(tmpSingletonDir.getCanonicalPath(), LearnStructure.PARSER_FILENAME);
Path jsonDataFile = new Path(tmpSingletonDir.getCanonicalPath(), LearnStructure.JSONDATA_FILENAME);
Path avroFile = new Path(tmpSingletonDir.getCanonicalPath(), LearnStructure.DATA_FILENAME);
LearnStructure ls = new LearnStructure();
// Check to see how many records exist in the original input
int lineCount = 0;
BufferedReader in2 = new BufferedReader(new FileReader(inputData));
try {
while (in2.readLine() != null) {
lineCount++;
}
} finally {
in2.close();
}
// Infer structure
ls.inferRecordFormat(localFS, new Path(inputData.getCanonicalPath()), localFS, schemaFile, parseTreeFile, jsonDataFile, avroFile, false, lineCount);
// Test the inferred structure
// First, load in the avro file and see how many records there are.
int avroCount = 0;
DataFileReader in = new DataFileReader(new File(avroFile.toString()), new GenericDatumReader());