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");
}
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;
}
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();
}
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();
}
Aggregations