use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.
the class AbstractRowTimeUnboundedPrecedingOver method open.
@Override
public void open(Configuration parameters) throws Exception {
function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
function.open(new PerKeyStateDataViewStore(getRuntimeContext()));
output = new JoinedRowData();
sortedTimestamps = new LinkedList<Long>();
// initialize accumulator state
InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
ValueStateDescriptor<RowData> accStateDesc = new ValueStateDescriptor<RowData>("accState", accTypeInfo);
accState = getRuntimeContext().getState(accStateDesc);
// input element are all binary row as they are came from network
InternalTypeInfo<RowData> inputType = InternalTypeInfo.ofFields(inputFieldTypes);
ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<RowData>(inputType);
MapStateDescriptor<Long, List<RowData>> inputStateDesc = new MapStateDescriptor<Long, List<RowData>>("inputState", Types.LONG, rowListTypeInfo);
inputState = getRuntimeContext().getMapState(inputStateDesc);
initCleanupTimeState("RowTimeUnboundedOverCleanupTime");
// metrics
this.numLateRecordsDropped = getRuntimeContext().getMetricGroup().counter(LATE_ELEMENTS_DROPPED_METRIC_NAME);
}
use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.
the class RowTimeRowsBoundedPrecedingFunction method open.
@Override
public void open(Configuration parameters) throws Exception {
function = genAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
function.open(new PerKeyStateDataViewStore(getRuntimeContext()));
output = new JoinedRowData();
ValueStateDescriptor<Long> lastTriggeringTsDescriptor = new ValueStateDescriptor<Long>("lastTriggeringTsState", Types.LONG);
lastTriggeringTsState = getRuntimeContext().getState(lastTriggeringTsDescriptor);
ValueStateDescriptor<Long> dataCountStateDescriptor = new ValueStateDescriptor<Long>("processedCountState", Types.LONG);
counterState = getRuntimeContext().getState(dataCountStateDescriptor);
InternalTypeInfo<RowData> accTypeInfo = InternalTypeInfo.ofFields(accTypes);
ValueStateDescriptor<RowData> accStateDesc = new ValueStateDescriptor<RowData>("accState", accTypeInfo);
accState = getRuntimeContext().getState(accStateDesc);
// input element are all binary row as they are came from network
InternalTypeInfo<RowData> inputType = InternalTypeInfo.ofFields(inputFieldTypes);
ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<RowData>(inputType);
MapStateDescriptor<Long, List<RowData>> inputStateDesc = new MapStateDescriptor<Long, List<RowData>>("inputState", Types.LONG, rowListTypeInfo);
inputState = getRuntimeContext().getMapState(inputStateDesc);
initCleanupTimeState("RowTimeBoundedRowsOverCleanupTime");
// metrics
this.numLateRecordsDropped = getRuntimeContext().getMetricGroup().counter(LATE_ELEMENTS_DROPPED_METRIC_NAME);
}
use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.
the class OffsetOverFrame 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;
}
use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.
the class UnboundedFollowingOverFrame 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);
}
use of org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore in project flink by apache.
the class MiniBatchGroupAggFunction method open.
@Override
public void open(ExecutionContext ctx) throws Exception {
super.open(ctx);
// instantiate function
StateTtlConfig ttlConfig = createTtlConfig(stateRetentionTime);
function = genAggsHandler.newInstance(ctx.getRuntimeContext().getUserCodeClassLoader());
function.open(new PerKeyStateDataViewStore(ctx.getRuntimeContext(), ttlConfig));
// instantiate equaliser
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);
inputRowSerializer = InternalSerializers.create(inputType);
resultRow = new JoinedRowData();
}
Aggregations