Search in sources :

Example 11 with PerKeyStateDataViewStore

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

the class InsensitiveOverFrame method open.

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

Example 12 with PerKeyStateDataViewStore

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

the class SlidingOverFrame method open.

@Override
public void open(ExecutionContext ctx) throws Exception {
    this.inputSer = new RowDataSerializer(inputType);
    this.valueSer = new RowDataSerializer(valueType);
    ClassLoader cl = ctx.getRuntimeContext().getUserCodeClassLoader();
    processor = aggsHandleFunction.newInstance(cl);
    processor.open(new PerKeyStateDataViewStore(ctx.getRuntimeContext()));
    buffer = new ArrayDeque<>();
    this.aggsHandleFunction = null;
}
Also used : RowDataSerializer(org.apache.flink.table.runtime.typeutils.RowDataSerializer) PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Example 13 with PerKeyStateDataViewStore

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

the class UnboundedOverWindowFrame 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;
    this.valueSer = new RowDataSerializer(valueType.getChildren().toArray(new LogicalType[0]));
}
Also used : PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore) RowDataSerializer(org.apache.flink.table.runtime.typeutils.RowDataSerializer)

Example 14 with PerKeyStateDataViewStore

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

the class NonBufferOverWindowOperator method open.

@Override
public void open() throws Exception {
    super.open();
    ClassLoader cl = getUserCodeClassloader();
    serializer = (AbstractRowDataSerializer) getOperatorConfig().getTypeSerializerIn1(cl);
    partitionComparator = genComparator.newInstance(cl);
    genComparator = null;
    collector = new StreamRecordCollector<>(output);
    processors = new AggsHandleFunction[aggsHandlers.length];
    joinedRows = new JoinedRowData[aggsHandlers.length];
    for (int i = 0; i < aggsHandlers.length; i++) {
        AggsHandleFunction func = aggsHandlers[i].newInstance(cl);
        func.open(new PerKeyStateDataViewStore(getRuntimeContext()));
        processors[i] = func;
        joinedRows[i] = new JoinedRowData();
    }
    aggsHandlers = null;
}
Also used : JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) AggsHandleFunction(org.apache.flink.table.runtime.generated.AggsHandleFunction) GeneratedAggsHandleFunction(org.apache.flink.table.runtime.generated.GeneratedAggsHandleFunction) PerKeyStateDataViewStore(org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore)

Example 15 with PerKeyStateDataViewStore

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

the class ProcTimeRangeBoundedPrecedingFunction method open.

@Override
public void open(Configuration parameters) throws Exception {
    function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
    function.open(new PerKeyStateDataViewStore(getRuntimeContext()));
    output = new JoinedRowData();
    // input element are all binary row as they are came from network
    InternalTypeInfo<RowData> inputType = InternalTypeInfo.ofFields(inputFieldTypes);
    // we keep the elements received in a map state indexed based on their ingestion time
    ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<>(inputType);
    MapStateDescriptor<Long, List<RowData>> mapStateDescriptor = new MapStateDescriptor<>("inputState", BasicTypeInfo.LONG_TYPE_INFO, rowListTypeInfo);
    inputState = getRuntimeContext().getMapState(mapStateDescriptor);
    InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
    ValueStateDescriptor<RowData> stateDescriptor = new ValueStateDescriptor<RowData>("accState", accTypeInfo);
    accState = getRuntimeContext().getState(stateDescriptor);
    ValueStateDescriptor<Long> cleanupTsStateDescriptor = new ValueStateDescriptor<>("cleanupTsState", Types.LONG);
    this.cleanupTsState = getRuntimeContext().getState(cleanupTsStateDescriptor);
}
Also used : MapStateDescriptor(org.apache.flink.api.common.state.MapStateDescriptor) 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) ListTypeInfo(org.apache.flink.api.java.typeutils.ListTypeInfo) ArrayList(java.util.ArrayList) List(java.util.List) 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