use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class RowDataTest method testJoinedRow.
@Test
public void testJoinedRow() {
GenericRowData row1 = new GenericRowData(5);
row1.setField(0, true);
row1.setField(1, (byte) 1);
row1.setField(2, (short) 2);
row1.setField(3, 3);
row1.setField(4, (long) 4);
GenericRowData row2 = new GenericRowData(13);
row2.setField(0, (float) 5);
row2.setField(1, (double) 6);
row2.setField(2, (char) 7);
row2.setField(3, str);
row2.setField(4, generic);
row2.setField(5, decimal1);
row2.setField(6, decimal2);
row2.setField(7, array);
row2.setField(8, map);
row2.setField(9, underRow);
row2.setField(10, bytes);
row2.setField(11, timestamp1);
row2.setField(12, timestamp2);
testGetters(new JoinedRowData(row1, row2));
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class ProcTimeRowsBoundedPrecedingFunction 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 keyed
// by the ingestion time in the operator.
// we also keep counter of processed elements
// and timestamp of oldest element
ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<RowData>(inputType);
MapStateDescriptor<Long, List<RowData>> mapStateDescriptor = new MapStateDescriptor<Long, List<RowData>>("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> processedCountDescriptor = new ValueStateDescriptor<Long>("processedCountState", Types.LONG);
counterState = getRuntimeContext().getState(processedCountDescriptor);
ValueStateDescriptor<Long> smallestTimestampDescriptor = new ValueStateDescriptor<Long>("smallestTSState", Types.LONG);
smallestTsState = getRuntimeContext().getState(smallestTimestampDescriptor);
initCleanupTimeState("ProcTimeBoundedRowsOverCleanupTime");
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class RowTimeRangeBoundedPrecedingFunction 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);
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);
ValueStateDescriptor<Long> cleanupTsStateDescriptor = new ValueStateDescriptor<>("cleanupTsState", Types.LONG);
this.cleanupTsState = getRuntimeContext().getState(cleanupTsStateDescriptor);
// metrics
this.numLateRecordsDropped = getRuntimeContext().getMetricGroup().counter(LATE_ELEMENTS_DROPPED_METRIC_NAME);
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class LookupJoinRunner method open.
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
this.fetcher = generatedFetcher.newInstance(getRuntimeContext().getUserCodeClassLoader());
this.collector = generatedCollector.newInstance(getRuntimeContext().getUserCodeClassLoader());
FunctionUtils.setFunctionRuntimeContext(fetcher, getRuntimeContext());
FunctionUtils.setFunctionRuntimeContext(collector, getRuntimeContext());
FunctionUtils.openFunction(fetcher, parameters);
FunctionUtils.openFunction(collector, parameters);
this.nullRow = new GenericRowData(tableFieldsCount);
this.outRow = new JoinedRowData();
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class TemporalRowTimeJoinOperator method open.
@Override
public void open() throws Exception {
super.open();
joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader());
joinCondition.setRuntimeContext(getRuntimeContext());
joinCondition.open(new Configuration());
nextLeftIndex = getRuntimeContext().getState(new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG));
leftState = getRuntimeContext().getMapState(new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType));
rightState = getRuntimeContext().getMapState(new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType));
registeredTimer = getRuntimeContext().getState(new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG));
timerService = getInternalTimerService(TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this);
outRow = new JoinedRowData();
rightNullRow = new GenericRowData(rightType.toRowType().getFieldCount());
collector = new TimestampedCollector<>(output);
}
Aggregations