Search in sources :

Example 1 with ServiceImpl

use of org.apache.drill.exec.store.openTSDB.client.services.ServiceImpl in project drill by axbaretto.

the class OpenTSDBGroupScan method getScanStats.

@Override
public ScanStats getScanStats() {
    ServiceImpl client = storagePlugin.getClient();
    Map<String, String> params = fromRowData(openTSDBScanSpec.getTableName());
    Set<MetricDTO> allMetrics = client.getAllMetrics(params);
    long numMetrics = allMetrics.size();
    float approxDiskCost = 0;
    if (numMetrics != 0) {
        MetricDTO metricDTO = allMetrics.iterator().next();
        // This method estimates the sizes of Java objects (number of bytes of memory they occupy).
        // more detailed information about how this estimation method work you can find in this article
        // http://www.javaworld.com/javaworld/javaqa/2003-12/02-qa-1226-sizeof.html
        approxDiskCost = SizeEstimator.estimate(metricDTO) * numMetrics;
    }
    return new ScanStats(ScanStats.GroupScanProperty.EXACT_ROW_COUNT, numMetrics, 1, approxDiskCost);
}
Also used : MetricDTO(org.apache.drill.exec.store.openTSDB.dto.MetricDTO) ServiceImpl(org.apache.drill.exec.store.openTSDB.client.services.ServiceImpl) ScanStats(org.apache.drill.exec.physical.base.ScanStats)

Example 2 with ServiceImpl

use of org.apache.drill.exec.store.openTSDB.client.services.ServiceImpl in project drill by apache.

the class OpenTSDBGroupScan method getScanStats.

@Override
public ScanStats getScanStats() {
    ServiceImpl client = storagePlugin.getClient();
    Map<String, String> params = fromRowData(openTSDBScanSpec.getTableName());
    Set<MetricDTO> allMetrics = client.getAllMetrics(params);
    long numMetrics = allMetrics.size();
    float approxDiskCost = 0;
    if (numMetrics != 0) {
        MetricDTO metricDTO = allMetrics.iterator().next();
        // This method estimates the sizes of Java objects (number of bytes of memory they occupy).
        // more detailed information about how this estimation method work you can find in this article
        // http://www.javaworld.com/javaworld/javaqa/2003-12/02-qa-1226-sizeof.html
        approxDiskCost = SizeEstimator.estimate(metricDTO) * numMetrics;
    }
    return new ScanStats(ScanStats.GroupScanProperty.EXACT_ROW_COUNT, numMetrics, 1, approxDiskCost);
}
Also used : MetricDTO(org.apache.drill.exec.store.openTSDB.dto.MetricDTO) ServiceImpl(org.apache.drill.exec.store.openTSDB.client.services.ServiceImpl) ScanStats(org.apache.drill.exec.physical.base.ScanStats)

Aggregations

ScanStats (org.apache.drill.exec.physical.base.ScanStats)2 ServiceImpl (org.apache.drill.exec.store.openTSDB.client.services.ServiceImpl)2 MetricDTO (org.apache.drill.exec.store.openTSDB.dto.MetricDTO)2