Search in sources :

Example 6 with SpillableComplexComponentImpl

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;
}
Also used : SpillableSessionWindowedStorage(org.apache.apex.malhar.lib.window.impl.SpillableSessionWindowedStorage) SpillableWindowedKeyedStorage(org.apache.apex.malhar.lib.window.impl.SpillableWindowedKeyedStorage) KeyedWindowedOperatorImpl(org.apache.apex.malhar.lib.window.impl.KeyedWindowedOperatorImpl) MutableLong(org.apache.commons.lang3.mutable.MutableLong) MutableLong(org.apache.commons.lang3.mutable.MutableLong) SpillableComplexComponentImpl(org.apache.apex.malhar.lib.state.spillable.SpillableComplexComponentImpl)

Aggregations

SpillableComplexComponentImpl (org.apache.apex.malhar.lib.state.spillable.SpillableComplexComponentImpl)6 KeyedWindowedOperatorImpl (org.apache.apex.malhar.lib.window.impl.KeyedWindowedOperatorImpl)2 SpillableWindowedKeyedStorage (org.apache.apex.malhar.lib.window.impl.SpillableWindowedKeyedStorage)2 SpillableWindowedPlainStorage (org.apache.apex.malhar.lib.window.impl.SpillableWindowedPlainStorage)2 MutableLong (org.apache.commons.lang3.mutable.MutableLong)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 SpillableStateStore (org.apache.apex.malhar.lib.state.spillable.SpillableStateStore)1 InMemSpillableStateStore (org.apache.apex.malhar.lib.state.spillable.inmem.InMemSpillableStateStore)1 ManagedTimeUnifiedStateSpillableStateStore (org.apache.apex.malhar.lib.state.spillable.managed.ManagedTimeUnifiedStateSpillableStateStore)1 WindowOption (org.apache.apex.malhar.lib.window.WindowOption)1 InMemoryWindowedStorage (org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage)1 SpillableSessionWindowedStorage (org.apache.apex.malhar.lib.window.impl.SpillableSessionWindowedStorage)1 WindowedOperatorImpl (org.apache.apex.malhar.lib.window.impl.WindowedOperatorImpl)1