Search in sources :

Example 1 with CSVResultHandler

use of org.apache.phoenix.pherf.result.impl.CSVResultHandler in project phoenix by apache.

the class ResultUtil method write.

/**
     * Write data load time details
     *
     * @param dataLoadThreadTime {@link DataLoadThreadTime}
     * @throws IOException
     */
public synchronized void write(DataLoadThreadTime dataLoadThreadTime) throws IOException {
    ensureBaseResultDirExists();
    CSVResultHandler writer = null;
    try {
        if (!dataLoadThreadTime.getThreadTime().isEmpty()) {
            writer = new CSVFileResultHandler();
            writer.setResultFileDetails(ResultFileDetails.CSV);
            writer.setResultFileName("Data_Load_Details");
            for (WriteThreadTime writeThreadTime : dataLoadThreadTime.getThreadTime()) {
                List<ResultValue> rowValues = new ArrayList<>();
                rowValues.add(new ResultValue(PhoenixUtil.getZookeeper()));
                rowValues.addAll(writeThreadTime.getCsvRepresentation(this));
                Result result = new Result(ResultFileDetails.CSV_DETAILED_PERFORMANCE, "ZK," + dataLoadThreadTime.getCsvTitle(), rowValues);
                writer.write(result);
            }
        }
    } finally {
        if (writer != null) {
            writer.flush();
            writer.close();
        }
    }
}
Also used : CSVFileResultHandler(org.apache.phoenix.pherf.result.impl.CSVFileResultHandler) ArrayList(java.util.ArrayList) CSVResultHandler(org.apache.phoenix.pherf.result.impl.CSVResultHandler)

Example 2 with CSVResultHandler

use of org.apache.phoenix.pherf.result.impl.CSVResultHandler 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 CSVFileResultHandler (org.apache.phoenix.pherf.result.impl.CSVFileResultHandler)2 CSVResultHandler (org.apache.phoenix.pherf.result.impl.CSVResultHandler)2 ResultFileDetails (org.apache.phoenix.pherf.result.file.ResultFileDetails)1