use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method getQuery.
private Querier getQuery(String id) {
// JoinBolt has three places where the query might be
Querier query = queries.get(id);
if (query == null) {
log.debug("Query might be buffered: {}", id);
query = bufferedWindows.get(id);
}
if (query == null) {
log.debug("Query might be done: {}", id);
query = bufferedQueries.get(id);
}
return query;
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method onError.
private void onError(Tuple tuple) {
String id = tuple.getString(TopologyConstants.ID_POSITION);
Querier querier = getQuery(id);
if (querier == null) {
log.debug("Received error for {} without the query existing", id);
// TODO Might later create this query whose error ignored here. This is a leak.
return;
}
RateLimitError error = (RateLimitError) tuple.getValue(TopologyConstants.ERROR_POSITION);
emitRateLimitError(id, querier, error);
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class JoinBolt method onData.
private void onData(Tuple tuple) {
String id = tuple.getString(TopologyConstants.ID_POSITION);
Querier querier = getQuery(id);
if (querier == null) {
log.debug("Received data for query {} before query. Ignoring...", id);
return;
}
byte[] data = (byte[]) tuple.getValue(TopologyConstants.DATA_POSITION);
querier.combine(data);
if (querier.isDone()) {
emitOrBufferFinished(id, querier);
} else if (querier.isExceedingRateLimit()) {
emitRateLimitError(id, querier, querier.getRateLimitError());
} else if (querier.isClosed()) {
emitOrBufferWindow(id, querier);
}
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class QueryBoltTest method testNullMetaTupleIgnored.
@Test
public void testNullMetaTupleIgnored() {
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", null);
bolt.execute(meta);
Assert.assertTrue(queries.containsKey("foo"));
}
use of com.yahoo.bullet.querying.Querier in project bullet-storm by yahoo.
the class QueryBoltTest method testMetaTupleRemovingQueries.
@Test
public void testMetaTupleRemovingQueries() {
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 complete = makeIDTuple(Type.METADATA_TUPLE, "foo", new Metadata(Signal.COMPLETE, null));
bolt.execute(complete);
Assert.assertFalse(queries.containsKey("foo"));
queries.put("foo", null);
Tuple fail = makeIDTuple(Type.METADATA_TUPLE, "foo", new Metadata(Signal.KILL, null));
bolt.execute(fail);
Assert.assertFalse(queries.containsKey("foo"));
}
Aggregations