Search in sources :

Example 6 with Querier

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"));
}
Also used : Querier(com.yahoo.bullet.querying.Querier) CustomCollector(com.yahoo.bullet.storm.testing.CustomCollector) Metadata(com.yahoo.bullet.pubsub.Metadata) Tuple(org.apache.storm.tuple.Tuple) TupleUtils.makeIDTuple(com.yahoo.bullet.storm.testing.TupleUtils.makeIDTuple) Test(org.testng.annotations.Test)

Example 7 with Querier

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);
}
Also used : Querier(com.yahoo.bullet.querying.Querier) Metadata(com.yahoo.bullet.pubsub.Metadata) List(java.util.List)

Example 8 with Querier

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());
}
Also used : Querier(com.yahoo.bullet.querying.Querier)

Example 9 with Querier

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);
}
Also used : Querier(com.yahoo.bullet.querying.Querier)

Example 10 with 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);
    }
}
Also used : Querier(com.yahoo.bullet.querying.Querier)

Aggregations

Querier (com.yahoo.bullet.querying.Querier)11 Metadata (com.yahoo.bullet.pubsub.Metadata)3 CustomCollector (com.yahoo.bullet.storm.testing.CustomCollector)3 TupleUtils.makeIDTuple (com.yahoo.bullet.storm.testing.TupleUtils.makeIDTuple)3 Tuple (org.apache.storm.tuple.Tuple)3 Test (org.testng.annotations.Test)3 RateLimitError (com.yahoo.bullet.querying.RateLimitError)1 List (java.util.List)1