Search in sources :

Example 1 with PostAggregation

use of com.yahoo.bullet.query.postaggregations.PostAggregation in project bullet-core by yahoo.

the class Querier method start.

// ********************************* Monoidal Interface Overrides *********************************
/**
 * Starts the query.
 */
private void start() {
    // Is an empty map if metadata was disabled
    metaKeys = (Map<String, String>) config.getAs(BulletConfig.RESULT_METADATA_METRICS, Map.class);
    boolean isRateLimitEnabled = config.getAs(BulletConfig.RATE_LIMIT_ENABLE, Boolean.class);
    if (isRateLimitEnabled) {
        int maxEmit = config.getAs(BulletConfig.RATE_LIMIT_MAX_EMIT_COUNT, Integer.class);
        int timeInterval = config.getAs(BulletConfig.RATE_LIMIT_TIME_INTERVAL, Integer.class);
        rateLimit = new RateLimiter(maxEmit, timeInterval);
    }
    Query query = runningQuery.getQuery();
    Expression filter = query.getFilter();
    if (filter != null) {
        this.filter = new Filter(filter);
    }
    TableFunction tableFunction = query.getTableFunction();
    if (tableFunction != null) {
        tableFunctor = tableFunction.getTableFunctor();
    }
    com.yahoo.bullet.query.Projection projection = query.getProjection();
    if (projection.getType() != PASS_THROUGH) {
        this.projection = new Projection(projection.getFields());
    }
    // Aggregation and Strategy are guaranteed to not be null.
    Strategy strategy = query.getAggregation().getStrategy(config);
    List<PostAggregation> postAggregations = query.getPostAggregations();
    if (postAggregations != null && !postAggregations.isEmpty()) {
        postStrategies = postAggregations.stream().map(PostAggregation::getPostStrategy).collect(Collectors.toList());
    }
    // Scheme is guaranteed to not be null. It is constructed in its "start" state.
    window = query.getWindow().getScheme(strategy, config);
}
Also used : Query(com.yahoo.bullet.query.Query) PostAggregation(com.yahoo.bullet.query.postaggregations.PostAggregation) Expression(com.yahoo.bullet.query.expressions.Expression) TableFunction(com.yahoo.bullet.query.tablefunctions.TableFunction) Strategy(com.yahoo.bullet.querying.aggregations.Strategy) PostStrategy(com.yahoo.bullet.querying.postaggregations.PostStrategy)

Aggregations

Query (com.yahoo.bullet.query.Query)1 Expression (com.yahoo.bullet.query.expressions.Expression)1 PostAggregation (com.yahoo.bullet.query.postaggregations.PostAggregation)1 TableFunction (com.yahoo.bullet.query.tablefunctions.TableFunction)1 Strategy (com.yahoo.bullet.querying.aggregations.Strategy)1 PostStrategy (com.yahoo.bullet.querying.postaggregations.PostStrategy)1