diff --git a/docs/content.zh/docs/dev/table/sql/queries/hints.md b/docs/content.zh/docs/dev/table/sql/queries/hints.md index d6e14e192f953..f3afe1973fdfc 100644 --- a/docs/content.zh/docs/dev/table/sql/queries/hints.md +++ b/docs/content.zh/docs/dev/table/sql/queries/hints.md @@ -79,4 +79,289 @@ insert into kafka_table1 /*+ OPTIONS('sink.partitioner'='round-robin') */ select ``` +## 查询提示 + +### 联接提示 + +#### LOOKUP + +{{< label Streaming >}} + +LOOKUP 联接提示允许用户建议 Flink 优化器: +1. 使用同步或异步的查找函数 +2. 配置异步查找相关参数 +3. 启用延迟重试查找策略 + +#### 语法 +```sql +SELECT /*+ LOOKUP(hint_options) */ + +hint_options: key=value[, key=value]* + +key: + stringLiteral + +value: + stringLiteral +``` + +#### LOOKUP 提示选项: + +
| 选项类型 | +选项名称 | +必选 | +选项值类型 | +默认值 | +选项说明 | +
|---|---|---|---|---|---|
| table | +table | +Y | +string | +N/A | +查找源表的表名 | +
| async | +async | +N | +boolean | +N/A | +值可以是 'true' 或 'false', 以建议优化器选择对应的查找函数。若底层的连接器无法提供建议模式的查找函数,提示就不会生效 | +
| output-mode | +N | +string | +ordered | +值可以是 'ordered' 或 'allow_unordered','allow_unordered' 代表用户允许不保序的输出, 在优化器判断不影响 + 正确性的情况下会转成 `AsyncDataStream.OutputMode.UNORDERED`, 否则转成 `ORDERED`。 这与作业参数 + `ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE` 是一致的 | +|
| capacity | +N | +integer | +100 | +异步查找使用的底层 `AsyncWaitOperator` 算子的缓冲队列大小 | +|
| timeout | +N | +duration | +300s | +异步查找从第一次调用到最终查找完成的超时时间,可能包含了多次重试,在发生 failover 时会重置 | +|
| retry | +retry-predicate | +N | +string | +N/A | +可以是 'lookup_miss',表示在查找结果为空是启用重试 | +
| retry-strategy | +N | +string | +N/A | +可以是 'fixed_delay' | +|
| fixed-delay | +N | +duration | +N/A | +固定延迟策略的延迟时长 | +|
| max-attempts | +N | +integer | +N/A | +固定延迟策略的最大重试次数 | +
| option type | +option name | +required | +value type | +default value | +description | +
|---|---|---|---|---|---|
| table | +table | +Y | +string | +N/A | +the table name of the lookup source | +
| async | +async | +N | +boolean | +N/A | +value can be 'true' or 'false' to suggest the planner choose the corresponding lookup function. + If the backend lookup source does not support the suggested lookup mode, it will take no effect. | +
| output-mode | +N | +string | +ordered | +value can be 'ordered' or 'allow_unordered'. 'allow_unordered' means if users allow unordered result, it will attempt to use AsyncDataStream.OutputMode.UNORDERED when it does not affect the correctness of the result, otherwise ORDERED will be still used. It is consistent with `ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE`. |
+|
| capacity | +N | +integer | +100 | +the buffer capacity for the backend asyncWaitOperator of the lookup join operator. | +|
| timeout | +N | +duration | +300s | +timeout from first invoke to final completion of asynchronous operation, may include multiple retries, and will be reset in case of failover | +|
| retry | +retry-predicate | +N | +string | +N/A | +can be 'lookup_miss' which will enable retry if lookup result is empty. | +
| retry-strategy | +N | +string | +N/A | +can be 'fixed_delay' | +|
| fixed-delay | +N | +duration | +N/A | +delay time for the 'fixed_delay' strategy | +|
| max-attempts | +N | +integer | +N/A | +max attempt number of the 'fixed_delay' strategy | +