Search in sources :

Example 1 with HBaseRowDataAsyncLookupFunction

use of org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction in project flink by apache.

the class HBaseDynamicTableFactoryTest method testLookupAsync.

@Test
public void testLookupAsync() {
    Map<String, String> options = getAllOptions();
    options.put("lookup.async", "true");
    ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()), Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
    DynamicTableSource source = createTableSource(schema, options);
    assertTrue(source instanceof HBaseDynamicTableSource);
    HBaseDynamicTableSource hbaseSource = (HBaseDynamicTableSource) source;
    int[][] lookupKey = { { 0 } };
    LookupTableSource.LookupRuntimeProvider lookupProvider = hbaseSource.getLookupRuntimeProvider(new LookupRuntimeProviderContext(lookupKey));
    assertTrue(lookupProvider instanceof AsyncTableFunctionProvider);
    AsyncTableFunction asyncTableFunction = ((AsyncTableFunctionProvider) lookupProvider).createAsyncTableFunction();
    assertTrue(asyncTableFunction instanceof HBaseRowDataAsyncLookupFunction);
    assertEquals("testHBastTable", ((HBaseRowDataAsyncLookupFunction) asyncTableFunction).getHTableName());
}
Also used : HBaseDynamicTableSource(org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource) HBaseRowDataAsyncLookupFunction(org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction) LookupRuntimeProviderContext(org.apache.flink.table.runtime.connector.source.LookupRuntimeProviderContext) AsyncTableFunctionProvider(org.apache.flink.table.connector.source.AsyncTableFunctionProvider) LookupTableSource(org.apache.flink.table.connector.source.LookupTableSource) ResolvedSchema(org.apache.flink.table.catalog.ResolvedSchema) AsyncTableFunction(org.apache.flink.table.functions.AsyncTableFunction) DynamicTableSource(org.apache.flink.table.connector.source.DynamicTableSource) HBaseDynamicTableSource(org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource) Test(org.junit.Test)

Aggregations

HBaseDynamicTableSource (org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource)1 HBaseRowDataAsyncLookupFunction (org.apache.flink.connector.hbase2.source.HBaseRowDataAsyncLookupFunction)1 ResolvedSchema (org.apache.flink.table.catalog.ResolvedSchema)1 AsyncTableFunctionProvider (org.apache.flink.table.connector.source.AsyncTableFunctionProvider)1 DynamicTableSource (org.apache.flink.table.connector.source.DynamicTableSource)1 LookupTableSource (org.apache.flink.table.connector.source.LookupTableSource)1 AsyncTableFunction (org.apache.flink.table.functions.AsyncTableFunction)1 LookupRuntimeProviderContext (org.apache.flink.table.runtime.connector.source.LookupRuntimeProviderContext)1 Test (org.junit.Test)1