use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class QueryBoltTest method testRegularMetaTupleIgnored.
@Test
public void testRegularMetaTupleIgnored() {
CustomCollector collector = new CustomCollector();
TestQueryBolt bolt = new TestQueryBolt(new BulletStormConfig());
ComponentUtils.prepare(bolt, collector);
Map<String, Querier> queries = bolt.getQueries();
queries.put("foo", null);
Tuple meta = makeIDTuple(Type.METADATA_TUPLE, "foo", new Metadata(Signal.ACKNOWLEDGE, null));
bolt.execute(meta);
Assert.assertTrue(queries.containsKey("foo"));
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method onQuery.
private void onQuery(Tuple tuple) {
String id = tuple.getString(TopologyConstants.ID_POSITION);
String query = tuple.getString(TopologyConstants.QUERY_POSITION);
Metadata metadata = (Metadata) tuple.getValue(TopologyConstants.QUERY_METADATA_POSITION);
Querier querier;
try {
querier = createQuerier(Querier.Mode.ALL, id, query, config);
Optional<List<BulletError>> optionalErrors = querier.initialize();
if (!optionalErrors.isPresent()) {
setupQuery(id, query, metadata, querier);
return;
}
emitErrorsAsResult(id, metadata, optionalErrors.get());
} catch (RuntimeException re) {
// Includes JSONParseException
emitErrorsAsResult(id, metadata, ParsingError.makeError(re, query));
}
log.error("Failed to initialize query for request {} with query {}", id, query);
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method emitRateLimitError.
// RESULT_STREAM and METADATA_STREAM emitters
private void emitRateLimitError(Map.Entry<String, Querier> query) {
Querier querier = query.getValue();
emitRateLimitError(query.getKey(), querier, querier.getRateLimitError());
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method emitBufferedWindow.
private void emitBufferedWindow(Map.Entry<String, Querier> query) {
String id = query.getKey();
Querier querier = query.getValue();
emitResult(id, bufferedMetadata.get(id), querier.getResult());
querier.reset();
bufferedWindows.remove(id);
queries.put(id, querier);
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class QueryCategorizer method classify.
private void classify(Map.Entry<String, Querier> query) {
String id = query.getKey();
Querier querier = query.getValue();
if (querier.isDone()) {
done.put(id, querier);
} else if (querier.isExceedingRateLimit()) {
rateLimited.put(id, querier);
} else if (querier.isClosed()) {
closed.put(id, querier);
}
}
Aggregations