Class TableDescriptor.Builder
- java.lang.Object
-
- org.apache.flink.table.api.TableDescriptor.Builder
-
- Enclosing class:
- TableDescriptor
@PublicEvolving public static class TableDescriptor.Builder extends Object
Builder forTableDescriptor
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder()
protected
Builder(TableDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableDescriptor
build()
Returns an immutable instance ofTableDescriptor
.TableDescriptor.Builder
comment(String comment)
Define the comment for this table.TableDescriptor.Builder
distributedBy(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets by the given columns.TableDescriptor.Builder
distributedBy(String... bucketKeys)
Defines that the table should be distributed into buckets over the given columns.TableDescriptor.Builder
distributedByHash(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets using a hash algorithm over the given columns.TableDescriptor.Builder
distributedByHash(String... bucketKeys)
Defines that the table should be distributed into buckets using a hash algorithm over the given columns.TableDescriptor.Builder
distributedByRange(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets using a range algorithm over the given columns.TableDescriptor.Builder
distributedByRange(String... bucketKeys)
Defines that the table should be distributed into buckets using a range algorithm over the given columns.TableDescriptor.Builder
distributedInto(int numberOfBuckets)
Defines that the table should be distributed into the given number of buckets.TableDescriptor.Builder
format(String format)
Defines theformat
to be used for this table.TableDescriptor.Builder
format(ConfigOption<String> formatOption, FormatDescriptor formatDescriptor)
Defines the format to be used for this table.TableDescriptor.Builder
format(FormatDescriptor formatDescriptor)
Defines the format to be used for this table.TableDescriptor.Builder
option(String key, String value)
Sets the given option on the table.<T> TableDescriptor.Builder
option(ConfigOption<T> configOption, T value)
Sets the given option on the table.TableDescriptor.Builder
partitionedBy(String... partitionKeys)
Define which columns this table is partitioned by.TableDescriptor.Builder
schema(Schema schema)
Define the schema of theTableDescriptor
.
-
-
-
Constructor Detail
-
Builder
protected Builder()
-
Builder
protected Builder(TableDescriptor descriptor)
-
-
Method Detail
-
schema
public TableDescriptor.Builder schema(@Nullable Schema schema)
Define the schema of theTableDescriptor
.The schema is typically required. It is optional only in cases where the schema can be inferred, e.g.
Table.insertInto(TableDescriptor)
.
-
option
public <T> TableDescriptor.Builder option(ConfigOption<T> configOption, T value)
Sets the given option on the table.
-
option
public TableDescriptor.Builder option(String key, String value)
Sets the given option on the table.Option keys must be fully specified. When defining options for a
format
, useformat(FormatDescriptor)
instead.Example:
TableDescriptor.forConnector("kafka") .option("scan.startup.mode", "latest-offset") .build();
-
format
public TableDescriptor.Builder format(String format)
Defines theformat
to be used for this table.Note that not every connector requires a format to be specified, while others may use multiple formats. In the latter case, use
format(ConfigOption, FormatDescriptor)
instead to specify for which option the format should be configured.
-
format
public TableDescriptor.Builder format(FormatDescriptor formatDescriptor)
Defines the format to be used for this table.Note that not every connector requires a format to be specified, while others may use multiple formats.
Options of the provided {@param formatDescriptor} are automatically prefixed. For example,
descriptorBuilder.format(FormatDescriptor.forFormat("json") .option(JsonOptions.IGNORE_PARSE_ERRORS, true) .build()
will result in the options
'format' = 'json' 'json.ignore-parse-errors' = 'true'
-
format
public TableDescriptor.Builder format(ConfigOption<String> formatOption, FormatDescriptor formatDescriptor)
Defines the format to be used for this table.Note that not every connector requires a format to be specified, while others may use multiple formats.
Options of the provided {@param formatDescriptor} are automatically prefixed. For example,
descriptorBuilder.format(KafkaOptions.KEY_FORMAT, FormatDescriptor.forFormat("json") .option(JsonOptions.IGNORE_PARSE_ERRORS, true) .build()
will result in the options
'key.format' = 'json' 'key.json.ignore-parse-errors' = 'true'
-
distributedByHash
public TableDescriptor.Builder distributedByHash(String... bucketKeys)
Defines that the table should be distributed into buckets using a hash algorithm over the given columns. The number of buckets is connector-defined.
-
distributedByHash
public TableDescriptor.Builder distributedByHash(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets using a hash algorithm over the given columns.
-
distributedByRange
public TableDescriptor.Builder distributedByRange(String... bucketKeys)
Defines that the table should be distributed into buckets using a range algorithm over the given columns. The number of buckets is connector-defined.
-
distributedByRange
public TableDescriptor.Builder distributedByRange(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets using a range algorithm over the given columns.
-
distributedBy
public TableDescriptor.Builder distributedBy(String... bucketKeys)
Defines that the table should be distributed into buckets over the given columns. The number of buckets and used algorithm are connector-defined.
-
distributedBy
public TableDescriptor.Builder distributedBy(int numberOfBuckets, String... bucketKeys)
Defines that the table should be distributed into the given number of buckets by the given columns. The used algorithm is connector-defined.
-
distributedInto
public TableDescriptor.Builder distributedInto(int numberOfBuckets)
Defines that the table should be distributed into the given number of buckets. The algorithm is connector-defined.
-
partitionedBy
public TableDescriptor.Builder partitionedBy(String... partitionKeys)
Define which columns this table is partitioned by.
-
comment
public TableDescriptor.Builder comment(@Nullable String comment)
Define the comment for this table.
-
build
public TableDescriptor build()
Returns an immutable instance ofTableDescriptor
.
-
-