godfreyhe commented on code in PR #20577:
URL: https://github.com/apache/flink/pull/20577#discussion_r953545002
##########
docs/content/docs/dev/table/sql/queries/hints.md:
##########
@@ -84,4 +84,324 @@ insert into kafka_table1 /*+
OPTIONS('sink.partitioner'='round-robin') */ select
```
+## Query Hints
+
+### Join Hints
+
+#### LOOKUP Hint
+
+{{< label Streaming >}}
+
+The LOOKUP hint allows users to suggest the Flink optimizer to:
+1. use synchronous(sync) or asynchronous(async) lookup function
+2. configure the async parameters
+3. enable delayed retry strategy for lookup
+
+##### Syntax
+```sql
+SELECT /*+ LOOKUP(key=value[, key=value]*) */
+
+key:
+ stringLiteral
+
+value:
+ stringLiteral
+```
+
+#### LOOKUP Hint Options:
+
+<table class="table table-bordered">
+<thead>
+<tr>
+ <th>option type</th>
+ <th>option name</th>
+ <th>required</th>
+ <th>value type</th>
+ <th>default value</th>
+ <th class="text-left">description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+ <td rowspan="1">table</td>
+ <td>table</td>
+ <td>Y</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>the table name of the lookup source</td>
+</tr>
+<tr>
+ <td rowspan="4">async</td>
+ <td>async</td>
+ <td>N</td>
+ <td>boolean</td>
+ <td>N/A</td>
+ <td>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.</td>
+</tr>
+<tr>
+ <td>output-mode</td>
+ <td>N</td>
+ <td>string</td>
+ <td>ordered</td>
+ <td>value can be 'ordered' or 'allow_unordered'.<br />'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 <br
/>`ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE`.</td>
+</tr>
+<tr>
+ <td>capacity</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>100</td>
+ <td>the buffer capacity for the backend asyncWaitOperator of the lookup
join operator.</td>
+</tr>
+<tr>
+ <td>timeout</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>300s</td>
+ <td>timeout from first invoke to final completion of asynchronous
operation, may include multiple retries, and will be reset in case of
failover</td>
+</tr>
+<tr>
+ <td rowspan="4">retry</td>
+ <td>retry-predicate</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>can be 'lookup_miss' which will enable retry if lookup result is
empty.</td>
+</tr>
+<tr>
+ <td>retry-strategy</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>can be 'fixed_delay'</td>
+</tr>
+<tr>
+ <td>fixed-delay</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>N/A</td>
+ <td>delay time for the 'fixed_delay' strategy</td>
+</tr>
+<tr>
+ <td>max-attempts</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>N/A</td>
+ <td>max attempt number of the 'fixed_delay' strategy</td>
+</tr>
+</tbody>
+</table>
+
+Note:
+- 'table' option is required, only table name is supported(keep consistent
with which in the FROM clause), alias name is not supported currently(will be
supported in later versions).
+- async options are all optional, will use default value if not configured.
+- there is no default value for retry options, all retry options should be set
to valid values when need to enable retry.
+
+#### 1. Use Sync And Async Lookup Function
+If the connector has both capabilities of async and sync lookup, users can
give the option value 'async'='false'
+to suggest the planner to use the sync lookup or 'async'='true' to use the
async lookup:
+
+Example:
+```sql
+-- suggest the optimizer to use sync lookup
+LOOKUP('table'='Customers', 'async'='false')
+
+-- suggest the optimizer to use async lookup
+LOOKUP('table'='Customers', 'async'='true')
+```
+Note: the optimizer prefers async lookup if no 'async' option is specified, it
will always use sync lookup when:
+1. the connector only implements the sync lookup
+2. user enables 'TRY_RESOLVE' mode of
['table.optimizer.non-deterministic-update.strategy']({{ < ref
"docs/dev/table/config" > }}#table-optimizer-non-deterministic-update-strategy)
and the
Review Comment:
wrong display result:

##########
docs/content/docs/dev/table/sql/queries/hints.md:
##########
@@ -84,4 +84,324 @@ insert into kafka_table1 /*+
OPTIONS('sink.partitioner'='round-robin') */ select
```
+## Query Hints
+
+### Join Hints
+
+#### LOOKUP Hint
+
+{{< label Streaming >}}
+
+The LOOKUP hint allows users to suggest the Flink optimizer to:
+1. use synchronous(sync) or asynchronous(async) lookup function
+2. configure the async parameters
+3. enable delayed retry strategy for lookup
+
+##### Syntax
Review Comment:
`### Syntax`
##########
docs/content.zh/docs/dev/table/sql/queries/hints.md:
##########
@@ -79,4 +79,292 @@ 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 class="table table-bordered">
+<thead>
+<tr>
+ <th>选项类型</th>
+ <th>选项名称</th>
+ <th>必选</th>
+ <th>选项值类型</th>
+ <th>默认值</th>
+ <th class="text-left">选项说明</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+ <td rowspan="1">table</td>
+ <td>table</td>
+ <td>Y</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>查找源表的表名</td>
+</tr>
+<tr>
+ <td rowspan="4">async</td>
+ <td>async</td>
+ <td>N</td>
+ <td>boolean</td>
+ <td>N/A</td>
+ <td>值可以是 'true' 或 'false',
以建议优化器选择对应的查找函数。若底层的连接器无法提供建议模式的查找函数,提示就不会生效</td>
+</tr>
+<tr>
+ <td>output-mode</td>
+ <td>N</td>
+ <td>string</td>
+ <td>ordered</td>
+ <td>值可以是 'ordered' 或 'allow_unordered','allow_unordered' 代表用户允许不保序的输出,
在优化器判断不影响
+ 正确性的情况下会转成 `AsyncDataStream.OutputMode.UNORDERED`, 否则转成 `ORDERED`。
这与作业参数
+ `ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE` 是一致的</td>
+</tr>
+<tr>
+ <td>capacity</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>100</td>
+ <td>异步查找使用的底层 `AsyncWaitOperator` 算子的缓冲队列大小</td>
+</tr>
+<tr>
+ <td>timeout</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>300s</td>
+ <td>异步查找从第一次调用到最终查找完成的超时时间,可能包含了多次重试,在发生 failover 时会重置</td>
+</tr>
+<tr>
+ <td rowspan="4">retry</td>
+ <td>retry-predicate</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'lookup_miss',表示在查找结果为空是启用重试</td>
+</tr>
+<tr>
+ <td>retry-strategy</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'fixed_delay'</td>
+</tr>
+<tr>
+ <td>fixed-delay</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>N/A</td>
+ <td>固定延迟策略的延迟时长</td>
+</tr>
+<tr>
+ <td>max-attempts</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>N/A</td>
+ <td>固定延迟策略的最大重试次数</td>
+</tr>
+</tbody>
+</table>
+
+注意:其中
+- 'table' 是必选项,需要填写目标联接表的表名(和 FROM 子句引用的表名保持一致),注意当前不支持填写表的别名(这将在后续版本中支持)。
+- 异步查找参数可按需设置一个或多个,未设置的参数按默认值生效。
+- 重试查找参数没有默认值,在需要开启时所有参数都必须设置为有效值。
+
+#### 1. 使用同步或异步的查找函数
+如果连接器同时具备同步和异步查找能力,用户通过给出提示选项值 'async'='false' 来建议优化器选择同步查找, 或 'async'='true'
来建议选择异步查找。
+
+示例:
+```sql
+-- 建议优化器选择同步查找
+LOOKUP('table'='Customers', 'async'='false')
+
+-- 建议优化器选择异步查找
+LOOKUP('table'='Customers', 'async'='true')
+```
+注意:当没有指定 'async' 选项值时,优化器优先选择异步查找,在以下两种情况下优化器会选择同步查找:
+1. 当连接器仅实现了同步查找时
+2. 用户在参数 ['table.optimizer.non-deterministic-update.strategy']({{ < ref
"docs/dev/table/config" > }}#table-optimizer-non-deterministic-update-strategy)
上启用了 'TRY_RESOLVE' 模式,并且优化器推断用户查询中存在非确定性更新的潜在风险时
+
+#### 2. 配置异步查找相关参数
+在异步查找模式下,用户可通过提示选项直接配置异步查找相关参数
+
+示例:
+```sql
+-- 设置异步查找参数 'output-mode', 'capacity', 'timeout', 可按需设置单个或多个参数
+LOOKUP('table'='Customers', 'async'='true', 'output-mode'='allow_unordered',
'capacity'='100', 'timeout'='180s')
+```
+注意:联接提示上的异步查找参数和[作业级别配置参数]({{< ref "docs/dev/table/config"
>}}#execution-options)的
+含义是一致的,没有设置的参数值由默认值生效,另一个区别是联接提示作用的范围更小,仅限于当前联接操作中对应联接提示选项设置的表名(未被联接提示作用的其他联接查询不受影响)。
+
+例如:作业级别异步查找参数设置为
+```gitexclude
+table.exec.async-lookup.output-mode: ORDERED
+table.exec.async-lookup.buffer-capacity: 100
+table.exec.async-lookup.timeout: 180s
+```
+
+那么以下联接提示:
+```sql
+1. LOOKUP('table'='Customers', 'async'='true', 'output-mode'='allow_unordered')
+2. LOOKUP('table'='Customers', 'async'='true', 'timeout'='300s')
+```
+
+分别等价于:
+```sql
+1. LOOKUP('table'='Customers', 'async'='true',
'output-mode'='allow_unordered', 'capacity'='100', 'timeout'='180s')
+2. LOOKUP('table'='Customers', 'async'='true', 'output-mode'='ordered',
'capacity'='100', 'timeout'='300s')
+```
+
+#### 3. 启用延迟重试查找策略
+延迟重试查找希望解决流场景中经常遇到的维表数据更新延迟而不能被流数据正确关联的问题。通过提示选项
'retry-predicate'='lookup_miss'
+可设置查找结果为空的重试条件,同时设置重试策略参数来开启重试查找功能(同步或异步查找均可),当前仅支持固定延迟重试策略。
+
+固定延迟重试策略参数:
+```gitexclude
+'retry-strategy'='fixed_delay'
+-- 固定重试间隔
+'fixed-delay'
+-- 最大重试次数(从重试执行开始计数,比如最大重试次数设置为 1,则对某个具体查找键的一次查找处理实际最多执行 2 次查找请求)
+'max-attempts'
+```
+
+示例:
+1. 开启异步查找重试
+```sql
+LOOKUP('table'='Customers', 'async'='true', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+2. 开启同步查找重试
+```sql
+LOOKUP('table'='Customers', 'async'='false', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+若连接器仅实现了同步或异步中的一种查找能力,'async' 提示选项可以省略:
+```sql
+LOOKUP('table'='Customers', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+#### 进一步说明
+
+#### 开启缓存对重试的影响
+[FLIP-221](https://cwiki.apache.org/confluence/display/FLINK/FLIP-221%3A+Abstraction+for+lookup+source+cache+and+metric)
引入了对查找源表的缓存支持,
+缓存策略有部分缓存、全部缓存两种,当开启全部缓存时('lookup.cache'='FULL'),重试无法起作用(因为查找表被完整缓存,重试查找没有任何实际意义);当开启部分缓存时,当一条数据开始查找处理时,
+先在本地缓存中查找,如果没找到则通过连接器进行外部查找(如果存在,则立即返回),此时查不到的记录和不开启缓存时一样,会触发重试查找,重试结束时的结果即为最终的查找结果(在部分缓存模式下,更新本地缓存)。
+
+#### 关于查找键及 'retry-predicate'='lookup_miss' 重试条件的说明
+对不同的连接器,提供的索引查找能力可能是不同的,例如内置的 HBase 连接器,默认仅提供了基于 `rowkey` 的索引查找能力(未
+启用二级索引),而对于内置的 JDBC 连接器,默认情况下任何字段都可以被用作索引查找,这是物理存储的特性不同所决定的。
Review Comment:
ditto
##########
docs/content/docs/dev/table/sql/queries/hints.md:
##########
@@ -84,4 +84,324 @@ insert into kafka_table1 /*+
OPTIONS('sink.partitioner'='round-robin') */ select
```
+## Query Hints
+
+### Join Hints
+
+#### LOOKUP Hint
Review Comment:
how about merge them into `### LOOKUP Join Hints`
##########
docs/content.zh/docs/dev/table/sql/queries/hints.md:
##########
@@ -79,4 +79,292 @@ 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 class="table table-bordered">
+<thead>
+<tr>
+ <th>选项类型</th>
+ <th>选项名称</th>
+ <th>必选</th>
+ <th>选项值类型</th>
+ <th>默认值</th>
+ <th class="text-left">选项说明</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+ <td rowspan="1">table</td>
+ <td>table</td>
+ <td>Y</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>查找源表的表名</td>
+</tr>
+<tr>
+ <td rowspan="4">async</td>
+ <td>async</td>
+ <td>N</td>
+ <td>boolean</td>
+ <td>N/A</td>
+ <td>值可以是 'true' 或 'false',
以建议优化器选择对应的查找函数。若底层的连接器无法提供建议模式的查找函数,提示就不会生效</td>
+</tr>
+<tr>
+ <td>output-mode</td>
+ <td>N</td>
+ <td>string</td>
+ <td>ordered</td>
+ <td>值可以是 'ordered' 或 'allow_unordered','allow_unordered' 代表用户允许不保序的输出,
在优化器判断不影响
+ 正确性的情况下会转成 `AsyncDataStream.OutputMode.UNORDERED`, 否则转成 `ORDERED`。
这与作业参数
+ `ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE` 是一致的</td>
+</tr>
+<tr>
+ <td>capacity</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>100</td>
+ <td>异步查找使用的底层 `AsyncWaitOperator` 算子的缓冲队列大小</td>
+</tr>
+<tr>
+ <td>timeout</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>300s</td>
+ <td>异步查找从第一次调用到最终查找完成的超时时间,可能包含了多次重试,在发生 failover 时会重置</td>
+</tr>
+<tr>
+ <td rowspan="4">retry</td>
+ <td>retry-predicate</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'lookup_miss',表示在查找结果为空是启用重试</td>
+</tr>
+<tr>
+ <td>retry-strategy</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'fixed_delay'</td>
+</tr>
+<tr>
+ <td>fixed-delay</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>N/A</td>
+ <td>固定延迟策略的延迟时长</td>
+</tr>
+<tr>
+ <td>max-attempts</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>N/A</td>
+ <td>固定延迟策略的最大重试次数</td>
+</tr>
+</tbody>
+</table>
+
+注意:其中
+- 'table' 是必选项,需要填写目标联接表的表名(和 FROM 子句引用的表名保持一致),注意当前不支持填写表的别名(这将在后续版本中支持)。
+- 异步查找参数可按需设置一个或多个,未设置的参数按默认值生效。
+- 重试查找参数没有默认值,在需要开启时所有参数都必须设置为有效值。
+
+#### 1. 使用同步或异步的查找函数
+如果连接器同时具备同步和异步查找能力,用户通过给出提示选项值 'async'='false' 来建议优化器选择同步查找, 或 'async'='true'
来建议选择异步查找。
+
+示例:
+```sql
+-- 建议优化器选择同步查找
+LOOKUP('table'='Customers', 'async'='false')
+
+-- 建议优化器选择异步查找
+LOOKUP('table'='Customers', 'async'='true')
+```
+注意:当没有指定 'async' 选项值时,优化器优先选择异步查找,在以下两种情况下优化器会选择同步查找:
+1. 当连接器仅实现了同步查找时
+2. 用户在参数 ['table.optimizer.non-deterministic-update.strategy']({{ < ref
"docs/dev/table/config" > }}#table-optimizer-non-deterministic-update-strategy)
上启用了 'TRY_RESOLVE' 模式,并且优化器推断用户查询中存在非确定性更新的潜在风险时
+
+#### 2. 配置异步查找相关参数
+在异步查找模式下,用户可通过提示选项直接配置异步查找相关参数
+
+示例:
+```sql
+-- 设置异步查找参数 'output-mode', 'capacity', 'timeout', 可按需设置单个或多个参数
+LOOKUP('table'='Customers', 'async'='true', 'output-mode'='allow_unordered',
'capacity'='100', 'timeout'='180s')
+```
+注意:联接提示上的异步查找参数和[作业级别配置参数]({{< ref "docs/dev/table/config"
>}}#execution-options)的
+含义是一致的,没有设置的参数值由默认值生效,另一个区别是联接提示作用的范围更小,仅限于当前联接操作中对应联接提示选项设置的表名(未被联接提示作用的其他联接查询不受影响)。
+
+例如:作业级别异步查找参数设置为
+```gitexclude
+table.exec.async-lookup.output-mode: ORDERED
+table.exec.async-lookup.buffer-capacity: 100
+table.exec.async-lookup.timeout: 180s
+```
+
+那么以下联接提示:
+```sql
+1. LOOKUP('table'='Customers', 'async'='true', 'output-mode'='allow_unordered')
+2. LOOKUP('table'='Customers', 'async'='true', 'timeout'='300s')
+```
+
+分别等价于:
+```sql
+1. LOOKUP('table'='Customers', 'async'='true',
'output-mode'='allow_unordered', 'capacity'='100', 'timeout'='180s')
+2. LOOKUP('table'='Customers', 'async'='true', 'output-mode'='ordered',
'capacity'='100', 'timeout'='300s')
+```
+
+#### 3. 启用延迟重试查找策略
+延迟重试查找希望解决流场景中经常遇到的维表数据更新延迟而不能被流数据正确关联的问题。通过提示选项
'retry-predicate'='lookup_miss'
+可设置查找结果为空的重试条件,同时设置重试策略参数来开启重试查找功能(同步或异步查找均可),当前仅支持固定延迟重试策略。
+
+固定延迟重试策略参数:
+```gitexclude
+'retry-strategy'='fixed_delay'
+-- 固定重试间隔
+'fixed-delay'
+-- 最大重试次数(从重试执行开始计数,比如最大重试次数设置为 1,则对某个具体查找键的一次查找处理实际最多执行 2 次查找请求)
+'max-attempts'
+```
+
+示例:
+1. 开启异步查找重试
+```sql
+LOOKUP('table'='Customers', 'async'='true', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+2. 开启同步查找重试
+```sql
+LOOKUP('table'='Customers', 'async'='false', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+若连接器仅实现了同步或异步中的一种查找能力,'async' 提示选项可以省略:
+```sql
+LOOKUP('table'='Customers', 'retry-predicate'='lookup_miss',
'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3')
+```
+
+#### 进一步说明
+
+#### 开启缓存对重试的影响
+[FLIP-221](https://cwiki.apache.org/confluence/display/FLINK/FLIP-221%3A+Abstraction+for+lookup+source+cache+and+metric)
引入了对查找源表的缓存支持,
+缓存策略有部分缓存、全部缓存两种,当开启全部缓存时('lookup.cache'='FULL'),重试无法起作用(因为查找表被完整缓存,重试查找没有任何实际意义);当开启部分缓存时,当一条数据开始查找处理时,
+先在本地缓存中查找,如果没找到则通过连接器进行外部查找(如果存在,则立即返回),此时查不到的记录和不开启缓存时一样,会触发重试查找,重试结束时的结果即为最终的查找结果(在部分缓存模式下,更新本地缓存)。
Review Comment:
`当开启全部缓存时` -> `开启全部缓存时`
`当开启部分缓存时` -> `开启部分缓存时` otherwise, there are two `当`s
##########
docs/content.zh/docs/dev/table/sql/queries/hints.md:
##########
@@ -79,4 +79,292 @@ 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 class="table table-bordered">
+<thead>
+<tr>
+ <th>选项类型</th>
+ <th>选项名称</th>
+ <th>必选</th>
+ <th>选项值类型</th>
+ <th>默认值</th>
+ <th class="text-left">选项说明</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+ <td rowspan="1">table</td>
+ <td>table</td>
+ <td>Y</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>查找源表的表名</td>
+</tr>
+<tr>
+ <td rowspan="4">async</td>
+ <td>async</td>
+ <td>N</td>
+ <td>boolean</td>
+ <td>N/A</td>
+ <td>值可以是 'true' 或 'false',
以建议优化器选择对应的查找函数。若底层的连接器无法提供建议模式的查找函数,提示就不会生效</td>
+</tr>
+<tr>
+ <td>output-mode</td>
+ <td>N</td>
+ <td>string</td>
+ <td>ordered</td>
+ <td>值可以是 'ordered' 或 'allow_unordered','allow_unordered' 代表用户允许不保序的输出,
在优化器判断不影响
+ 正确性的情况下会转成 `AsyncDataStream.OutputMode.UNORDERED`, 否则转成 `ORDERED`。
这与作业参数
+ `ExecutionConfigOptions#TABLE_EXEC_ASYNC_LOOKUP_OUTPUT_MODE` 是一致的</td>
+</tr>
+<tr>
+ <td>capacity</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>100</td>
+ <td>异步查找使用的底层 `AsyncWaitOperator` 算子的缓冲队列大小</td>
+</tr>
+<tr>
+ <td>timeout</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>300s</td>
+ <td>异步查找从第一次调用到最终查找完成的超时时间,可能包含了多次重试,在发生 failover 时会重置</td>
+</tr>
+<tr>
+ <td rowspan="4">retry</td>
+ <td>retry-predicate</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'lookup_miss',表示在查找结果为空是启用重试</td>
+</tr>
+<tr>
+ <td>retry-strategy</td>
+ <td>N</td>
+ <td>string</td>
+ <td>N/A</td>
+ <td>可以是 'fixed_delay'</td>
+</tr>
+<tr>
+ <td>fixed-delay</td>
+ <td>N</td>
+ <td>duration</td>
+ <td>N/A</td>
+ <td>固定延迟策略的延迟时长</td>
+</tr>
+<tr>
+ <td>max-attempts</td>
+ <td>N</td>
+ <td>integer</td>
+ <td>N/A</td>
+ <td>固定延迟策略的最大重试次数</td>
+</tr>
+</tbody>
+</table>
+
+注意:其中
+- 'table' 是必选项,需要填写目标联接表的表名(和 FROM 子句引用的表名保持一致),注意当前不支持填写表的别名(这将在后续版本中支持)。
+- 异步查找参数可按需设置一个或多个,未设置的参数按默认值生效。
+- 重试查找参数没有默认值,在需要开启时所有参数都必须设置为有效值。
+
+#### 1. 使用同步或异步的查找函数
+如果连接器同时具备同步和异步查找能力,用户通过给出提示选项值 'async'='false' 来建议优化器选择同步查找, 或 'async'='true'
来建议选择异步查找。
+
+示例:
+```sql
+-- 建议优化器选择同步查找
+LOOKUP('table'='Customers', 'async'='false')
+
+-- 建议优化器选择异步查找
+LOOKUP('table'='Customers', 'async'='true')
+```
+注意:当没有指定 'async' 选项值时,优化器优先选择异步查找,在以下两种情况下优化器会选择同步查找:
+1. 当连接器仅实现了同步查找时
+2. 用户在参数 ['table.optimizer.non-deterministic-update.strategy']({{ < ref
"docs/dev/table/config" > }}#table-optimizer-non-deterministic-update-strategy)
上启用了 'TRY_RESOLVE' 模式,并且优化器推断用户查询中存在非确定性更新的潜在风险时
+
+#### 2. 配置异步查找相关参数
+在异步查找模式下,用户可通过提示选项直接配置异步查找相关参数
+
+示例:
+```sql
+-- 设置异步查找参数 'output-mode', 'capacity', 'timeout', 可按需设置单个或多个参数
+LOOKUP('table'='Customers', 'async'='true', 'output-mode'='allow_unordered',
'capacity'='100', 'timeout'='180s')
+```
+注意:联接提示上的异步查找参数和[作业级别配置参数]({{< ref "docs/dev/table/config"
>}}#execution-options)的
+含义是一致的,没有设置的参数值由默认值生效,另一个区别是联接提示作用的范围更小,仅限于当前联接操作中对应联接提示选项设置的表名(未被联接提示作用的其他联接查询不受影响)。
Review Comment:
no need new line here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]