use of org.apache.phoenix.pherf.result.ResultValue in project phoenix by apache.
the class CSVFileResultHandler method read.
public synchronized List<Result> read() throws IOException {
CSVParser parser = null;
util.ensureBaseResultDirExists();
try {
File file = new File(resultFileName);
parser = CSVParser.parse(file, Charset.defaultCharset(), CSVFormat.DEFAULT);
List<CSVRecord> records = parser.getRecords();
List<Result> results = new ArrayList<>();
String header = null;
for (CSVRecord record : records) {
// First record is the CSV Header
if (record.getRecordNumber() == 1) {
header = record.toString();
continue;
}
List<ResultValue> resultValues = new ArrayList<>();
for (String val : record.toString().split(PherfConstants.RESULT_FILE_DELIMETER)) {
resultValues.add(new ResultValue(val));
}
Result result = new Result(resultFileDetails, header, resultValues);
results.add(result);
}
return results;
} finally {
parser.close();
}
}