use of org.apache.flink.table.connector.sink.DynamicTableSink in project flink by apache.
the class HBaseDynamicTableFactoryTest method testParallelismOptions.
@Test
public void testParallelismOptions() {
Map<String, String> options = getAllOptions();
options.put("sink.parallelism", "2");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
DynamicTableSink sink = createTableSink(schema, options);
assertTrue(sink instanceof HBaseDynamicTableSink);
HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
SinkFunctionProvider provider = (SinkFunctionProvider) hbaseSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
assertEquals(2, (long) provider.getParallelism().get());
}
use of org.apache.flink.table.connector.sink.DynamicTableSink in project flink by apache.
the class HBaseDynamicTableFactoryTest method testDisabledBufferFlushOptions.
@Test
public void testDisabledBufferFlushOptions() {
Map<String, String> options = getAllOptions();
options.put("sink.buffer-flush.max-size", "0");
options.put("sink.buffer-flush.max-rows", "0");
options.put("sink.buffer-flush.interval", "0");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
DynamicTableSink sink = createTableSink(schema, options);
HBaseWriteOptions expected = HBaseWriteOptions.builder().setBufferFlushMaxRows(0).setBufferFlushIntervalMillis(0).setBufferFlushMaxSizeInBytes(0).build();
HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
assertEquals(expected, actual);
}
use of org.apache.flink.table.connector.sink.DynamicTableSink in project flink by apache.
the class HiveDynamicTableFactory method createDynamicTableSink.
@Override
public DynamicTableSink createDynamicTableSink(Context context) {
final boolean isHiveTable = HiveCatalog.isHiveTable(context.getCatalogTable().getOptions());
// we don't support temporary hive tables yet
if (!isHiveTable || context.isTemporary()) {
DynamicTableSink sink = FactoryUtil.createDynamicTableSink(null, context.getObjectIdentifier(), context.getCatalogTable(), context.getConfiguration(), context.getClassLoader(), context.isTemporary());
if (sink instanceof RequireCatalogLock) {
((RequireCatalogLock) sink).setLockFactory(HiveCatalogLock.createFactory(hiveConf));
}
return sink;
}
final Integer configuredParallelism = Configuration.fromMap(context.getCatalogTable().getOptions()).get(FileSystemConnectorOptions.SINK_PARALLELISM);
final JobConf jobConf = JobConfUtils.createJobConfWithCredentials(hiveConf);
return new HiveTableSink(context.getConfiguration(), jobConf, context.getObjectIdentifier(), context.getCatalogTable(), configuredParallelism);
}
use of org.apache.flink.table.connector.sink.DynamicTableSink in project flink by apache.
the class HBaseDynamicTableFactoryTest method testDisabledBufferFlushOptions.
@Test
public void testDisabledBufferFlushOptions() {
Map<String, String> options = getAllOptions();
options.put("sink.buffer-flush.max-size", "0");
options.put("sink.buffer-flush.max-rows", "0");
options.put("sink.buffer-flush.interval", "0");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
DynamicTableSink sink = createTableSink(schema, options);
HBaseWriteOptions expected = HBaseWriteOptions.builder().setBufferFlushMaxRows(0).setBufferFlushIntervalMillis(0).setBufferFlushMaxSizeInBytes(0).build();
HBaseWriteOptions actual = ((HBaseDynamicTableSink) sink).getWriteOptions();
assertEquals(expected, actual);
}
use of org.apache.flink.table.connector.sink.DynamicTableSink in project flink by apache.
the class HBaseDynamicTableFactoryTest method testParallelismOptions.
@Test
public void testParallelismOptions() {
Map<String, String> options = getAllOptions();
options.put("sink.parallelism", "2");
ResolvedSchema schema = ResolvedSchema.of(Column.physical(ROWKEY, STRING()));
DynamicTableSink sink = createTableSink(schema, options);
assertTrue(sink instanceof HBaseDynamicTableSink);
HBaseDynamicTableSink hbaseSink = (HBaseDynamicTableSink) sink;
SinkFunctionProvider provider = (SinkFunctionProvider) hbaseSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
assertEquals(2, (long) provider.getParallelism().get());
}
Aggregations