Search in sources :

Example 1 with ResultFileDetails

use of org.apache.phoenix.pherf.result.file.ResultFileDetails in project phoenix by apache.

the class ResultUtil method write.

public synchronized void write(ResultHandler resultHandler, DataModelResult dataModelResult) throws Exception {
    ResultFileDetails resultFileDetails = resultHandler.getResultFileDetails();
    switch(resultFileDetails) {
        case CSV_AGGREGATE_PERFORMANCE:
        case CSV_DETAILED_PERFORMANCE:
        case CSV_DETAILED_FUNCTIONAL:
            List<List<ResultValue>> rowDetails = getCSVResults(dataModelResult, resultFileDetails);
            for (List<ResultValue> row : rowDetails) {
                Result result = new Result(resultFileDetails, resultFileDetails.getHeader().toString(), row);
                resultHandler.write(result);
            }
            break;
        default:
            List<ResultValue> resultValue = new ArrayList();
            resultValue.add(new ResultValue<>(dataModelResult));
            resultHandler.write(new Result(resultFileDetails, null, resultValue));
            break;
    }
}
Also used : ResultFileDetails(org.apache.phoenix.pherf.result.file.ResultFileDetails) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with ResultFileDetails

use of org.apache.phoenix.pherf.result.file.ResultFileDetails in project phoenix by apache.

the class ResultUtil method write.

/**
     * Write data load time summary
     *
     * @param dataLoadTime
     * @throws IOException
     */
public synchronized void write(DataLoadTimeSummary dataLoadTime) throws IOException {
    ensureBaseResultDirExists();
    CSVResultHandler writer = null;
    ResultFileDetails resultFileDetails;
    if (PhoenixUtil.isThinDriver()) {
        resultFileDetails = ResultFileDetails.CSV_THIN_AGGREGATE_DATA_LOAD;
    } else {
        resultFileDetails = ResultFileDetails.CSV_AGGREGATE_DATA_LOAD;
    }
    try {
        writer = new CSVFileResultHandler();
        writer.setResultFileDetails(resultFileDetails);
        writer.setResultFileName("Data_Load_Summary");
        for (TableLoadTime loadTime : dataLoadTime.getTableLoadTime()) {
            List<ResultValue> rowValues = new ArrayList<>();
            if (PhoenixUtil.isThinDriver()) {
                rowValues.add(new ResultValue(PhoenixUtil.getQueryServerUrl()));
            } else {
                rowValues.add(new ResultValue(PhoenixUtil.getZookeeper()));
            }
            rowValues.addAll(loadTime.getCsvRepresentation(this));
            Result result = new Result(resultFileDetails, resultFileDetails.getHeader().toString(), rowValues);
            writer.write(result);
        }
    } finally {
        if (writer != null) {
            writer.flush();
            writer.close();
        }
    }
}
Also used : ResultFileDetails(org.apache.phoenix.pherf.result.file.ResultFileDetails) CSVFileResultHandler(org.apache.phoenix.pherf.result.impl.CSVFileResultHandler) ArrayList(java.util.ArrayList) CSVResultHandler(org.apache.phoenix.pherf.result.impl.CSVResultHandler)

Aggregations

ArrayList (java.util.ArrayList)2 ResultFileDetails (org.apache.phoenix.pherf.result.file.ResultFileDetails)2 List (java.util.List)1 CSVFileResultHandler (org.apache.phoenix.pherf.result.impl.CSVFileResultHandler)1 CSVResultHandler (org.apache.phoenix.pherf.result.impl.CSVResultHandler)1