Search in sources :

Example 1 with Reactive

use of com.yahoo.bullet.windowing.Reactive in project bullet-core by yahoo.

the class WindowingOperations method findScheme.

/**
 * Create a windowing {@link Scheme} for this particular {@link Query}.
 *
 * @param query The configured, initialized query to find a scheme for.
 * @param strategy The aggregation strategy to use for in the windowing scheme.
 * @param config The {@link BulletConfig} to use for configuration.
 * @return A windowing scheme to use for this query.
 */
public static Scheme findScheme(Query query, Strategy strategy, BulletConfig config) {
    /*
         * TODO: Support other windows
         * The windows we support at the moment:
         * 1. No window -> Basic
         * 2. Window is emit RECORD and include RECORD -> Reactive
         * 3. Window is emit TIME and include ALL -> Additive Tumbling
         * 4. All other windows -> Tumbling (RAW can be Tumbling too)
         */
    Window window = query.getWindow();
    if (window == null) {
        return new Basic(strategy, null, config);
    }
    Window.Classification classification = window.getType();
    if (classification == Window.Classification.RECORD_RECORD) {
        return new Reactive(strategy, window, config);
    }
    if (classification == Window.Classification.TIME_ALL) {
        return new AdditiveTumbling(strategy, window, config);
    }
    return new Tumbling(strategy, window, config);
}
Also used : Window(com.yahoo.bullet.parsing.Window) Basic(com.yahoo.bullet.windowing.Basic) AdditiveTumbling(com.yahoo.bullet.windowing.AdditiveTumbling) Reactive(com.yahoo.bullet.windowing.Reactive) Tumbling(com.yahoo.bullet.windowing.Tumbling) AdditiveTumbling(com.yahoo.bullet.windowing.AdditiveTumbling)

Aggregations

Window (com.yahoo.bullet.parsing.Window)1 AdditiveTumbling (com.yahoo.bullet.windowing.AdditiveTumbling)1 Basic (com.yahoo.bullet.windowing.Basic)1 Reactive (com.yahoo.bullet.windowing.Reactive)1 Tumbling (com.yahoo.bullet.windowing.Tumbling)1