Search in sources :

Example 1 with GeneratedFunctionWrapper

use of org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper in project flink by apache.

the class AsyncLookupJoinHarnessTest method createHarness.

// ---------------------------------------------------------------------------------
@SuppressWarnings({ "unchecked", "rawtypes" })
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()), fetcherConverter, new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()), rightRowSerializer, isLeftJoin, ASYNC_BUFFER_CAPACITY);
    } else {
        joinRunner = new AsyncLookupJoinWithCalcRunner(new GeneratedFunctionWrapper(new TestingFetcherFunction()), fetcherConverter, new GeneratedFunctionWrapper<>(new CalculateOnTemporalTable()), new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()), rightRowSerializer, isLeftJoin, ASYNC_BUFFER_CAPACITY);
    }
    return new OneInputStreamOperatorTestHarness<>(new AsyncWaitOperatorFactory<>(joinRunner, ASYNC_TIMEOUT_MS, ASYNC_BUFFER_CAPACITY, AsyncDataStream.OutputMode.ORDERED), inSerializer);
}
Also used : AsyncLookupJoinRunner(org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinRunner) GenericRowData(org.apache.flink.table.data.GenericRowData) RowData(org.apache.flink.table.data.RowData) GeneratedFunctionWrapper(org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper) GeneratedResultFutureWrapper(org.apache.flink.table.runtime.generated.GeneratedResultFutureWrapper) OneInputStreamOperatorTestHarness(org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness) AsyncLookupJoinWithCalcRunner(org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinWithCalcRunner)

Example 2 with GeneratedFunctionWrapper

use of org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper in project flink by apache.

the class AsyncLookupJoinHarnessTest method testCloseAsyncLookupJoinRunner.

@Test
public void testCloseAsyncLookupJoinRunner() throws Exception {
    final AsyncLookupJoinRunner joinRunner = new AsyncLookupJoinRunner(new GeneratedFunctionWrapper(new TestingFetcherFunction()), fetcherConverter, new GeneratedResultFutureWrapper<>(new TestingFetcherResultFuture()), rightRowSerializer, true, 100);
    assertNull(joinRunner.getAllResultFutures());
    closeAsyncLookupJoinRunner(joinRunner);
    joinRunner.setRuntimeContext(new MockStreamingRuntimeContext(false, 1, 0));
    joinRunner.open(new Configuration());
    assertNotNull(joinRunner.getAllResultFutures());
    closeAsyncLookupJoinRunner(joinRunner);
    joinRunner.open(new Configuration());
    joinRunner.asyncInvoke(row(1, "a"), new TestingFetcherResultFuture());
    assertNotNull(joinRunner.getAllResultFutures());
    closeAsyncLookupJoinRunner(joinRunner);
}
Also used : AsyncLookupJoinRunner(org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinRunner) MockStreamingRuntimeContext(org.apache.flink.streaming.util.MockStreamingRuntimeContext) Configuration(org.apache.flink.configuration.Configuration) GeneratedFunctionWrapper(org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper) Test(org.junit.Test)

Example 3 with GeneratedFunctionWrapper

use of org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper in project flink by apache.

the class LookupJoinHarnessTest method createHarness.

// ---------------------------------------------------------------------------------
@SuppressWarnings("unchecked")
private OneInputStreamOperatorTestHarness<RowData, RowData> createHarness(JoinType joinType, FilterOnTable filterOnTable) throws Exception {
    boolean isLeftJoin = joinType == JoinType.LEFT_JOIN;
    ProcessFunction<RowData, RowData> joinRunner;
    if (filterOnTable == FilterOnTable.WITHOUT_FILTER) {
        joinRunner = new LookupJoinRunner(new GeneratedFunctionWrapper<>(new TestingFetcherFunction()), new GeneratedCollectorWrapper<>(new TestingFetcherCollector()), isLeftJoin, 2);
    } else {
        joinRunner = new LookupJoinWithCalcRunner(new GeneratedFunctionWrapper<>(new TestingFetcherFunction()), new GeneratedFunctionWrapper<>(new CalculateOnTemporalTable()), new GeneratedCollectorWrapper<>(new TestingFetcherCollector()), isLeftJoin, 2);
    }
    ProcessOperator<RowData, RowData> operator = new ProcessOperator<>(joinRunner);
    return new OneInputStreamOperatorTestHarness<>(operator, inSerializer);
}
Also used : ProcessOperator(org.apache.flink.streaming.api.operators.ProcessOperator) GeneratedFunctionWrapper(org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper) GeneratedCollectorWrapper(org.apache.flink.table.runtime.generated.GeneratedCollectorWrapper) LookupJoinRunner(org.apache.flink.table.runtime.operators.join.lookup.LookupJoinRunner) OneInputStreamOperatorTestHarness(org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness) GenericRowData(org.apache.flink.table.data.GenericRowData) RowData(org.apache.flink.table.data.RowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) LookupJoinWithCalcRunner(org.apache.flink.table.runtime.operators.join.lookup.LookupJoinWithCalcRunner)

Aggregations

GeneratedFunctionWrapper (org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper)3 OneInputStreamOperatorTestHarness (org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness)2 GenericRowData (org.apache.flink.table.data.GenericRowData)2 RowData (org.apache.flink.table.data.RowData)2 AsyncLookupJoinRunner (org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinRunner)2 Configuration (org.apache.flink.configuration.Configuration)1 ProcessOperator (org.apache.flink.streaming.api.operators.ProcessOperator)1 MockStreamingRuntimeContext (org.apache.flink.streaming.util.MockStreamingRuntimeContext)1 JoinedRowData (org.apache.flink.table.data.utils.JoinedRowData)1 GeneratedCollectorWrapper (org.apache.flink.table.runtime.generated.GeneratedCollectorWrapper)1 GeneratedResultFutureWrapper (org.apache.flink.table.runtime.generated.GeneratedResultFutureWrapper)1 AsyncLookupJoinWithCalcRunner (org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinWithCalcRunner)1 LookupJoinRunner (org.apache.flink.table.runtime.operators.join.lookup.LookupJoinRunner)1 LookupJoinWithCalcRunner (org.apache.flink.table.runtime.operators.join.lookup.LookupJoinWithCalcRunner)1 Test (org.junit.Test)1