swuferhong commented on code in PR #20513:
URL: https://github.com/apache/flink/pull/20513#discussion_r954730986


##########
docs/content/docs/dev/table/sql/queries/hints.md:
##########
@@ -84,4 +84,244 @@ insert into kafka_table1 /*+ 
OPTIONS('sink.partitioner'='round-robin') */ select
 
 ```
 
+## Query Hints
+
+`Query Hints` specify that the indicated hints are used in the scope of a 
query. Their effective scope is current `Query 
+block` ([What are query blocks ?](#what-are-query-blocks-)) which `Query 
Hints` specified in. Now, Flink `Query Hints` support `Join Hints`.
+
+### Syntax
+The `Query Hints` syntax in Flink follows the syntax of `Query Hints` in 
Apache Calcite:
+```sql
+# Query Hints:
+SELECT /*+ hint [, hint ] */ ...
+
+hint:
+        hintName
+    |   hintName '(' optionKey '=' optionVal [, optionKey '=' optionVal ]* ')'
+    |   hintName '(' hintOption [, hintOption ]* ')'
+
+optionKey:
+        simpleIdentifier
+    |   stringLiteral
+
+optionVal:
+        stringLiteral
+
+hintOption:
+        simpleIdentifier
+    |   numericLiteral
+    |   stringLiteral
+```
+
+### Join Hints
+
+`Join Hints` allow users to suggest the join strategy to optimizer in order to 
get a more optimal execution plan. 
+Now Flink `Join Hints` support `BROADCAST`, `SHUFFLE_HASH`, `SHUFFLE_MERGE` 
and `NEST_LOOP` Join Hints. Also, for some cases,
+`Join Hints` will conflict, we try to formulate the behavior of `Join Hints` 
for these cases.
+
+*NOTE:* For all types of `Join Hints`, Flink support specifying multiple 
tables in a single `Join Hint` or multiple `Join Hints` like
+`BROADCAST(t1, t2, ..., tn)` or `BROADCAST(t1), BROADCAST(t2), ..., 
BROADCAST(tn)`. During query optimization, planner will
+automatically select the optimal join strategies according to the specified 
`Join Hints`.
+
+#### BROADCAST
+
+{{< label Batch >}}
+
+For this type of `Join Hints`, suggests that join use `BroadCast join` 
strategy. It performs well when the data volume of
+one side of table is very small. The join side with the hint will be broadcast 
regardless of `table.optimizer.join.broadcast-threshold`.
+
+*NOTE:* `BROADCAST Join Hint` only supports join with equivalence join 
condition. And it doesn't support `Full Outer Join`.

Review Comment:
   > `BROADCAST Join Hint` -> `BROADCAST`
   
   Done!



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to