yangyichao-mango opened a new issue, #2481:
URL: https://github.com/apache/doris-website/issues/2481

   - Page Link: 
https://doris.apache.org/zh-CN/docs/query-acceleration/hints/hints-overview
   
   - 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:
   
   
![Image](https://github.com/user-attachments/assets/c28a24d2-3b11-4c90-b730-9bfb3748d37b)
   


-- 
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: commits-unsubscr...@doris.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to