This is an automated email from the ASF dual-hosted git repository. ron pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit b037f56b10c7dce4505ed6f4e28030350742a523 Author: fengli <ldliu...@163.com> AuthorDate: Mon May 6 20:07:09 2024 +0800 [FLINK-35195][table] Introduce materialized table reflated config options --- docs/content.zh/docs/dev/table/config.md | 6 +++ docs/content/docs/dev/table/config.md | 6 +++ .../materialized_table_config_configuration.html | 24 +++++++++ .../api/config/MaterializedTableConfigOptions.java | 59 ++++++++++++++++++++++ 4 files changed, 95 insertions(+) diff --git a/docs/content.zh/docs/dev/table/config.md b/docs/content.zh/docs/dev/table/config.md index f1a0be083c5..1748fde1b72 100644 --- a/docs/content.zh/docs/dev/table/config.md +++ b/docs/content.zh/docs/dev/table/config.md @@ -134,6 +134,12 @@ Flink SQL> SET 'table.exec.mini-batch.size' = '5000'; {{< generated/table_config_configuration >}} +### Materialized Table 配置 + +以下配置可以用于调整 Materialized Table 的行为。 + +{{< generated/materialized_table_config_configuration >}} + ### SQL Client 配置 以下配置可以用于调整 sql client 的行为。 diff --git a/docs/content/docs/dev/table/config.md b/docs/content/docs/dev/table/config.md index 697d820db4c..51a264414c8 100644 --- a/docs/content/docs/dev/table/config.md +++ b/docs/content/docs/dev/table/config.md @@ -149,6 +149,12 @@ The following options can be used to adjust the behavior of the table planner. {{< generated/table_config_configuration >}} +### Materialized Table Options + +The following options can be used to adjust the behavior of the materialized table. + +{{< generated/materialized_table_config_configuration >}} + ### SQL Client Options The following options can be used to adjust the behavior of the sql client. diff --git a/docs/layouts/shortcodes/generated/materialized_table_config_configuration.html b/docs/layouts/shortcodes/generated/materialized_table_config_configuration.html new file mode 100644 index 00000000000..d5829bf3224 --- /dev/null +++ b/docs/layouts/shortcodes/generated/materialized_table_config_configuration.html @@ -0,0 +1,24 @@ +<table class="configuration table table-bordered"> + <thead> + <tr> + <th class="text-left" style="width: 20%">Key</th> + <th class="text-left" style="width: 15%">Default</th> + <th class="text-left" style="width: 10%">Type</th> + <th class="text-left" style="width: 55%">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td><h5>materialized-table.refresh-mode.freshness-threshold</h5><br> <span class="label label-primary">Batch</span> <span class="label label-primary">Streaming</span></td> + <td style="word-wrap: break-word;">30 min</td> + <td>Duration</td> + <td>Specifies a time threshold for determining the materialized table refresh mode. If the materialized table defined FRESHNESS is below this threshold, it run in continuous mode. Otherwise, it switches to full refresh mode.</td> + </tr> + <tr> + <td><h5>partition.fields.#.date-formatter</h5><br> <span class="label label-primary">Batch</span> <span class="label label-primary">Streaming</span></td> + <td style="word-wrap: break-word;">(none)</td> + <td>String</td> + <td>Specifies the time partition formatter for the partitioned materialized table, where '#' denotes a string-based partition field name. This serves as a hint to the framework regarding which partition to refresh in full refresh mode.</td> + </tr> + </tbody> +</table> diff --git a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/MaterializedTableConfigOptions.java b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/MaterializedTableConfigOptions.java new file mode 100644 index 00000000000..b08466e05ab --- /dev/null +++ b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/MaterializedTableConfigOptions.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.api.config; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.annotation.docs.Documentation; +import org.apache.flink.configuration.ConfigOption; + +import java.time.Duration; + +import static org.apache.flink.configuration.ConfigOptions.key; + +/** + * This class holds {@link org.apache.flink.configuration.ConfigOption}s used by table module for + * materialized table. + */ +@PublicEvolving +public class MaterializedTableConfigOptions { + + private MaterializedTableConfigOptions() {} + + public static final String PARTITION_FIELDS = "partition.fields"; + public static final String DATE_FORMATTER = "date-formatter"; + + @Documentation.TableOption(execMode = Documentation.ExecMode.BATCH_STREAMING) + public static final ConfigOption<Duration> MATERIALIZED_TABLE_FRESHNESS_THRESHOLD = + key("materialized-table.refresh-mode.freshness-threshold") + .durationType() + .defaultValue(Duration.ofMinutes(30)) + .withDescription( + "Specifies a time threshold for determining the materialized table refresh mode." + + " If the materialized table defined FRESHNESS is below this threshold, it run in continuous mode." + + " Otherwise, it switches to full refresh mode."); + + @Documentation.TableOption(execMode = Documentation.ExecMode.BATCH_STREAMING) + public static final ConfigOption<String> PARTITION_FIELDS_DATE_FORMATTER = + key(String.format("%s.#.%s", PARTITION_FIELDS, DATE_FORMATTER)) + .stringType() + .noDefaultValue() + .withDescription( + "Specifies the time partition formatter for the partitioned materialized table, where '#' denotes a string-based partition field name." + + " This serves as a hint to the framework regarding which partition to refresh in full refresh mode."); +}