xuyangzhong commented on code in PR #24077:
URL: https://github.com/apache/flink/pull/24077#discussion_r1467302542
##########
docs/content/docs/dev/table/sql/queries/hints.md:
##########
@@ -114,6 +114,42 @@ hintOption:
| stringLiteral
```
+### Conflict Cases In Query Hints
+#### Resolution of Key-value Hint Conflicts
+For key-value hints, which are provided in the following syntax:
+
+```sql
+hintName '(' optionKey '=' optionVal [, optionKey '=' optionVal ]* ')'
+```
+
+When Flink encounters conflicting in key-value hints, it adopts a
last-write-wins strategy. This means that
+if multiple hint values are provided for the same key, Flink will use the
value from the last hint specified
+in the query. For instance, consider the following SQL query with conflicting
'max-attempts' values in the LOOKUP hint:
+
+```sql
+SELECT /*+ LOOKUP('table'='D', 'max-attempts'='3', 'max-attempts'='4') */ *
FROM t1 T JOIN t2 AS OF T.proctime AS D ON T.id = D.id;
+```
+
+In this case, Flink will resolve the conflict by selecting the last specified
value for 'max-attempts'.
+Therefore, the effective hint for 'max-attempts' will be '4'.
+
+#### Resolution of List Hint Conflicts
+List hints are provided using the following syntax:
+
+```sql
+hintName '(' hintOption [, hintOption ]* ')'
+```
+
+With list hints, Flink resolves conflicts by adopting a first-accept strategy.
This means that the
+first specified hint in the list will take precedence and be effective.
+For example, consider the following SQL query with conflicting BROADCAST hints:
+```sql
+SELECT /*+ BROADCAST(t2, t1), BROADCAST(t1, t2) */ * FROM t1;
Review Comment:
ditto.
##########
docs/content.zh/docs/dev/table/sql/queries/hints.md:
##########
@@ -108,6 +108,39 @@ hintOption:
| stringLiteral
```
+### 查询提示使用中的冲突
+#### Key-value 类型查询提示的冲突处理
+Key-value 类型的查询提示使用如下语法:
+
+```sql
+hintName '(' optionKey '=' optionVal [, optionKey '=' optionVal ]* ')'
+```
+
+当 Key-value 类型的查询提示发生冲突时,Flink 会按顺序用后定义的查询提示覆盖前面定义的同名查询提示。
+对于下面的例子,包含同相同 key 的查询提示 'max-attempts':
+
+```sql
+SELECT /*+ LOOKUP('table'='D', 'max-attempts'='3', 'max-attempts'='4') */ *
FROM t1 T JOIN t2 AS OF T.proctime AS D ON T.id = D.id;
+```
+
+在这个例子里,Flink 会选择 'max-attempts' = '4' 的查询提示覆盖 'max-attempts' = '3' 的提示,
+所以最后 'max-attempts' 的值为 4。
+
+#### List 类型查询提示的冲突处理
+List 类型的查询提示使用如下语法:
+
+```sql
+hintName '(' hintOption [, hintOption ]* ')'
+```
+
+对于 List 类型的查询提示,Flink 会选择最先被采纳的查询提示。如下面具有相同 BROADCAST 提示的例子:
+
+```sql
+SELECT /*+ BROADCAST(t2, t1), BROADCAST(t1, t2) */ * FROM t1;
Review Comment:
The hint is invalid actually.
--
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]