use of org.apache.pulsar.common.schema.KeyValueEncodingType in project flink by apache.
the class KeyValueSchemaFactory method createSchema.
@Override
public Schema<KeyValue<K, V>> createSchema(SchemaInfo info) {
KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo = decodeKeyValueSchemaInfo(info);
Schema<K> keySchema = PulsarSchemaUtils.createSchema(kvSchemaInfo.getKey());
Schema<V> valueSchema = PulsarSchemaUtils.createSchema(kvSchemaInfo.getValue());
KeyValueEncodingType encodingType = decodeKeyValueEncodingType(info);
Schema<KeyValue<K, V>> schema = KeyValueSchemaImpl.of(keySchema, valueSchema, encodingType);
// Append extra class name into schema info properties.
// KeyValueSchema don't have custom properties builder method, we have to use side effects.
SchemaInfo schemaInfo = schema.getSchemaInfo();
Map<String, String> properties = schemaInfo.getProperties();
properties.put(CLASS_INFO_PLACEHOLDER, KeyValue.class.getName());
return schema;
}
Aggregations