Issue on docs leading-hint
- Dominant language
- MDX
- Stars
- 133
- Forks
- 464
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 50
Description
- Page Link: https://doris.apache.org/zh-CN/docs/query-acceleration/hints/leading-hint#%E6%A1%88%E4%BE%8B
- Version: 2.1
- Reason: There is no difference in the execution plan before and after using the hint.(使用hint前后的执行计划没有区别,我理解这里想给读者呈现的内容是:使用hint后,plan会发生变化)
- Suggest: 我建议改为如下案例(我已经在本地的2.1.6环境验证)
第一步,建库表,并写入测试数据
```sql
CREATE DATABASE testleading;
USE testleading;
create table t1 (c1 int, c11 int) distributed by hash(c1) buckets 3 properties('replication_num' = '1');
create table t2 (c2 int, c22 int) distributed by hash(c2) buckets 3 properties('replication_num' = '1');
insert into t1 VALUES (1, 25), (2, 35), (3, 28), (4, 60), (5, 17);
insert into t2 VALUES (1, 25), (2, 35), (3, 28), (4, 60), (5, 17);
```
第二步,使用Hint前plan如下,t2表进行distribute,t1表不shuffle
```sql
explain shape plan select * from t1 join t2 on t1.c1 = c2;
Explain String
Planner: Nereids Planner
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) otherCondition=()
------PhysicalOlapScan[t1]
------PhysicalDistribute[DistributionSpecHash]
--------PhysicalOlapScan[t2]
```
第三步,使用hint后plan如下,t1和t2表的执行计划相反,t1表进行distribute,t2表不shuffle
```sql
explain shape plan select /*+ leading(t2 t1) */ * from t1 join t2 on c1 = c2;
Explain String
Planner: Nereids Planner
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----hashJoin[INNER_JOIN] hashCondition=((t1.c1 = t2.c2)) otherCondition=()
------PhysicalOlapScan[t2]
------PhysicalDistribute[DistributionSpecHash]
--------PhysicalOlapScan[t1]
Hint log:
Used: leading(t2 t1 )
UnUsed:
SyntaxError:
```
- May I contribute to this pull request? Our company has been frequently using Doris lately. If given the chance, I would also like to gradually become involved in the community.(如果确认该Issue的话,可以由我来提交PR吗,我很希望参与到doris社区当中)
- ScreenShot:

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.