Search in sources :

Example 16 with PerKeyStateDataViewStore

use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.

the class ProcTimeUnboundedPrecedingFunction method open.

@Override
public void open(Configuration parameters) throws Exception {
    function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
    function.open(new PerKeyStateDataViewStore(getRuntimeContext()));
    output = new JoinedRowData();
    InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
    ValueStateDescriptor<RowData> stateDescriptor = new ValueStateDescriptor<RowData>("accState", accTypeInfo);
    accState = getRuntimeContext().getState(stateDescriptor);
    initCleanupTimeState("ProcTimeUnboundedOverCleanupTime");
}
Also used : ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) RowData(org.apache.flink.table.data.RowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Example 17 with PerKeyStateDataViewStore

use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.

the class UnboundedPrecedingOverFrame method open.

@Override
public void open(ExecutionContext ctx) throws Exception {
    ClassLoader cl = ctx.getRuntimeContext().getUserCodeClassLoader();
    processor = aggsHandleFunction.newInstance(cl);
    processor.open(new PerKeyStateDataViewStore(ctx.getRuntimeContext()));
    this.aggsHandleFunction = null;
}
Also used : PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Example 18 with PerKeyStateDataViewStore

use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.

the class GroupAggFunction method open.

@Override
public void open(Configuration parameters) throws Exception {
    super.open(parameters);
    // instantiate function
    StateTtlConfig ttlConfig = createTtlConfig(stateRetentionTime);
    function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
    function.open(new PerKeyStateDataViewStore(getRuntimeContext(), ttlConfig));
    // instantiate equaliser
    equaliser = genRecordEqualiser.newInstance(getRuntimeContext().getUserCodeClassLoader());
    InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
    ValueStateDescriptor<RowData> accDesc = new ValueStateDescriptor<>("accState", accTypeInfo);
    if (ttlConfig.isEnabled()) {
        accDesc.enableTimeToLive(ttlConfig);
    }
    accState = getRuntimeContext().getState(accDesc);
    resultRow = new JoinedRowData();
}
Also used : ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) RowData(org.apache.flink.table.data.RowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) StateTtlConfig(org.apache.flink.api.common.state.StateTtlConfig) PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Example 19 with PerKeyStateDataViewStore

use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.

the class MiniBatchGlobalGroupAggFunction method open.

@Override
public void open(ExecutionContext ctx) throws Exception {
    super.open(ctx);
    StateTtlConfig ttlConfig = createTtlConfig(stateRetentionTime);
    localAgg = genLocalAggsHandler.newInstance(ctx.getRuntimeContext().getUserCodeClassLoader());
    localAgg.open(new PerKeyStateDataViewStore(ctx.getRuntimeContext()));
    globalAgg = genGlobalAggsHandler.newInstance(ctx.getRuntimeContext().getUserCodeClassLoader());
    globalAgg.open(new PerKeyStateDataViewStore(ctx.getRuntimeContext(), ttlConfig));
    equaliser = genRecordEqualiser.newInstance(ctx.getRuntimeContext().getUserCodeClassLoader());
    InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
    ValueStateDescriptor<RowData> accDesc = new ValueStateDescriptor<>("accState", accTypeInfo);
    if (ttlConfig.isEnabled()) {
        accDesc.enableTimeToLive(ttlConfig);
    }
    accState = ctx.getRuntimeContext().getState(accDesc);
    resultRow = new JoinedRowData();
}
Also used : ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) RowData(org.apache.flink.table.data.RowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) StateTtlConfig(org.apache.flink.api.common.state.StateTtlConfig) PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Aggregations

PerKeyStateDataViewStore (org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)19 JoinedRowData (org.apache.flink.table.data.utils.JoinedRowData)12 ValueStateDescriptor (org.apache.flink.api.common.state.ValueStateDescriptor)10 RowData (org.apache.flink.table.data.RowData)10 ArrayList (java.util.ArrayList)5 List (java.util.List)5 MapStateDescriptor (org.apache.flink.api.common.state.MapStateDescriptor)5 StateTtlConfig (org.apache.flink.api.common.state.StateTtlConfig)5 ListTypeInfo (org.apache.flink.api.java.typeutils.ListTypeInfo)5 RowDataSerializer (org.apache.flink.table.runtime.typeutils.RowDataSerializer)3 LinkedList (java.util.LinkedList)1 AggsHandleFunction (org.apache.flink.table.runtime.generated.AggsHandleFunction)1 GeneratedAggsHandleFunction (org.apache.flink.table.runtime.generated.GeneratedAggsHandleFunction)1