Modifier and Type | Class and Description |
---|---|
static class |
FactoryUtil.TableFactoryHelper
Helper utility for discovering formats and validating all options for a
DynamicTableFactory . |
Modifier and Type | Field and Description |
---|---|
static org.apache.flink.configuration.ConfigOption<String> |
CONNECTOR |
static org.apache.flink.configuration.ConfigOption<String> |
FORMAT |
static String |
FORMAT_SUFFIX
Suffix for keys of
ConfigOption in case a connector requires multiple formats (e.g. |
static org.apache.flink.configuration.ConfigOption<Integer> |
PROPERTY_VERSION |
static org.apache.flink.configuration.ConfigOption<Integer> |
SINK_PARALLELISM |
Modifier and Type | Method and Description |
---|---|
static FactoryUtil.TableFactoryHelper |
createTableFactoryHelper(DynamicTableFactory factory,
DynamicTableFactory.Context context)
Creates a utility that helps in discovering formats and validating all options for a
DynamicTableFactory . |
static DynamicTableSink |
createTableSink(Catalog catalog,
ObjectIdentifier objectIdentifier,
CatalogTable catalogTable,
org.apache.flink.configuration.ReadableConfig configuration,
ClassLoader classLoader,
boolean isTemporary)
Creates a
DynamicTableSink from a CatalogTable . |
static DynamicTableSource |
createTableSource(Catalog catalog,
ObjectIdentifier objectIdentifier,
CatalogTable catalogTable,
org.apache.flink.configuration.ReadableConfig configuration,
ClassLoader classLoader,
boolean isTemporary)
Creates a
DynamicTableSource from a CatalogTable . |
static <T extends Factory> |
discoverFactory(ClassLoader classLoader,
Class<T> factoryClass,
String factoryIdentifier)
Discovers a factory using the given factory base class and identifier.
|
static void |
validateFactoryOptions(Factory factory,
org.apache.flink.configuration.ReadableConfig options)
Validates the required and optional
ConfigOption s of a factory. |
static void |
validateFactoryOptions(Set<org.apache.flink.configuration.ConfigOption<?>> requiredOptions,
Set<org.apache.flink.configuration.ConfigOption<?>> optionalOptions,
org.apache.flink.configuration.ReadableConfig options)
Validates the required options and optional options.
|
static void |
validateUnconsumedKeys(String factoryIdentifier,
Set<String> allOptionKeys,
Set<String> consumedOptionKeys)
Validates unconsumed option keys.
|
public static final org.apache.flink.configuration.ConfigOption<Integer> PROPERTY_VERSION
public static final org.apache.flink.configuration.ConfigOption<String> CONNECTOR
public static final org.apache.flink.configuration.ConfigOption<String> FORMAT
public static final org.apache.flink.configuration.ConfigOption<Integer> SINK_PARALLELISM
public static final String FORMAT_SUFFIX
ConfigOption
in case a connector requires multiple formats (e.g.
for both key and value).
See createTableFactoryHelper(DynamicTableFactory, DynamicTableFactory.Context)
for more information.
public static DynamicTableSource createTableSource(@Nullable Catalog catalog, ObjectIdentifier objectIdentifier, CatalogTable catalogTable, org.apache.flink.configuration.ReadableConfig configuration, ClassLoader classLoader, boolean isTemporary)
public static DynamicTableSink createTableSink(@Nullable Catalog catalog, ObjectIdentifier objectIdentifier, CatalogTable catalogTable, org.apache.flink.configuration.ReadableConfig configuration, ClassLoader classLoader, boolean isTemporary)
public static FactoryUtil.TableFactoryHelper createTableFactoryHelper(DynamicTableFactory factory, DynamicTableFactory.Context context)
DynamicTableFactory
.
The following example sketches the usage:
// in createDynamicTableSource()
helper = FactoryUtil.createTableFactoryHelper(this, context);
keyFormat = helper.discoverDecodingFormat(DeserializationFormatFactory.class, KEY_FORMAT);
valueFormat = helper.discoverDecodingFormat(DeserializationFormatFactory.class, VALUE_FORMAT);
helper.validate();
... // construct connector with discovered formats
Note: The format option parameter of FactoryUtil.TableFactoryHelper.discoverEncodingFormat(Class, ConfigOption)
and FactoryUtil.TableFactoryHelper.discoverDecodingFormat(Class, ConfigOption)
must be FORMAT
or
end with FORMAT_SUFFIX
. The discovery logic will replace 'format' with the factory
identifier value as the format prefix. For example, assuming the identifier is 'json', if the
format option key is 'format', then the format prefix is 'json.'. If the format option key is
'value.format', then the format prefix is 'value.json'. The format prefix is used to project
the options for the format factory.
Note: This utility checks for left-over options in the final step.
public static <T extends Factory> T discoverFactory(ClassLoader classLoader, Class<T> factoryClass, String factoryIdentifier)
This method is meant for cases where createTableFactoryHelper(DynamicTableFactory,
DynamicTableFactory.Context)
createTableSource(Catalog, ObjectIdentifier,
CatalogTable, ReadableConfig, ClassLoader, boolean)
, and createTableSink(Catalog,
ObjectIdentifier, CatalogTable, ReadableConfig, ClassLoader, boolean)
are not applicable.
public static void validateFactoryOptions(Factory factory, org.apache.flink.configuration.ReadableConfig options)
ConfigOption
s of a factory.
Note: It does not check for left-over options.
public static void validateFactoryOptions(Set<org.apache.flink.configuration.ConfigOption<?>> requiredOptions, Set<org.apache.flink.configuration.ConfigOption<?>> optionalOptions, org.apache.flink.configuration.ReadableConfig options)
Note: It does not check for left-over options.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.