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);
}
Aggregations