use of com.linkedin.thirdeye.client.cache.QueryCache in project pinot by linkedin.
the class TabularTest method main.
public static void main(String[] args) throws Exception {
TabularViewRequest request = new TabularViewRequest();
String collection = "thirdeyeAbook";
DateTime baselineStart = new DateTime(2016, 3, 23, 00, 00);
List<MetricExpression> metricExpressions = new ArrayList<>();
metricExpressions.add(new MetricExpression("__COUNT", "__COUNT"));
request.setCollection(collection);
request.setBaselineStart(baselineStart);
request.setBaselineEnd(baselineStart.plusDays(1));
request.setCurrentStart(baselineStart.plusDays(7));
request.setCurrentEnd(baselineStart.plusDays(8));
request.setTimeGranularity(new TimeGranularity(1, TimeUnit.HOURS));
request.setMetricExpressions(metricExpressions);
// TODO
PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
// make
// this
// configurable;
QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
TabularViewHandler handler = new TabularViewHandler(queryCache);
TabularViewResponse response = handler.process(request);
ObjectMapper mapper = new ObjectMapper();
String jsonResponse = mapper.writeValueAsString(response);
System.out.println(jsonResponse);
}
use of com.linkedin.thirdeye.client.cache.QueryCache in project pinot by linkedin.
the class TimeOnTimeTest method main.
public static void main(String[] args) throws Exception {
// TODO
PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
// make
// this
// configurable;
// PinotThirdEyeClient pinotThirdEyeClient =
// PinotThirdEyeClient.fromHostList("localhost", 8100, "localhost:8099");
QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
// QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newCachedThreadPool());
TimeOnTimeComparisonRequest comparisonRequest;
comparisonRequest = generateGroupByTimeRequest();
// comparisonRequest = generateGroupByDimensionRequest();
// comparisonRequest = generateGroupByTimeAndDimension();
TimeOnTimeComparisonHandler handler = new TimeOnTimeComparisonHandler(queryCache);
// long start;
// long end;
// // Thread.sleep(30000);
// for (int i = 0; i < 5; i++) {
// start = System.currentTimeMillis();
// handler.handle(comparisonRequest);
// end = System.currentTimeMillis();
// System.out.println("Time taken:" + (end - start));
// }
// System.exit(0);
long start = System.currentTimeMillis();
TimeOnTimeComparisonResponse response = handler.handle(comparisonRequest);
long end = System.currentTimeMillis();
System.out.println("Time taken:" + (end - start));
for (Metric metric : response.getRow(0).getMetrics()) {
System.out.print(metric.getMetricName() + "\t\t");
}
System.out.println();
for (int i = 0; i < response.getNumRows(); i++) {
System.out.println(response.getRow(i));
}
System.exit(0);
}
Aggregations