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 for TableDescriptor.
  • Constructor Details

    • Builder

      protected Builder()
    • Builder

      protected Builder(TableDescriptor descriptor)
  • Method Details

    • schema

      public TableDescriptor.Builder schema(@Nullable org.apache.flink.table.api.Schema schema)
      Define the schema of the TableDescriptor.

      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(org.apache.flink.configuration.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, use format(FormatDescriptor) instead.

      Example:

      
       TableDescriptor.forConnector("kafka")
         .option("scan.startup.mode", "latest-offset")
         .build();
       
    • format

      public TableDescriptor.Builder format(String format)
      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. 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 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(org.apache.flink.configuration.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 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 of TableDescriptor.