use of org.apache.apex.malhar.lib.state.spillable.SpillableComplexComponentImpl in project apex-malhar by apache.
the class WindowedOperatorTest method createDefaultKeyedWindowedOperator.
private KeyedWindowedOperatorImpl<String, Long, MutableLong, Long> createDefaultKeyedWindowedOperator(boolean forSession) {
KeyedWindowedOperatorImpl<String, Long, MutableLong, Long> windowedOperator = new KeyedWindowedOperatorImpl<>();
if (useSpillable) {
sccImpl = new SpillableComplexComponentImpl(testMeta.timeStore);
// TODO: We don't yet support Spillable data structures for window state storage because SpillableMapImpl does not yet support iterating over all keys.
windowStateStorage = new InMemoryWindowedStorage<>();
if (forSession) {
SpillableSessionWindowedStorage<String, MutableLong> sws = new SpillableSessionWindowedStorage<>();
sws.setSpillableComplexComponent(sccImpl);
keyedDataStorage = sws;
} else {
SpillableWindowedKeyedStorage<String, MutableLong> kds = new SpillableWindowedKeyedStorage<>();
kds.setSpillableComplexComponent(sccImpl);
keyedDataStorage = kds;
}
SpillableWindowedKeyedStorage<String, Long> krs = new SpillableWindowedKeyedStorage<>();
krs.setSpillableComplexComponent(sccImpl);
keyedRetractionStorage = krs;
windowedOperator.addComponent("SpillableComplexComponent", sccImpl);
} else {
windowStateStorage = new InMemoryWindowedStorage<>();
if (forSession) {
keyedDataStorage = new InMemorySessionWindowedStorage<>();
} else {
keyedDataStorage = new InMemoryWindowedKeyedStorage<>();
}
keyedRetractionStorage = new InMemoryWindowedKeyedStorage<>();
}
windowedOperator.setDataStorage(keyedDataStorage);
windowedOperator.setRetractionStorage(keyedRetractionStorage);
windowedOperator.setWindowStateStorage(windowStateStorage);
windowedOperator.setAccumulation(new SumAccumulation());
return windowedOperator;
}
Aggregations