use of net.opentsdb.query.filter.TagVWildcardFilter in project opentsdb by OpenTSDB.
the class TestTsdbQuery method configureFromQueryWithFilter.
@Test
public void configureFromQueryWithFilter() throws Exception {
setDataPointStorage();
final TSQuery ts_query = getTSQuery();
final List<TagVFilter> filters = new ArrayList<TagVFilter>(1);
filters.add(new TagVWildcardFilter("host", "*imes"));
ts_query.getQueries().get(0).setFilters(filters);
ts_query.validateAndSetQuery();
query = new TsdbQuery(tsdb);
query.configureFromQuery(ts_query, 0).joinUninterruptibly();
assertArrayEquals(METRIC_BYTES, ForTesting.getMetric(query));
assertEquals(1, ForTesting.getFilters(query).size());
assertNull(ForTesting.getGroupBys(query));
assertEquals(1, ForTesting.getRowKeyLiterals(query).size());
assertNull(ForTesting.getRowKeyLiterals(query).get(TAGV_BYTES));
assertNotNull(ForTesting.getRateOptions(query));
}
use of net.opentsdb.query.filter.TagVWildcardFilter in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByWildcardExplicit.
@Test
public void parseQueryMTypeWGroupByWildcardExplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{host=" + TagVWildcardFilter.FILTER_NAME + "(*quirm)}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertEquals(1, sub.getFilters().size());
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
}
use of net.opentsdb.query.filter.TagVWildcardFilter in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByAndWildcardFilterSameTagK.
@Test
public void parseQueryMTypeWGroupByAndWildcardFilterSameTagK() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{host=quirm|tsort}" + "{host=wildcard(*quirm)}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
assertTrue(sub.getFilters().get(1) instanceof TagVLiteralOrFilter);
}
use of net.opentsdb.query.filter.TagVWildcardFilter in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWWildcardFilterImplicit.
@Test
public void parseQueryMTypeWWildcardFilterImplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{}{host=*quirm}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertEquals(1, sub.getFilters().size());
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
}
use of net.opentsdb.query.filter.TagVWildcardFilter in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByAndWildcardFilterExplicit.
@Test
public void parseQueryMTypeWGroupByAndWildcardFilterExplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{colo=lga}{host=wildcard(*quirm)}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
assertTrue(sub.getFilters().get(1) instanceof TagVLiteralOrFilter);
}
Aggregations