use of org.apache.flink.connector.hbase.options.HBaseLookupOptions in project flink by apache.
the class HBaseDynamicTableFactoryTest method testLookupOptions.
@Test
public void testLookupOptions() {
Map<String, String> options = getAllOptions();
options.put("lookup.cache.max-rows", "1000");
options.put("lookup.cache.ttl", "10s");
options.put("lookup.max-retries", "10");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()), Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
DynamicTableSource source = createTableSource(schema, options);
HBaseLookupOptions actual = ((HBaseDynamicTableSource) source).getLookupOptions();
HBaseLookupOptions expected = HBaseLookupOptions.builder().setCacheMaxSize(1000).setCacheExpireMs(10_000).setMaxRetryTimes(10).build();
assertEquals(expected, actual);
}
use of org.apache.flink.connector.hbase.options.HBaseLookupOptions in project flink by apache.
the class HBaseDynamicTableFactoryTest method testLookupOptions.
@Test
public void testLookupOptions() {
Map<String, String> options = getAllOptions();
options.put("lookup.cache.max-rows", "1000");
options.put("lookup.cache.ttl", "10s");
options.put("lookup.max-retries", "10");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()), Column.physical(FAMILY1, ROW(FIELD(COL1, DOUBLE()), FIELD(COL2, INT()))));
DynamicTableSource source = createTableSource(schema, options);
HBaseLookupOptions actual = ((HBaseDynamicTableSource) source).getLookupOptions();
HBaseLookupOptions expected = HBaseLookupOptions.builder().setCacheMaxSize(1000).setCacheExpireMs(10_000).setMaxRetryTimes(10).build();
assertEquals(expected, actual);
}
use of org.apache.flink.connector.hbase.options.HBaseLookupOptions in project flink by apache.
the class HBase2DynamicTableFactory method createDynamicTableSource.
@Override
public DynamicTableSource createDynamicTableSource(Context context) {
TableFactoryHelper helper = createTableFactoryHelper(this, context);
helper.validateExcept(PROPERTIES_PREFIX);
final ReadableConfig tableOptions = helper.getOptions();
validatePrimaryKey(context.getPhysicalRowDataType(), context.getPrimaryKeyIndexes());
String tableName = tableOptions.get(TABLE_NAME);
Configuration hbaseConf = getHBaseConfiguration(tableOptions);
HBaseLookupOptions lookupOptions = getHBaseLookupOptions(tableOptions);
String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
HBaseTableSchema hbaseSchema = HBaseTableSchema.fromDataType(context.getPhysicalRowDataType());
return new HBaseDynamicTableSource(hbaseConf, tableName, hbaseSchema, nullStringLiteral, lookupOptions);
}
use of org.apache.flink.connector.hbase.options.HBaseLookupOptions in project flink by apache.
the class HBaseRowDataAsyncLookupFunctionTest method buildRowDataAsyncLookupFunction.
private HBaseRowDataAsyncLookupFunction buildRowDataAsyncLookupFunction() {
HBaseLookupOptions lookupOptions = HBaseLookupOptions.builder().build();
if (useCache) {
lookupOptions = HBaseLookupOptions.builder().setCacheMaxSize(4).setCacheExpireMs(10000).build();
}
DataType dataType = ROW(FIELD(ROW_KEY, INT()), FIELD(FAMILY1, ROW(FIELD(F1COL1, INT()))), FIELD(FAMILY2, ROW(FIELD(F2COL1, STRING()), FIELD(F2COL2, BIGINT()))), FIELD(FAMILY3, ROW(FIELD(F3COL1, DOUBLE()), FIELD(F3COL2, DataTypes.BOOLEAN()), FIELD(F3COL3, STRING()))));
HBaseTableSchema hbaseSchema = HBaseTableSchema.fromDataType(dataType);
return new HBaseRowDataAsyncLookupFunction(getConf(), TEST_TABLE_1, hbaseSchema, "null", lookupOptions);
}
Aggregations