Search in sources :

Example 6 with SerializationSchema

use of org.apache.flink.api.common.serialization.SerializationSchema in project flink by apache.

the class TestDynamicTableFactory method createDynamicTableSink.

@Override
public DynamicTableSink createDynamicTableSink(Context context) {
    final TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context);
    final Optional<EncodingFormat<SerializationSchema<RowData>>> keyFormat = helper.discoverOptionalEncodingFormat(SerializationFormatFactory.class, KEY_FORMAT);
    final EncodingFormat<SerializationSchema<RowData>> valueFormat = helper.discoverOptionalEncodingFormat(SerializationFormatFactory.class, FORMAT).orElseGet(() -> helper.discoverEncodingFormat(SerializationFormatFactory.class, VALUE_FORMAT));
    helper.validate();
    return new DynamicTableSinkMock(helper.getOptions().get(TARGET), helper.getOptions().get(BUFFER_SIZE), keyFormat.orElse(null), valueFormat);
}
Also used : EncodingFormat(org.apache.flink.table.connector.format.EncodingFormat) RowData(org.apache.flink.table.data.RowData) SerializationSchema(org.apache.flink.api.common.serialization.SerializationSchema) TableFactoryHelper(org.apache.flink.table.factories.FactoryUtil.TableFactoryHelper)

Aggregations

SerializationSchema (org.apache.flink.api.common.serialization.SerializationSchema)6 AvroRowDataSerializationSchema (org.apache.flink.formats.avro.AvroRowDataSerializationSchema)3 ConfluentRegistryAvroSerializationSchema (org.apache.flink.formats.avro.registry.confluent.ConfluentRegistryAvroSerializationSchema)3 DebeziumAvroSerializationSchema (org.apache.flink.formats.avro.registry.confluent.debezium.DebeziumAvroSerializationSchema)3 DynamicTableSink (org.apache.flink.table.connector.sink.DynamicTableSink)3 RowData (org.apache.flink.table.data.RowData)3 EncodingFormatMock (org.apache.flink.table.factories.TestFormatFactory.EncodingFormatMock)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 ReadableConfig (org.apache.flink.configuration.ReadableConfig)2 EncodingFormat (org.apache.flink.table.connector.format.EncodingFormat)2 SinkV2Provider (org.apache.flink.table.connector.sink.SinkV2Provider)2 TableFactoryHelper (org.apache.flink.table.factories.FactoryUtil.TableFactoryHelper)2 SinkRuntimeProviderContext (org.apache.flink.table.runtime.connector.sink.SinkRuntimeProviderContext)2 Duration (java.time.Duration)1 Properties (java.util.Properties)1 DeliveryGuarantee (org.apache.flink.connector.base.DeliveryGuarantee)1 KafkaConnectorOptionsUtil.getKafkaProperties (org.apache.flink.streaming.connectors.kafka.table.KafkaConnectorOptionsUtil.getKafkaProperties)1 FactoryUtil (org.apache.flink.table.factories.FactoryUtil)1 DataType (org.apache.flink.table.types.DataType)1