use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class TemporalProcessTimeJoinOperator method open.
@Override
public void open() throws Exception {
super.open();
this.joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader());
FunctionUtils.setFunctionRuntimeContext(joinCondition, getRuntimeContext());
FunctionUtils.openFunction(joinCondition, new Configuration());
ValueStateDescriptor<RowData> rightStateDesc = new ValueStateDescriptor<>("right", rightType);
this.rightState = getRuntimeContext().getState(rightStateDesc);
this.collector = new TimestampedCollector<>(output);
this.outRow = new JoinedRowData();
this.rightNullRow = new GenericRowData(rightType.toRowSize());
// consider watermark from left stream only.
super.processWatermark2(Watermark.MAX_WATERMARK);
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class String2SortMergeJoinOperatorTest method testInnerJoin.
@Test
public void testInnerJoin() throws Exception {
StreamOperator joinOperator = newOperator(FlinkJoinType.INNER, leftIsSmall);
TwoInputStreamTaskTestHarness<BinaryRowData, BinaryRowData, JoinedRowData> testHarness = buildSortMergeJoin(joinOperator);
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
expectedOutput.add(new StreamRecord<>(newRow("a", "02")));
expectedOutput.add(new StreamRecord<>(newRow("b", "14")));
testHarness.waitForTaskCompletion();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, transformToBinary(testHarness.getOutput()));
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class String2SortMergeJoinOperatorTest method testRightOuterJoin.
@Test
public void testRightOuterJoin() throws Exception {
StreamOperator joinOperator = newOperator(FlinkJoinType.RIGHT, leftIsSmall);
TwoInputStreamTaskTestHarness<BinaryRowData, BinaryRowData, JoinedRowData> testHarness = buildSortMergeJoin(joinOperator);
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
expectedOutput.add(new StreamRecord<>(newRow("a", "02")));
expectedOutput.add(new StreamRecord<>(newRow("b", "14")));
expectedOutput.add(new StreamRecord<>(newRow("c", "2null")));
testHarness.waitForTaskCompletion();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, transformToBinary(testHarness.getOutput()));
}
use of org.apache.flink.table.data.utils.JoinedRowData in project flink by apache.
the class OuterJoinPaddingUtil method readObject.
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
joinedRow = new JoinedRowData();
initLeftNullPaddingRow();
initRightNullPaddingRow();
}
use of org.apache.flink.table.data.utils.JoinedRowData 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();
}
Aggregations