org.apache.flink.table.sinks.AppendStreamTableSink Java Examples

The following examples show how to use org.apache.flink.table.sinks.AppendStreamTableSink. 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: KafkaJsonConnector.java    From AthenaX with Apache License 2.0 6 votes vote down vote up
@Override
public AppendStreamTableSink<Row> getAppendStreamTableSink(ExternalCatalogTable table) throws IOException {
  DescriptorProperties params = new DescriptorProperties(true);
  table.addProperties(params);
  String topic = params.getString(TOPIC_NAME_KEY);
  Properties conf = new Properties();
  conf.putAll(params.getPrefix(KAFKA_CONFIG_PREFIX));
  String partitionerClass = params.getOptionalString(PARTITIONER_CLASS_NAME_KEY)
      .orElse(PARTITIONER_CLASS_NAME_DEFAULT);
  FlinkKafkaPartitioner<Row> partitioner;
  try {
    partitioner = KafkaUtils.instantiatePartitioner(partitionerClass);
  } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
    throw new IOException(e);
  }
  return new Kafka09JsonTableSink(topic, conf, partitioner);
}
 
Example #2
Source File: MockTableSinkProvider.java    From AthenaX with Apache License 2.0 5 votes vote down vote up
@Override
public AppendStreamTableSink<Row> getAppendStreamTableSink(ExternalCatalogTable table) throws IOException {
  DescriptorProperties params = new DescriptorProperties(true);
  table.addProperties(params);
  TableSchema tableSchema = params.getTableSchema(MockExternalCatalogTable.TABLE_SCHEMA_CONNECTOR_PROPERTY);
  RowTypeInfo type = new RowTypeInfo(tableSchema.getTypes(), tableSchema.getColumnNames());
  return new MockAppendStreamTableSink(type);
}
 
Example #3
Source File: JobCompiler.java    From AthenaX with Apache License 2.0 4 votes vote down vote up
private AppendStreamTableSink<Row> getOutputTable(
    ExternalCatalogTable output) throws IOException {
  AthenaXTableSinkProvider c = TableSinkProviderRegistry.getProvider(output);
  Preconditions.checkNotNull(c, "Cannot find output connectors for " + output);
  return c.getAppendStreamTableSink(output);
}
 
Example #4
Source File: AthenaXTableSinkProvider.java    From AthenaX with Apache License 2.0 2 votes vote down vote up
/**
 * Construct an {@link AppendStreamTableSink} for streaming query.
 *
 * @param table
 *     The {@link ExternalCatalogTable} that contains all required information to
 *     construct an {@link AppendStreamTableSink} that accepts the same schema from the table.
 */
AppendStreamTableSink<Row> getAppendStreamTableSink(ExternalCatalogTable table) throws IOException;