use of org.apache.flink.table.runtime.context.ExecutionContextImpl in project flink by apache.
the class BufferDataOverWindowOperator method open.
@Override
public void open() throws Exception {
super.open();
ClassLoader cl = getUserCodeClassloader();
serializer = (AbstractRowDataSerializer) getOperatorConfig().getTypeSerializerIn1(cl);
partitionComparator = genComparator.newInstance(cl);
genComparator = null;
MemoryManager memManager = getContainingTask().getEnvironment().getMemoryManager();
LazyMemorySegmentPool pool = new LazyMemorySegmentPool(this, memManager, (int) (computeMemorySize() / memManager.getPageSize()));
this.currentData = new ResettableExternalBuffer(getContainingTask().getEnvironment().getIOManager(), pool, serializer, isRowAllInFixedPart);
collector = new StreamRecordCollector<>(output);
joinedRows = new JoinedRowData[overWindowFrames.length];
for (int i = 0; i < overWindowFrames.length; i++) {
overWindowFrames[i].open(new ExecutionContextImpl(this, getRuntimeContext()));
joinedRows[i] = new JoinedRowData();
}
}
use of org.apache.flink.table.runtime.context.ExecutionContextImpl in project flink by apache.
the class AbstractMapBundleOperator method open.
@Override
public void open() throws Exception {
super.open();
function.open(new ExecutionContextImpl(this, getRuntimeContext()));
this.numOfElements = 0;
this.collector = new StreamRecordCollector<>(output);
this.bundle = new HashMap<>();
bundleTrigger.registerCallback(this);
// reset trigger
bundleTrigger.reset();
LOG.info("BundleOperator's trigger info: " + bundleTrigger.explain());
// counter metric to get the size of bundle
getRuntimeContext().getMetricGroup().gauge("bundleSize", (Gauge<Integer>) () -> numOfElements);
getRuntimeContext().getMetricGroup().gauge("bundleRatio", (Gauge<Double>) () -> {
int numOfKeys = bundle.size();
if (numOfKeys == 0) {
return 0.0;
} else {
return 1.0 * numOfElements / numOfKeys;
}
});
}
Aggregations