use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by apache.
the class ServiceImpl method getAllMetricsFromDBByTags.
private Set<MetricDTO> getAllMetricsFromDBByTags(Map<String, String> queryParams) throws IOException {
Map<String, String> tags = new HashMap<>();
DBQuery baseQuery = getConfiguredDbQuery(tags, queryParams);
Set<MetricDTO> metrics = getBaseMetric(baseQuery);
if (metrics == null || metrics.isEmpty()) {
throw UserException.validationError().message(String.format("Table '%s' not found. Please check your query and params", queryParams.get(METRIC_PARAM))).build(log);
}
Set<String> extractedTags = getTagsFromMetrics(metrics);
return getMetricsByTags(extractedTags, queryParams);
}
use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by apache.
the class ServiceImpl method getConfiguredDbQuery.
private DBQuery getConfiguredDbQuery(Map<String, String> tags, Map<String, String> queryParams) {
Query subQuery = new Query.Builder(queryParams.get(METRIC_PARAM)).setAggregator(queryParams.get(AGGREGATOR_PARAM)).setDownsample(queryParams.get(DOWNSAMPLE_PARAM)).setTags(tags).build();
Set<Query> queries = new HashSet<>();
queries.add(subQuery);
return new DBQuery.Builder().setStartTime(queryParams.get(TIME_PARAM)).setEndTime(queryParams.get(END_TIME_PARAM)).setQueries(queries).build();
}
use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by axbaretto.
the class ServiceImpl method getConfiguredDbQuery.
private DBQuery getConfiguredDbQuery(Map<String, String> tags, Map<String, String> queryParams) {
Query subQuery = new Query.Builder(queryParams.get(METRIC_PARAM)).setAggregator(queryParams.get(AGGREGATOR_PARAM)).setDownsample(queryParams.get(DOWNSAMPLE_PARAM)).setTags(tags).build();
Set<Query> queries = new HashSet<>();
queries.add(subQuery);
return new DBQuery.Builder().setStartTime(queryParams.get(TIME_PARAM)).setEndTime(queryParams.get(END_TIME_PARAM)).setQueries(queries).build();
}
use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by axbaretto.
the class ServiceImpl method getAllMetricsFromDBByTags.
private Set<MetricDTO> getAllMetricsFromDBByTags(Map<String, String> queryParams) throws IOException {
Map<String, String> tags = new HashMap<>();
DBQuery baseQuery = getConfiguredDbQuery(tags, queryParams);
Set<MetricDTO> metrics = getBaseMetric(baseQuery);
if (metrics == null || metrics.isEmpty()) {
throw UserException.validationError().message(String.format("Table '%s' not found. Please check your query and params", queryParams.get(METRIC_PARAM))).build(log);
}
Set<String> extractedTags = getTagsFromMetrics(metrics);
return getMetricsByTags(extractedTags, queryParams);
}