use of org.apache.flink.table.data.utils.JoinedRowData 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();
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class HashJoinOperator method open.
@Override
public void open() throws Exception {
super.open();
ClassLoader cl = getContainingTask().getUserCodeClassLoader();
final AbstractRowDataSerializer buildSerializer = (AbstractRowDataSerializer) getOperatorConfig().getTypeSerializerIn1(getUserCodeClassloader());
final AbstractRowDataSerializer probeSerializer = (AbstractRowDataSerializer) getOperatorConfig().getTypeSerializerIn2(getUserCodeClassloader());
boolean hashJoinUseBitMaps = getContainingTask().getEnvironment().getTaskConfiguration().getBoolean(AlgorithmOptions.HASH_JOIN_BLOOM_FILTERS);
int parallel = getRuntimeContext().getNumberOfParallelSubtasks();
this.condition = parameter.condFuncCode.newInstance(cl);
condition.setRuntimeContext(getRuntimeContext());
condition.open(new Configuration());
this.table = new BinaryHashTable(getContainingTask().getJobConfiguration(), getContainingTask(), buildSerializer, probeSerializer, parameter.buildProjectionCode.newInstance(cl), parameter.probeProjectionCode.newInstance(cl), getContainingTask().getEnvironment().getMemoryManager(), computeMemorySize(), getContainingTask().getEnvironment().getIOManager(), parameter.buildRowSize, parameter.buildRowCount / parallel, hashJoinUseBitMaps, type, condition, reverseJoinFunction, parameter.filterNullKeys, parameter.tryDistinctBuildRow);
this.collector = new StreamRecordCollector<>(output);
this.buildSideNullRow = new GenericRowData(buildSerializer.getArity());
this.probeSideNullRow = new GenericRowData(probeSerializer.getArity());
this.joinedRow = new JoinedRowData();
this.buildEnd = false;
getMetricGroup().gauge("memoryUsedSizeInBytes", table::getUsedMemoryInBytes);
getMetricGroup().gauge("numSpillFiles", table::getNumSpillFiles);
getMetricGroup().gauge("spillInBytes", table::getSpillInBytes);
parameter.condFuncCode = null;
parameter.buildProjectionCode = null;
parameter.probeProjectionCode = null;
}
Aggregations