org.apache.flink.streaming.api.functions.async.RichAsyncFunction Java Examples

The following examples show how to use org.apache.flink.streaming.api.functions.async.RichAsyncFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AsyncLookupJoinHarnessTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private OneInputStreamOperatorTestHarness<BaseRow, BaseRow> createHarness(
		JoinType joinType,
		FilterOnTable filterOnTable) throws Exception {
	RichAsyncFunction<BaseRow, BaseRow> joinRunner;
	boolean isLeftJoin = joinType == JoinType.LEFT_JOIN;
	if (filterOnTable == FilterOnTable.WITHOUT_FILTER) {
		joinRunner = new AsyncLookupJoinRunner(
			new GeneratedFunctionWrapper(new TestingFetcherFunction()),
			new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()),
			fetcherReturnType,
			rightRowTypeInfo,
			isLeftJoin,
			ASYNC_BUFFER_CAPACITY);
	} else {
		joinRunner = new AsyncLookupJoinWithCalcRunner(
			new GeneratedFunctionWrapper(new TestingFetcherFunction()),
			new GeneratedFunctionWrapper<>(new CalculateOnTemporalTable()),
			new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()),
			fetcherReturnType,
			rightRowTypeInfo,
			isLeftJoin,
			ASYNC_BUFFER_CAPACITY);
	}

	AsyncWaitOperator<BaseRow, BaseRow> operator = new AsyncWaitOperator<>(
		joinRunner,
		ASYNC_TIMEOUT_MS,
		ASYNC_BUFFER_CAPACITY,
		AsyncDataStream.OutputMode.ORDERED);

	return new OneInputStreamOperatorTestHarness<>(
		operator,
		inSerializer);
}
 
Example #2
Source File: AsyncLookupJoinHarnessTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private OneInputStreamOperatorTestHarness<RowData, RowData> createHarness(
		JoinType joinType,
		FilterOnTable filterOnTable) throws Exception {
	RichAsyncFunction<RowData, RowData> joinRunner;
	boolean isLeftJoin = joinType == JoinType.LEFT_JOIN;
	if (filterOnTable == FilterOnTable.WITHOUT_FILTER) {
		joinRunner = new AsyncLookupJoinRunner(
			new GeneratedFunctionWrapper(new TestingFetcherFunction()),
			new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()),
			fetcherReturnType,
			rightRowTypeInfo,
			isLeftJoin,
			ASYNC_BUFFER_CAPACITY);
	} else {
		joinRunner = new AsyncLookupJoinWithCalcRunner(
			new GeneratedFunctionWrapper(new TestingFetcherFunction()),
			new GeneratedFunctionWrapper<>(new CalculateOnTemporalTable()),
			new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()),
			fetcherReturnType,
			rightRowTypeInfo,
			isLeftJoin,
			ASYNC_BUFFER_CAPACITY);
	}

	return new OneInputStreamOperatorTestHarness<>(
		new AsyncWaitOperatorFactory<>(
			joinRunner,
			ASYNC_TIMEOUT_MS,
			ASYNC_BUFFER_CAPACITY,
			AsyncDataStream.OutputMode.ORDERED),
		inSerializer);
}