Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor](nereids) New distribute planner #36531

Merged
merged 37 commits into from
Jun 28, 2024

Conversation

924060929
Copy link
Contributor

@924060929 924060929 commented Jun 19, 2024

Proposed changes

The legacy coordinator act not only scheduler but also distribute planner. The code is so complex to understand, and hard to extend, and exist many limitations.

This pr extract and refine the computation of degree of parallel(dop) to a new DistributePlanner and resolve the limitations.

How to use this function

This function only use for nereids + pipelinex, and current only support query statement, and non cloud mode.
Open this session variables to use this function:

set enable_nereids_distribute_planner=true; -- default is false
set enable_nereids_planner=true;  -- default is true

Core process and concepts

                                                                                                                              
 ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ 
 │                                                                                                                          │ 
 │             ┌──────────────┐         ┌───────────────┐          ┌───────────────────┐        ┌─────────────────────────┐ │ 
 │  Translate  │              │  Typed  │               │  Assign  │                   │  Wrap  │                         │ │ 
 │ ──────────► │ PlanFragment │ ──────► │ UnassignedJob │ ───────► │ StaticAssignedJob │ ─────► │ PipelineDistributedPlan │ │ 
 │             │              │         │               │          │                   │        │                         │ │ 
 │             └──────────────┘         └───────────────┘          └───────────────────┘        └─────────────────────────┘ │ 
 │                                                                                                                          │ 
 └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                                                              
 │                                                                                                                          │ 
 │                                                                                                                          │ 
 └──────────────────────────────────────────────────┐                 ┌─────────────────────────────────────────────────────┘ 
                                                    │                 │                                                       
                                                    │                 │                                                       
                                                                                                                              
                      ┌──────────────┐              ┌─────────────────┐         ┌───────────────────┐                         
                      │              │  Distribute  │                 │  AdHoc  │                   │                         
                      │ PhysicalPlan │ ───────────► │ DistributedPlan │ ──────► │ PipelineScheduler │                         
                      │              │              │                 │         │                   │                         
                      └──────────────┘              └─────────────────┘         └───────────────────┘                         
                                                                                                                              

DistributePlanner is a new planner to compute dop and generate instances, it consume PlanFragment and do this tasks

  1. Use PlanFragment to generate UnassignedJob, it's a Typed Fragment, decided how to calculate dop and how to select the datasource, but this fragment not yet assigned some backends and datasources. These are some unassignedJobs: UnassignedScanSingleOlapTableJob, UnassignedScanBucketOlapTableJob, UnassignedShuffleJob, UnassignedQueryConstantJob. Keep UnassignedJob different can decoupling unrelated logic, and easy to extend: just and a new type of UnassignedJob.
  2. Use UnassignedJob to select datasource, compute dop, and generate AssignedJob, means a instance, which already assigned datasource and backend. There are StaticAssignedJob and LocalShuffleAssignedJob, we will add DynamicAssignedJob when support StageScheduler and adaptive query execution
  3. Wrap PlanFragment, UnassignedJob and AssignedJob to PipelineDistributedPlan, the coordinator will consume the DistributedPlan and translate to TPlan and schedule instances

Resolve limitations

1. left table shuffle to right table
if right table has distribution which distribute by storage hash, and left table has distribution which distribute by compute hash, we can shuffle left to right by storage hash to do shuffle bucket join, and keep right side not move.

select *
from
(
  select id2
  from test_shuffle_left
  group by id2
) a
inner join [shuffle]
test_shuffle_left b
on a.id2=b.id;

| PhysicalResultSink[288] ( outputExprs=[id2#1, id#2, id2#3] )                                                                                                                                ...
| +--PhysicalHashJoin[285]@4 ( type=INNER_JOIN, stats=3, hashCondition=[(id2#1 = id#2)], otherCondition=[], markCondition=[], hint=[shuffle] )                                                ...
|    |--PhysicalDistribute[281]@2 ( stats=1.5, distributionSpec=DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=STORAGE_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=...
|    |  +--PhysicalHashAggregate[278]@2 ( aggPhase=GLOBAL, aggMode=BUFFER_TO_RESULT, maybeUseStreaming=false, groupByExpr=[id2#1], outputExpr=[id2#1], partitionExpr=Optional[[id2#1]], requir...
|    |     +--PhysicalDistribute[275]@7 ( stats=1.5, distributionSpec=DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, parti...
|    |        +--PhysicalHashAggregate[272]@7 ( aggPhase=LOCAL, aggMode=INPUT_TO_BUFFER, maybeUseStreaming=true, groupByExpr=[id2#1], outputExpr=[id2#1], partitionExpr=Optional[[id2#1]], req...
|    |           +--PhysicalProject[269]@1 ( stats=3, projects=[id2#1] )                                                                                                                      ...
|    |              +--PhysicalOlapScan[test_shuffle_left]@0 ( stats=3 )                                                                                                                      ...
|    +--PhysicalOlapScan[test_shuffle_left]@3 ( stats=3 )

2. support colocate union numbers function
support use one instance to union/join numbers, note this plan no any PhysicalDistribute plan:

explain physical plan
select * from numbers('number'='3')a
union all
select * from numbers('number'='4')b

PhysicalResultSink[98] ( outputExprs=[number#2] )
+--PhysicalUnion@ ( qualifier=ALL, outputs=[number#2], regularChildrenOutputs=[[number#0], [number#1]], constantExprsList=[], stats=7 )
   |--PhysicalTVFRelation ( qualified=NumbersTableValuedFunction, output=[number#0], function=numbers('number' = '3') )
   +--PhysicalTVFRelation ( qualified=NumbersTableValuedFunction, output=[number#1], function=numbers('number' = '4') )

3. support bucket prune with right outer bucket shuffle join
left table prune some buckets, say [bucket 1, bucket 3]

we should process the right bucket shuffle join like this

[
  (left bucket 1) right outer join (exchange right table which should process by bucket 1),
  (empty bucket) right outer join (exchange right table which should process by bucket 2),
  (left bucket 3) right outer join (exchange right table which should process by bucket 3)
]

the left bucket 2 is pruned, so right table can not shuffle to left, because the left instance not exists, so bucket 2 will return empty rows and wrong.

new DistributePlanner can fill up this instance.

the case:

explain physical plan
SELECT * FROM
(select * from test_outer_join1 where c0 =1)a
RIGHT OUTER JOIN
(select * from test_outer_join2)b
ON a.c0 = b.c0

New feature

add an explain statement to show distributed plans

explain distributed plan select ...

for example, you can use this function to check how many instances generated, how many bytes the instance will scan, which backend will process the instance:

MySQL root@127.0.0.1:test> explain distributed plan select * from test_shuffle_left2 a join [shuffle] test_shuffle_left2 b on a.id2=b.id;
Explain String(Nereids Planner)
-------------------------------------------------------------------------------------------------------
PipelineDistributedPlan(
  id: 0,
  parallel: 2,
  fragmentJob: UnassignedScanSingleOlapTableJob,
  fragment: {
    OUTPUT EXPRS:
      id[#8]
      id2[#9]
      id[#10]
      id2[#11]
    PARTITION: HASH_PARTITIONED: id2[#3]

    HAS_COLO_PLAN_NODE: false

    VRESULT SINK
       MYSQL_PROTOCAL

    3:VHASH JOIN(152)
    |  join op: INNER JOIN(PARTITIONED)[]
    |  equal join conjunct: (id2[#3] = id[#0])
    |  cardinality=3
    |  vec output tuple id: 3
    |  output tuple id: 3
    |  vIntermediate tuple ids: 2
    |  hash output slot ids: 0 1 2 3
    |  isMarkJoin: false
    |  final projections: id[#4], id2[#5], id[#6], id2[#7]
    |  final project output tuple id: 3
    |  distribute expr lists: id2[#3]
    |  distribute expr lists: id[#0]
    |  tuple ids: 1 0
    |
    |----0:VOlapScanNode(149)
    |       TABLE: test.test_shuffle_left2(test_shuffle_left2), PREAGGREGATION: ON
    |       partitions=1/1 (test_shuffle_left2)
    |       tablets=10/10, tabletList=22038,22040,22042 ...
    |       cardinality=3, avgRowSize=0.0, numNodes=1
    |       pushAggOp=NONE
    |       tuple ids: 0
    |
    2:VEXCHANGE
       offset: 0
       distribute expr lists: id[#2]
       tuple ids: 1
  },
  instanceJobs: [
    LocalShuffleAssignedJob(
      index: 0,
      worker: BackendWorker(id: 10095, address: 192.168.126.1:9050),
      shareScanIndex: 0,
      scanSource: [
        {
          scanNode: OlapScanNode{id=0, tid=0, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 400, ranges: [
            tablet 22038, bytes: 0,
            tablet 22042, bytes: 0,
            tablet 22046, bytes: 0,
            tablet 22050, bytes: 400,
            tablet 22054, bytes: 0
          ])
        }
      ]
    ),
    LocalShuffleAssignedJob(
      index: 1,
      worker: BackendWorker(id: 10096, address: 192.168.126.2:9051),
      shareScanIndex: 1,
      scanSource: [
        {
          scanNode: OlapScanNode{id=0, tid=0, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 796, ranges: [
            tablet 22040, bytes: 397,
            tablet 22044, bytes: 0,
            tablet 22048, bytes: 399,
            tablet 22052, bytes: 0,
            tablet 22056, bytes: 0
          ])
        }
      ]
    )
  ]
)
PipelineDistributedPlan(
  id: 1,
  parallel: 2,
  fragmentJob: UnassignedScanSingleOlapTableJob,
  fragment: {
    PARTITION: HASH_PARTITIONED: id[#2]

    HAS_COLO_PLAN_NODE: false

    STREAM DATA SINK
      EXCHANGE ID: 02
      HASH_PARTITIONED: id2[#3]

    1:VOlapScanNode(145)
       TABLE: test.test_shuffle_left2(test_shuffle_left2), PREAGGREGATION: ON
       partitions=1/1 (test_shuffle_left2)
       tablets=10/10, tabletList=22038,22040,22042 ...
       cardinality=3, avgRowSize=0.0, numNodes=1
       pushAggOp=NONE
       tuple ids: 1
  },
  instanceJobs: [
    LocalShuffleAssignedJob(
      index: 0,
      worker: BackendWorker(id: 10095, address: 192.168.126.1:9050),
      shareScanIndex: 0,
      scanSource: [
        {
          scanNode: OlapScanNode{id=1, tid=1, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 400, ranges: [
            tablet 22038, bytes: 0,
            tablet 22042, bytes: 0,
            tablet 22046, bytes: 0,
            tablet 22050, bytes: 400,
            tablet 22054, bytes: 0
          ])
        }
      ]
    ),
    LocalShuffleAssignedJob(
      index: 1,
      worker: BackendWorker(id: 10096, address: 192.168.126.2:9051),
      shareScanIndex: 1,
      scanSource: [
        {
          scanNode: OlapScanNode{id=1, tid=1, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 796, ranges: [
            tablet 22040, bytes: 397,
            tablet 22044, bytes: 0,
            tablet 22048, bytes: 399,
            tablet 22052, bytes: 0,
            tablet 22056, bytes: 0
          ])
        }
      ]
    )
  ]
)



Hint log:
Used: [shuffle]_2
UnUsed:
SyntaxError:

TODO

  1. extract PipelineScheduler from Coordinator
  2. move this framework into cascades and compute cost by dop
  3. support StageScheduler, adaptive query execution and DynamicAssignedJob

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@924060929 924060929 marked this pull request as draft June 19, 2024 07:52
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39675 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit ad458e88aa03b080df81710f744521b476defdda, data reload: false

------ Round 1 ----------------------------------
q1	17674	4320	4240	4240
q2	2023	190	200	190
q3	10524	1152	1052	1052
q4	10205	807	831	807
q5	7780	2703	2665	2665
q6	225	142	142	142
q7	983	639	613	613
q8	9330	2037	2085	2037
q9	8885	6469	6443	6443
q10	8954	3747	3681	3681
q11	460	243	239	239
q12	464	237	222	222
q13	17770	2987	3011	2987
q14	259	219	222	219
q15	524	474	465	465
q16	517	391	390	390
q17	961	677	714	677
q18	7954	7417	7395	7395
q19	6503	1483	1384	1384
q20	644	309	344	309
q21	4916	3178	3912	3178
q22	405	340	346	340
Total cold run time: 117960 ms
Total hot run time: 39675 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4440	4208	4244	4208
q2	375	272	269	269
q3	2979	2744	2744	2744
q4	1840	1596	1658	1596
q5	5256	5272	5296	5272
q6	211	124	126	124
q7	2110	1731	1756	1731
q8	3183	3314	3281	3281
q9	8234	8289	8314	8289
q10	3864	3656	3649	3649
q11	602	488	515	488
q12	757	596	639	596
q13	16400	2992	3008	2992
q14	285	262	250	250
q15	533	485	482	482
q16	458	419	427	419
q17	1740	1480	1436	1436
q18	7640	7647	7373	7373
q19	1734	1473	1480	1473
q20	1994	1781	1765	1765
q21	4801	4712	4596	4596
q22	620	557	559	557
Total cold run time: 70056 ms
Total hot run time: 53590 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 171860 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit ad458e88aa03b080df81710f744521b476defdda, data reload: false

query1	941	380	378	378
query2	6475	2408	2296	2296
query3	6646	204	207	204
query4	19503	17153	17067	17067
query5	4222	491	448	448
query6	247	162	162	162
query7	4596	293	299	293
query8	323	320	291	291
query9	8560	2399	2359	2359
query10	597	294	277	277
query11	10428	10038	9842	9842
query12	132	90	82	82
query13	1643	368	360	360
query14	8637	6979	7778	6979
query15	250	191	186	186
query16	7752	265	258	258
query17	1908	533	525	525
query18	1720	267	270	267
query19	205	155	152	152
query20	91	83	110	83
query21	214	122	120	120
query22	4281	4045	3970	3970
query23	33790	32912	32905	32905
query24	10991	2867	2837	2837
query25	647	359	354	354
query26	1466	158	177	158
query27	2809	323	315	315
query28	7324	2046	2031	2031
query29	966	619	608	608
query30	295	151	147	147
query31	936	733	744	733
query32	97	52	55	52
query33	766	290	278	278
query34	959	469	458	458
query35	750	610	595	595
query36	1092	905	913	905
query37	145	69	66	66
query38	2838	2765	2737	2737
query39	842	792	787	787
query40	269	138	134	134
query41	60	55	54	54
query42	118	98	100	98
query43	579	537	551	537
query44	1252	714	727	714
query45	192	167	171	167
query46	1079	706	704	704
query47	1832	1756	1779	1756
query48	373	297	307	297
query49	1153	408	398	398
query50	758	389	373	373
query51	6763	6743	6655	6655
query52	105	88	98	88
query53	358	289	286	286
query54	955	433	435	433
query55	74	73	74	73
query56	284	248	253	248
query57	1123	1040	1044	1040
query58	244	237	264	237
query59	3408	3142	3110	3110
query60	298	309	276	276
query61	95	91	92	91
query62	643	442	463	442
query63	329	286	282	282
query64	9962	2213	1801	1801
query65	3154	3125	3116	3116
query66	1320	329	340	329
query67	15537	15020	14916	14916
query68	4556	525	532	525
query69	452	295	294	294
query70	1081	1147	1099	1099
query71	386	267	259	259
query72	7017	5489	5483	5483
query73	748	313	326	313
query74	5911	5531	5445	5445
query75	3410	2694	2651	2651
query76	2743	976	922	922
query77	454	304	299	299
query78	10396	9825	9729	9729
query79	2741	508	503	503
query80	1020	467	465	465
query81	579	215	214	214
query82	1043	109	100	100
query83	257	167	166	166
query84	236	89	81	81
query85	1327	289	277	277
query86	438	326	314	314
query87	3265	3120	3149	3120
query88	3693	2335	2322	2322
query89	464	392	373	373
query90	1825	187	186	186
query91	130	100	99	99
query92	73	48	50	48
query93	2069	513	494	494
query94	1310	180	181	180
query95	401	313	314	313
query96	591	265	272	265
query97	3236	3075	3116	3075
query98	206	196	197	196
query99	1134	830	861	830
Total cold run time: 271593 ms
Total hot run time: 171860 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.82 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit ad458e88aa03b080df81710f744521b476defdda, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.05	0.05
query4	1.68	0.08	0.09
query5	0.50	0.49	0.49
query6	1.13	0.74	0.73
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.54	0.48	0.48
query10	0.54	0.56	0.54
query11	0.15	0.11	0.12
query12	0.15	0.12	0.12
query13	0.60	0.59	0.60
query14	0.75	0.80	0.76
query15	0.85	0.81	0.80
query16	0.37	0.36	0.37
query17	1.04	1.04	1.05
query18	0.21	0.25	0.24
query19	1.86	1.77	1.77
query20	0.01	0.02	0.01
query21	15.42	0.66	0.65
query22	4.82	6.67	1.98
query23	18.26	1.39	1.32
query24	2.16	0.23	0.22
query25	0.16	0.09	0.09
query26	0.27	0.17	0.18
query27	0.08	0.08	0.08
query28	13.22	1.02	1.00
query29	12.63	3.37	3.33
query30	0.26	0.06	0.05
query31	2.86	0.39	0.39
query32	3.28	0.47	0.49
query33	2.90	2.86	3.03
query34	16.97	4.46	4.41
query35	4.46	4.47	4.49
query36	0.66	0.46	0.47
query37	0.18	0.15	0.15
query38	0.15	0.14	0.14
query39	0.05	0.03	0.03
query40	0.18	0.14	0.15
query41	0.09	0.04	0.05
query42	0.06	0.04	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.96 s
Total hot run time: 30.82 s

@924060929
Copy link
Contributor Author

run buildall

1 similar comment
@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40445 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 488bf7991196f78c55ae42baa69cd826db4fcbae, data reload: false

------ Round 1 ----------------------------------
q1	17612	4902	4297	4297
q2	2025	187	190	187
q3	10459	1113	1140	1113
q4	10172	804	799	799
q5	7451	2730	2672	2672
q6	218	136	135	135
q7	975	623	597	597
q8	9229	2070	2097	2070
q9	9038	6502	6506	6502
q10	8904	3687	3760	3687
q11	456	244	234	234
q12	462	224	229	224
q13	17948	2990	2993	2990
q14	266	226	227	226
q15	518	481	477	477
q16	486	382	376	376
q17	972	653	630	630
q18	8407	7932	7845	7845
q19	7692	1558	1516	1516
q20	676	329	313	313
q21	5188	3216	4091	3216
q22	399	339	367	339
Total cold run time: 119553 ms
Total hot run time: 40445 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4686	4396	4428	4396
q2	367	274	278	274
q3	3061	2804	2953	2804
q4	2074	1746	1800	1746
q5	5609	5622	5640	5622
q6	218	129	126	126
q7	2228	1839	1863	1839
q8	3255	3439	3446	3439
q9	8753	8750	8669	8669
q10	4104	3859	3949	3859
q11	597	488	506	488
q12	870	661	658	658
q13	16004	3027	3097	3027
q14	297	269	268	268
q15	529	461	493	461
q16	513	446	440	440
q17	1843	1534	1503	1503
q18	8108	7954	7857	7857
q19	1804	1530	1754	1530
q20	3249	1873	1840	1840
q21	9950	4828	4895	4828
q22	620	569	580	569
Total cold run time: 78739 ms
Total hot run time: 56243 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174224 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 488bf7991196f78c55ae42baa69cd826db4fcbae, data reload: false

query1	796	395	380	380
query2	6405	2590	2319	2319
query3	6410	203	207	203
query4	18558	17208	17339	17208
query5	3767	487	457	457
query6	243	155	166	155
query7	4457	294	288	288
query8	318	285	303	285
query9	8339	2427	2405	2405
query10	582	304	284	284
query11	10537	10084	10030	10030
query12	143	84	85	84
query13	1595	364	373	364
query14	10301	7769	7905	7769
query15	240	198	190	190
query16	7651	263	266	263
query17	1407	563	527	527
query18	1943	277	279	277
query19	200	160	161	160
query20	96	87	87	87
query21	210	136	131	131
query22	4201	4003	3973	3973
query23	33940	33832	33559	33559
query24	10715	2783	2844	2783
query25	583	355	355	355
query26	712	152	159	152
query27	2247	324	326	324
query28	5903	2039	2030	2030
query29	865	639	620	620
query30	290	149	153	149
query31	934	746	736	736
query32	97	53	55	53
query33	672	310	296	296
query34	856	495	487	487
query35	744	642	621	621
query36	1106	947	958	947
query37	136	73	71	71
query38	2867	2752	2731	2731
query39	886	800	830	800
query40	219	139	131	131
query41	52	54	56	54
query42	127	104	100	100
query43	588	569	584	569
query44	1123	741	751	741
query45	200	173	172	172
query46	1067	751	745	745
query47	1852	1765	1759	1759
query48	391	311	303	303
query49	960	433	451	433
query50	773	382	398	382
query51	6778	6613	6674	6613
query52	96	91	92	91
query53	370	301	295	295
query54	881	456	441	441
query55	72	75	74	74
query56	282	263	261	261
query57	1170	1072	1058	1058
query58	243	249	256	249
query59	3519	3336	3098	3098
query60	325	267	277	267
query61	96	91	95	91
query62	627	441	452	441
query63	319	288	298	288
query64	8875	2304	1809	1809
query65	3178	3169	3081	3081
query66	804	328	335	328
query67	15227	14992	14950	14950
query68	4571	541	546	541
query69	644	486	426	426
query70	1177	1099	1151	1099
query71	399	277	275	275
query72	7559	5474	5554	5474
query73	782	331	325	325
query74	5815	5488	5537	5488
query75	3464	2676	2677	2676
query76	2870	942	926	926
query77	638	302	328	302
query78	10441	9915	9712	9712
query79	2127	524	520	520
query80	955	456	464	456
query81	591	216	222	216
query82	719	104	99	99
query83	252	164	168	164
query84	253	87	89	87
query85	1689	361	279	279
query86	482	350	315	315
query87	3302	3042	3084	3042
query88	3772	2359	2355	2355
query89	478	395	400	395
query90	1840	194	189	189
query91	133	99	102	99
query92	59	52	51	51
query93	2275	507	497	497
query94	1243	196	204	196
query95	412	323	317	317
query96	583	273	267	267
query97	3197	3026	3027	3026
query98	216	200	200	200
query99	1192	848	833	833
Total cold run time: 266296 ms
Total hot run time: 174224 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.66 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 488bf7991196f78c55ae42baa69cd826db4fcbae, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.03	0.04
query3	0.23	0.06	0.05
query4	1.68	0.08	0.07
query5	0.51	0.49	0.49
query6	1.13	0.72	0.73
query7	0.01	0.01	0.01
query8	0.05	0.04	0.05
query9	0.54	0.49	0.50
query10	0.52	0.56	0.53
query11	0.16	0.11	0.12
query12	0.15	0.12	0.13
query13	0.60	0.58	0.60
query14	0.77	0.78	0.79
query15	0.83	0.83	0.81
query16	0.36	0.38	0.35
query17	0.99	1.00	0.97
query18	0.24	0.24	0.26
query19	1.79	1.82	1.73
query20	0.02	0.01	0.01
query21	15.42	0.67	0.69
query22	4.12	7.45	1.95
query23	18.32	1.44	1.31
query24	2.10	0.24	0.22
query25	0.15	0.08	0.08
query26	0.27	0.18	0.18
query27	0.08	0.08	0.09
query28	13.25	1.02	1.00
query29	12.64	3.27	3.23
query30	0.27	0.07	0.06
query31	2.85	0.38	0.40
query32	3.28	0.47	0.47
query33	2.90	2.96	2.97
query34	16.91	4.40	4.43
query35	4.51	4.47	4.54
query36	0.66	0.46	0.46
query37	0.18	0.15	0.15
query38	0.15	0.14	0.14
query39	0.04	0.03	0.04
query40	0.20	0.14	0.15
query41	0.10	0.05	0.04
query42	0.06	0.04	0.04
query43	0.05	0.04	0.04
Total cold run time: 109.21 s
Total hot run time: 30.66 s

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39941 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit f8356c604a5ef75b83c05ca7b222ec0d2aa7db02, data reload: false

------ Round 1 ----------------------------------
q1	17616	4304	4281	4281
q2	2023	186	192	186
q3	10463	1130	1118	1118
q4	10186	818	809	809
q5	7544	2656	2603	2603
q6	226	135	135	135
q7	945	616	599	599
q8	9229	2043	2066	2043
q9	8884	6486	6497	6486
q10	8965	3695	3699	3695
q11	448	234	235	234
q12	498	234	226	226
q13	17775	2991	2980	2980
q14	280	220	232	220
q15	511	470	480	470
q16	527	375	370	370
q17	960	697	589	589
q18	7978	7487	7485	7485
q19	6283	1556	1458	1458
q20	639	314	318	314
q21	4954	3308	3845	3308
q22	393	345	332	332
Total cold run time: 117327 ms
Total hot run time: 39941 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4406	4232	4226	4226
q2	378	264	290	264
q3	2952	2951	2917	2917
q4	2034	1665	1703	1665
q5	5600	5493	5511	5493
q6	223	136	129	129
q7	2194	1871	1838	1838
q8	3278	3429	3421	3421
q9	8601	8684	8777	8684
q10	4072	3815	3725	3725
q11	591	496	501	496
q12	816	633	654	633
q13	17105	3191	3146	3146
q14	309	284	284	284
q15	537	483	498	483
q16	473	431	418	418
q17	1821	1532	1486	1486
q18	8058	7799	7744	7744
q19	1828	1663	1568	1568
q20	3047	1873	1876	1873
q21	5194	5168	4711	4711
q22	584	571	515	515
Total cold run time: 74101 ms
Total hot run time: 55719 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 173697 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit f8356c604a5ef75b83c05ca7b222ec0d2aa7db02, data reload: false

query1	922	388	375	375
query2	6438	2403	2351	2351
query3	6641	204	215	204
query4	19460	17396	17276	17276
query5	3579	482	457	457
query6	239	159	158	158
query7	4586	312	294	294
query8	308	282	273	273
query9	8580	2415	2396	2396
query10	603	312	285	285
query11	10451	9938	9842	9842
query12	115	91	90	90
query13	1638	354	362	354
query14	10137	7106	7957	7106
query15	252	196	186	186
query16	7717	255	278	255
query17	1778	540	519	519
query18	1894	277	274	274
query19	198	161	162	161
query20	94	90	87	87
query21	212	131	131	131
query22	4460	4048	3933	3933
query23	33815	33793	33684	33684
query24	11260	2938	2896	2896
query25	649	402	361	361
query26	1341	157	155	155
query27	3013	326	323	323
query28	7641	2109	2108	2108
query29	924	653	612	612
query30	231	154	156	154
query31	993	788	777	777
query32	96	57	59	57
query33	780	298	306	298
query34	1041	505	497	497
query35	788	643	664	643
query36	1119	984	995	984
query37	167	76	76	76
query38	2942	2792	2929	2792
query39	897	863	865	863
query40	230	135	138	135
query41	59	56	57	56
query42	118	107	104	104
query43	606	540	562	540
query44	1190	719	730	719
query45	195	164	177	164
query46	1095	710	742	710
query47	1859	1769	1780	1769
query48	377	306	297	297
query49	867	422	417	417
query50	782	398	407	398
query51	6762	6784	6748	6748
query52	99	89	95	89
query53	361	288	301	288
query54	872	461	437	437
query55	75	73	72	72
query56	289	266	274	266
query57	1119	1036	1035	1035
query58	246	247	289	247
query59	3427	3197	3006	3006
query60	296	270	276	270
query61	97	91	90	90
query62	618	450	445	445
query63	319	291	315	291
query64	8798	2242	1742	1742
query65	3227	3114	3099	3099
query66	1235	326	329	326
query67	15363	14893	14944	14893
query68	4620	536	540	536
query69	622	488	413	413
query70	1098	1150	1148	1148
query71	436	281	279	279
query72	7216	5582	5515	5515
query73	784	325	322	322
query74	5958	5506	5408	5408
query75	3701	2635	2644	2635
query76	3330	901	967	901
query77	617	295	300	295
query78	10456	9766	9744	9744
query79	3330	514	516	514
query80	2016	466	464	464
query81	551	219	222	219
query82	1552	106	101	101
query83	331	168	162	162
query84	268	85	85	85
query85	1570	292	257	257
query86	475	330	318	318
query87	3245	3070	3058	3058
query88	3930	2360	2345	2345
query89	501	391	383	383
query90	1801	188	191	188
query91	131	101	101	101
query92	59	47	48	47
query93	4861	502	503	502
query94	1178	191	186	186
query95	413	387	315	315
query96	630	260	269	260
query97	3244	3053	3042	3042
query98	223	196	190	190
query99	1246	827	824	824
Total cold run time: 278973 ms
Total hot run time: 173697 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.71 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit f8356c604a5ef75b83c05ca7b222ec0d2aa7db02, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.04	0.05
query4	1.69	0.08	0.08
query5	0.47	0.49	0.48
query6	1.13	0.74	0.72
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.55	0.49	0.50
query10	0.55	0.55	0.53
query11	0.16	0.12	0.12
query12	0.15	0.12	0.12
query13	0.59	0.58	0.60
query14	0.76	0.77	0.78
query15	0.84	0.80	0.81
query16	0.39	0.36	0.36
query17	1.04	1.02	1.04
query18	0.23	0.26	0.23
query19	1.86	1.73	1.74
query20	0.01	0.01	0.01
query21	15.43	0.65	0.64
query22	4.50	6.66	2.21
query23	18.28	1.39	1.19
query24	2.23	0.23	0.22
query25	0.16	0.09	0.08
query26	0.27	0.17	0.17
query27	0.08	0.08	0.08
query28	13.44	1.03	1.00
query29	12.96	3.30	3.25
query30	0.26	0.06	0.06
query31	2.87	0.39	0.38
query32	3.26	0.47	0.48
query33	2.90	2.92	2.87
query34	16.89	4.39	4.44
query35	4.49	4.46	4.52
query36	0.65	0.46	0.46
query37	0.17	0.14	0.14
query38	0.15	0.15	0.14
query39	0.05	0.03	0.03
query40	0.18	0.14	0.14
query41	0.10	0.05	0.05
query42	0.05	0.05	0.04
query43	0.04	0.04	0.04
Total cold run time: 110.24 s
Total hot run time: 30.71 s

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40379 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit e1173053678743dc794ff4a97a95d4c1414e0db3, data reload: false

------ Round 1 ----------------------------------
q1	18049	4595	4379	4379
q2	2947	195	199	195
q3	11382	1110	1098	1098
q4	11191	811	859	811
q5	7720	2749	2666	2666
q6	228	141	143	141
q7	969	597	588	588
q8	9225	2088	2044	2044
q9	9476	6844	6818	6818
q10	8852	3710	3694	3694
q11	461	245	240	240
q12	409	237	241	237
q13	17768	2980	2973	2973
q14	270	228	215	215
q15	520	474	486	474
q16	523	384	380	380
q17	945	637	646	637
q18	8113	7526	7369	7369
q19	6095	1478	1486	1478
q20	665	317	323	317
q21	5022	3289	4042	3289
q22	397	336	341	336
Total cold run time: 121227 ms
Total hot run time: 40379 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4398	4252	4221	4221
q2	365	268	253	253
q3	2984	2753	2714	2714
q4	1877	1547	1663	1547
q5	5252	5321	5254	5254
q6	220	125	130	125
q7	2092	1704	1747	1704
q8	3150	3306	3289	3289
q9	8798	8802	8860	8802
q10	3842	3667	3667	3667
q11	572	484	475	475
q12	747	579	618	579
q13	16653	2995	2999	2995
q14	291	272	250	250
q15	515	492	473	473
q16	470	403	408	403
q17	1761	1486	1464	1464
q18	7530	7627	7324	7324
q19	1686	1621	1707	1621
q20	1972	1786	1735	1735
q21	4853	4720	4804	4720
q22	618	541	568	541
Total cold run time: 70646 ms
Total hot run time: 54156 ms

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39961 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 310c64ceb93d042c63b0706221ad98d6d5324268, data reload: false

------ Round 1 ----------------------------------
q1	17603	4418	4308	4308
q2	2028	194	199	194
q3	10517	1177	1083	1083
q4	10204	836	809	809
q5	7464	2756	2637	2637
q6	223	141	137	137
q7	986	606	613	606
q8	9234	2089	2072	2072
q9	9163	6554	6495	6495
q10	9044	3758	3718	3718
q11	468	245	243	243
q12	429	237	229	229
q13	17776	2999	3034	2999
q14	277	226	220	220
q15	523	491	483	483
q16	521	395	386	386
q17	974	640	744	640
q18	8153	7661	7407	7407
q19	8156	1546	1512	1512
q20	752	323	334	323
q21	4924	3120	3874	3120
q22	410	340	345	340
Total cold run time: 119829 ms
Total hot run time: 39961 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4490	4292	4266	4266
q2	384	271	269	269
q3	3181	2906	2919	2906
q4	2011	1702	1716	1702
q5	5539	5508	5556	5508
q6	229	131	146	131
q7	2295	1860	1891	1860
q8	3351	3430	3440	3430
q9	8787	8931	8791	8791
q10	4118	3708	3903	3708
q11	636	500	515	500
q12	814	642	636	636
q13	17143	3153	3181	3153
q14	313	276	291	276
q15	540	492	492	492
q16	506	429	428	428
q17	1810	1502	1485	1485
q18	8178	7997	7947	7947
q19	1795	1584	1656	1584
q20	2184	1933	1846	1846
q21	5123	4799	4907	4799
q22	674	565	564	564
Total cold run time: 74101 ms
Total hot run time: 56281 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 171598 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 310c64ceb93d042c63b0706221ad98d6d5324268, data reload: false

query1	945	386	383	383
query2	6461	2460	2356	2356
query3	6628	209	212	209
query4	19602	17671	17663	17663
query5	3654	495	491	491
query6	257	168	169	168
query7	4577	307	289	289
query8	324	299	299	299
query9	8749	2446	2443	2443
query10	568	311	278	278
query11	10626	10049	10060	10049
query12	120	89	84	84
query13	1626	362	359	359
query14	9477	7067	6355	6355
query15	237	187	191	187
query16	7341	257	263	257
query17	1439	545	536	536
query18	1782	290	278	278
query19	201	156	155	155
query20	93	84	86	84
query21	209	129	130	129
query22	4306	4144	3863	3863
query23	33873	34304	33834	33834
query24	12138	2852	2931	2852
query25	599	381	378	378
query26	1487	170	181	170
query27	3178	336	323	323
query28	7690	2130	2103	2103
query29	902	641	629	629
query30	260	154	156	154
query31	1008	771	778	771
query32	95	54	57	54
query33	750	310	300	300
query34	1091	501	491	491
query35	812	653	646	646
query36	1159	957	979	957
query37	241	80	76	76
query38	2944	2825	2782	2782
query39	905	867	854	854
query40	272	141	139	139
query41	57	56	55	55
query42	134	110	112	110
query43	612	577	562	562
query44	1270	785	753	753
query45	201	172	174	172
query46	1080	712	733	712
query47	1866	1781	1779	1779
query48	378	310	308	308
query49	959	420	445	420
query50	777	398	408	398
query51	6877	6696	6690	6690
query52	103	104	97	97
query53	376	300	294	294
query54	872	456	447	447
query55	75	78	75	75
query56	303	286	280	280
query57	1158	1058	1053	1053
query58	247	262	258	258
query59	3446	3110	3207	3110
query60	315	296	292	292
query61	115	110	109	109
query62	619	458	454	454
query63	328	293	296	293
query64	9806	2394	1881	1881
query65	3305	3083	3130	3083
query66	1251	351	339	339
query67	15568	14963	15061	14963
query68	8395	555	580	555
query69	727	456	412	412
query70	1294	1177	1030	1030
query71	521	287	288	287
query72	8289	5529	2811	2811
query73	1233	329	334	329
query74	5920	5469	5502	5469
query75	4742	2671	2666	2666
query76	4873	1028	928	928
query77	810	309	304	304
query78	10562	9887	9767	9767
query79	7940	519	517	517
query80	2616	474	487	474
query81	570	223	217	217
query82	784	109	107	107
query83	302	205	167	167
query84	271	84	88	84
query85	1380	313	274	274
query86	400	314	297	297
query87	3340	3135	3085	3085
query88	4626	2345	2359	2345
query89	516	379	392	379
query90	1940	194	190	190
query91	135	101	100	100
query92	67	49	52	49
query93	5630	510	506	506
query94	1104	193	190	190
query95	409	315	351	315
query96	619	266	272	266
query97	3264	3025	3046	3025
query98	219	196	195	195
query99	1232	843	868	843
Total cold run time: 295454 ms
Total hot run time: 171598 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.36 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 310c64ceb93d042c63b0706221ad98d6d5324268, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.05	0.05
query4	1.67	0.07	0.07
query5	0.49	0.49	0.48
query6	1.14	0.72	0.72
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.53	0.49	0.49
query10	0.55	0.53	0.54
query11	0.16	0.11	0.11
query12	0.14	0.12	0.12
query13	0.60	0.59	0.61
query14	0.78	0.78	0.80
query15	0.83	0.83	0.82
query16	0.37	0.37	0.38
query17	1.05	1.01	1.05
query18	0.23	0.23	0.27
query19	1.95	1.67	1.78
query20	0.02	0.01	0.01
query21	15.40	0.66	0.64
query22	3.92	6.39	2.66
query23	18.26	1.40	1.27
query24	2.14	0.22	0.24
query25	0.16	0.09	0.09
query26	0.27	0.19	0.18
query27	0.09	0.09	0.08
query28	13.22	1.01	1.00
query29	12.60	3.31	3.27
query30	0.25	0.06	0.06
query31	2.84	0.38	0.38
query32	3.28	0.47	0.48
query33	2.91	2.94	2.92
query34	17.16	4.38	4.39
query35	4.53	4.49	4.50
query36	0.65	0.48	0.47
query37	0.19	0.17	0.16
query38	0.16	0.15	0.15
query39	0.05	0.04	0.04
query40	0.18	0.14	0.14
query41	0.10	0.05	0.04
query42	0.05	0.04	0.06
query43	0.05	0.04	0.04
Total cold run time: 109.39 s
Total hot run time: 31.36 s

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39796 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 93ba8aa5347eef6a018009f95418503d3d9686e9, data reload: false

------ Round 1 ----------------------------------
q1	18615	5276	4417	4417
q2	3018	198	197	197
q3	11246	1145	1024	1024
q4	11018	820	693	693
q5	7909	2737	2659	2659
q6	225	137	141	137
q7	951	625	605	605
q8	9220	2054	2085	2054
q9	7029	6453	6441	6441
q10	8932	3738	3709	3709
q11	441	246	255	246
q12	472	242	232	232
q13	17759	2992	2991	2991
q14	272	211	223	211
q15	524	473	470	470
q16	511	391	381	381
q17	966	748	684	684
q18	8019	7324	7225	7225
q19	1670	1512	1526	1512
q20	647	325	333	325
q21	5028	3233	3880	3233
q22	410	350	355	350
Total cold run time: 114882 ms
Total hot run time: 39796 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4371	4205	4207	4205
q2	378	271	267	267
q3	2944	2780	2767	2767
q4	1887	1590	1634	1590
q5	5229	5258	5238	5238
q6	238	133	130	130
q7	2164	1702	1705	1702
q8	3218	3334	3309	3309
q9	8344	8395	8374	8374
q10	3906	3642	3640	3640
q11	588	497	504	497
q12	783	618	608	608
q13	17510	2980	3005	2980
q14	285	283	252	252
q15	526	494	473	473
q16	479	418	414	414
q17	1787	1498	1444	1444
q18	7588	7544	7326	7326
q19	1660	1567	1556	1556
q20	1980	1787	1788	1787
q21	4780	4817	4646	4646
q22	613	534	575	534
Total cold run time: 71258 ms
Total hot run time: 53739 ms

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39859 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0fb8ce9689a6b86444940ba23778716f63bed005, data reload: false

------ Round 1 ----------------------------------
q1	17627	4359	4268	4268
q2	2041	194	197	194
q3	10422	1214	1116	1116
q4	10184	941	785	785
q5	7488	2700	2660	2660
q6	226	137	136	136
q7	961	614	607	607
q8	9222	2083	2080	2080
q9	8905	6473	6504	6473
q10	9020	3763	3711	3711
q11	447	233	241	233
q12	404	239	231	231
q13	17763	3013	2963	2963
q14	269	232	222	222
q15	523	473	478	473
q16	524	386	383	383
q17	962	639	725	639
q18	8187	7467	7321	7321
q19	7700	1516	1467	1467
q20	651	321	338	321
q21	4957	3245	3899	3245
q22	382	331	337	331
Total cold run time: 118865 ms
Total hot run time: 39859 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4358	4305	4212	4212
q2	369	277	263	263
q3	2987	2760	2728	2728
q4	1868	1607	1618	1607
q5	5271	5277	5330	5277
q6	213	127	130	127
q7	2094	1770	1719	1719
q8	3191	3322	3415	3322
q9	8408	8351	8437	8351
q10	3908	3662	3651	3651
q11	580	476	480	476
q12	759	621	583	583
q13	16339	2995	2982	2982
q14	282	267	267	267
q15	523	471	485	471
q16	456	415	423	415
q17	1776	1508	1488	1488
q18	7656	7558	7228	7228
q19	1688	1529	1620	1529
q20	1992	1822	1766	1766
q21	4792	4743	4782	4743
q22	607	515	549	515
Total cold run time: 70117 ms
Total hot run time: 53720 ms

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40697 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 7f9210aef9b5606f82dcb876c809b78d660c3efc, data reload: false

------ Round 1 ----------------------------------
q1	17136	4309	4280	4280
q2	1070	197	191	191
q3	9772	1347	1093	1093
q4	9961	807	819	807
q5	7384	2692	2737	2692
q6	220	139	137	137
q7	962	605	627	605
q8	9186	2102	2081	2081
q9	6658	6510	6528	6510
q10	5653	3713	3702	3702
q11	433	242	240	240
q12	406	237	249	237
q13	17772	3040	3006	3006
q14	277	214	223	214
q15	513	487	480	480
q16	462	382	375	375
q17	965	729	634	634
q18	7971	7663	7471	7471
q19	1670	1335	1471	1335
q20	598	333	331	331
q21	4965	3930	3950	3930
q22	416	356	346	346
Total cold run time: 104450 ms
Total hot run time: 40697 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4282	4211	4252	4211
q2	362	279	273	273
q3	3020	2765	2749	2749
q4	1874	1622	1614	1614
q5	5406	5534	5595	5534
q6	231	131	130	130
q7	2327	1798	1865	1798
q8	3281	3451	3444	3444
q9	8677	8659	8674	8659
q10	4120	3893	3824	3824
q11	617	507	517	507
q12	806	645	665	645
q13	15885	3302	3286	3286
q14	305	289	274	274
q15	532	492	489	489
q16	510	443	458	443
q17	1863	1549	1509	1509
q18	8094	7867	7920	7867
q19	1731	1583	1701	1583
q20	2053	1898	1840	1840
q21	5229	4908	4959	4908
q22	679	602	579	579
Total cold run time: 71884 ms
Total hot run time: 56166 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 177791 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 7f9210aef9b5606f82dcb876c809b78d660c3efc, data reload: false

query1	922	389	375	375
query2	6466	2426	2426	2426
query3	6651	205	210	205
query4	22537	17791	17300	17300
query5	4177	465	481	465
query6	277	182	179	179
query7	4603	302	300	300
query8	315	296	278	278
query9	8564	2441	2428	2428
query10	583	327	284	284
query11	10484	10069	9956	9956
query12	140	90	84	84
query13	1644	373	379	373
query14	9653	6957	7321	6957
query15	242	189	189	189
query16	7738	284	273	273
query17	1385	583	540	540
query18	1927	293	282	282
query19	197	157	159	157
query20	91	87	88	87
query21	214	132	128	128
query22	4955	4698	4733	4698
query23	34210	33956	33557	33557
query24	12334	2888	2984	2888
query25	712	414	394	394
query26	1733	168	163	163
query27	2828	332	330	330
query28	7277	2194	2191	2191
query29	1149	653	647	647
query30	278	161	162	161
query31	1001	766	767	766
query32	99	56	59	56
query33	783	325	305	305
query34	910	494	509	494
query35	773	661	664	661
query36	1108	991	981	981
query37	278	79	79	79
query38	3131	2856	2847	2847
query39	882	859	844	844
query40	269	138	130	130
query41	55	52	54	52
query42	133	105	101	101
query43	606	571	562	562
query44	1345	772	769	769
query45	194	167	172	167
query46	1133	762	743	743
query47	1937	1866	1850	1850
query48	386	310	317	310
query49	1117	445	432	432
query50	795	405	407	405
query51	7172	7033	6949	6949
query52	114	101	97	97
query53	368	296	299	296
query54	866	485	484	484
query55	77	79	78	78
query56	293	281	279	279
query57	1205	1137	1109	1109
query58	260	241	263	241
query59	3761	3521	3287	3287
query60	307	277	286	277
query61	108	122	91	91
query62	624	464	430	430
query63	319	298	298	298
query64	9656	2337	1811	1811
query65	3305	3225	3275	3225
query66	1284	330	339	330
query67	16434	15772	15437	15437
query68	9893	588	595	588
query69	678	337	345	337
query70	1377	1086	1216	1086
query71	621	286	281	281
query72	9265	5731	5722	5722
query73	2351	336	343	336
query74	6301	5827	5806	5806
query75	6195	2777	2708	2708
query76	5732	996	1015	996
query77	665	323	311	311
query78	10692	10110	9892	9892
query79	9164	539	534	534
query80	1113	493	489	489
query81	545	245	236	236
query82	226	116	112	112
query83	213	180	178	178
query84	276	89	84	84
query85	1000	290	318	290
query86	354	304	332	304
query87	3568	3184	3211	3184
query88	4327	2480	2468	2468
query89	507	388	406	388
query90	2141	192	201	192
query91	134	100	103	100
query92	64	50	49	49
query93	4438	550	542	542
query94	1235	196	199	196
query95	421	338	335	335
query96	659	284	285	284
query97	3301	3149	3112	3112
query98	215	208	218	208
query99	1080	878	875	875
Total cold run time: 306125 ms
Total hot run time: 177791 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.03 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 7f9210aef9b5606f82dcb876c809b78d660c3efc, data reload: false

query1	0.04	0.04	0.03
query2	0.08	0.04	0.04
query3	0.23	0.06	0.05
query4	1.66	0.09	0.07
query5	0.50	0.48	0.47
query6	1.15	0.73	0.72
query7	0.03	0.02	0.01
query8	0.05	0.04	0.04
query9	0.54	0.50	0.49
query10	0.54	0.55	0.54
query11	0.16	0.12	0.11
query12	0.14	0.12	0.13
query13	0.59	0.58	0.60
query14	0.80	0.78	0.77
query15	0.86	0.81	0.82
query16	0.37	0.36	0.36
query17	0.99	1.00	1.04
query18	0.22	0.24	0.23
query19	1.83	1.75	1.76
query20	0.02	0.01	0.01
query21	15.45	0.79	0.65
query22	4.31	6.73	2.35
query23	18.28	1.41	1.20
query24	2.14	0.22	0.22
query25	0.17	0.09	0.09
query26	0.26	0.17	0.18
query27	0.08	0.08	0.08
query28	13.25	1.02	1.00
query29	12.63	3.33	3.34
query30	0.25	0.06	0.06
query31	2.84	0.40	0.38
query32	3.27	0.47	0.49
query33	2.90	2.89	2.88
query34	17.16	4.46	4.41
query35	4.47	4.46	4.52
query36	0.65	0.46	0.49
query37	0.19	0.15	0.15
query38	0.15	0.15	0.14
query39	0.04	0.04	0.04
query40	0.18	0.15	0.15
query41	0.09	0.05	0.05
query42	0.05	0.06	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.66 s
Total hot run time: 31.03 s

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39589 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 76f77f49f078a2680ae1d79227371d7c08e2ac4f, data reload: false

------ Round 1 ----------------------------------
q1	18778	4422	4337	4337
q2	2488	194	189	189
q3	11583	1156	1175	1156
q4	10323	869	744	744
q5	7519	2693	2579	2579
q6	226	140	135	135
q7	943	600	593	593
q8	9211	2054	2036	2036
q9	8946	6509	6508	6508
q10	8950	3691	3683	3683
q11	445	233	238	233
q12	402	231	220	220
q13	17939	2963	3009	2963
q14	276	223	230	223
q15	517	474	468	468
q16	480	367	380	367
q17	955	678	699	678
q18	8043	7521	7299	7299
q19	5919	1519	1360	1360
q20	666	338	345	338
q21	4906	4163	3149	3149
q22	397	340	331	331
Total cold run time: 119912 ms
Total hot run time: 39589 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4421	4286	4279	4279
q2	379	272	262	262
q3	3038	2758	2726	2726
q4	1895	1629	1624	1624
q5	5241	5288	5276	5276
q6	218	128	128	128
q7	2155	1699	1724	1699
q8	3187	3351	3299	3299
q9	8337	8355	8332	8332
q10	3900	3664	3669	3664
q11	583	477	514	477
q12	767	608	597	597
q13	17403	2984	2962	2962
q14	293	262	280	262
q15	521	463	477	463
q16	466	417	419	417
q17	1738	1495	1457	1457
q18	7791	7596	7390	7390
q19	2747	1692	1655	1655
q20	2011	1811	1755	1755
q21	4907	4787	4718	4718
q22	648	506	570	506
Total cold run time: 72646 ms
Total hot run time: 53948 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 173102 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 76f77f49f078a2680ae1d79227371d7c08e2ac4f, data reload: false

query1	918	368	374	368
query2	6455	2461	2332	2332
query3	6649	205	209	205
query4	23243	17672	17372	17372
query5	4163	478	467	467
query6	280	180	170	170
query7	4590	290	290	290
query8	304	280	282	280
query9	8393	2445	2438	2438
query10	602	303	285	285
query11	10703	10148	10042	10042
query12	140	85	79	79
query13	1658	368	348	348
query14	10061	7493	7509	7493
query15	231	188	181	181
query16	8109	269	258	258
query17	1906	539	523	523
query18	2070	270	275	270
query19	185	152	147	147
query20	112	86	83	83
query21	210	124	116	116
query22	4345	4090	4050	4050
query23	33777	32718	33067	32718
query24	10993	2860	2819	2819
query25	593	355	356	355
query26	1143	150	153	150
query27	2944	310	311	310
query28	7125	2086	2066	2066
query29	853	625	603	603
query30	300	154	153	153
query31	1029	724	767	724
query32	90	52	55	52
query33	763	286	273	273
query34	939	457	480	457
query35	743	616	613	613
query36	1080	893	928	893
query37	143	70	69	69
query38	2908	2766	2809	2766
query39	842	792	776	776
query40	205	129	123	123
query41	56	52	52	52
query42	119	96	105	96
query43	596	553	534	534
query44	1183	712	706	706
query45	191	160	164	160
query46	1075	705	741	705
query47	1878	1804	1789	1789
query48	374	299	300	299
query49	1100	406	399	399
query50	765	389	380	380
query51	6895	6713	6729	6713
query52	105	97	94	94
query53	389	293	288	288
query54	902	442	435	435
query55	70	75	72	72
query56	272	266	267	266
query57	1138	1035	1030	1030
query58	263	234	258	234
query59	3293	3128	3294	3128
query60	300	283	281	281
query61	92	90	89	89
query62	661	457	438	438
query63	318	283	288	283
query64	8977	2205	1710	1710
query65	3177	3092	3093	3092
query66	931	338	326	326
query67	15510	15090	14912	14912
query68	4479	522	524	522
query69	471	329	292	292
query70	1120	1117	1090	1090
query71	394	276	267	267
query72	7113	5507	5549	5507
query73	736	320	324	320
query74	6024	5528	5578	5528
query75	3451	2681	2651	2651
query76	2472	920	918	918
query77	472	297	297	297
query78	10432	9841	9802	9802
query79	2617	528	509	509
query80	1215	463	455	455
query81	599	222	219	219
query82	804	102	105	102
query83	234	164	166	164
query84	235	86	85	85
query85	1339	281	269	269
query86	454	329	319	319
query87	3298	3086	3091	3086
query88	4155	2427	2432	2427
query89	467	384	368	368
query90	1759	187	188	187
query91	131	123	111	111
query92	67	52	50	50
query93	1900	491	495	491
query94	1199	202	257	202
query95	407	310	311	310
query96	588	267	268	267
query97	3285	3062	3018	3018
query98	218	205	187	187
query99	1119	858	854	854
Total cold run time: 275681 ms
Total hot run time: 173102 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.42 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 76f77f49f078a2680ae1d79227371d7c08e2ac4f, data reload: false

query1	0.04	0.03	0.03
query2	0.07	0.04	0.05
query3	0.22	0.05	0.05
query4	1.68	0.07	0.06
query5	0.53	0.47	0.48
query6	1.14	0.73	0.73
query7	0.02	0.01	0.01
query8	0.05	0.04	0.05
query9	0.56	0.48	0.49
query10	0.56	0.54	0.54
query11	0.14	0.12	0.11
query12	0.15	0.12	0.12
query13	0.58	0.59	0.59
query14	0.76	0.78	0.79
query15	0.84	0.82	0.83
query16	0.36	0.35	0.37
query17	1.00	0.98	0.96
query18	0.25	0.22	0.25
query19	1.77	1.74	1.68
query20	0.02	0.01	0.01
query21	15.44	0.75	0.66
query22	4.37	7.42	1.79
query23	18.27	1.45	1.26
query24	2.14	0.24	0.24
query25	0.16	0.08	0.08
query26	0.25	0.17	0.18
query27	0.08	0.07	0.08
query28	13.17	1.01	1.01
query29	12.63	3.26	3.26
query30	0.26	0.06	0.06
query31	2.87	0.38	0.38
query32	3.29	0.48	0.48
query33	2.91	2.97	2.82
query34	17.14	4.54	4.52
query35	4.48	4.48	4.53
query36	0.65	0.47	0.50
query37	0.20	0.15	0.16
query38	0.15	0.15	0.14
query39	0.04	0.04	0.03
query40	0.18	0.14	0.14
query41	0.10	0.04	0.05
query42	0.06	0.04	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.62 s
Total hot run time: 30.42 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 28, 2024
Copy link
Contributor

PR approved by at least one committer and no changes requested.

Copy link
Contributor

PR approved by anyone and no changes requested.

@924060929 924060929 merged commit 1789ec6 into apache:master Jun 28, 2024
27 of 31 checks passed
@924060929 924060929 deleted the refactor_coordinator4 branch June 28, 2024 09:30
dataroaring pushed a commit that referenced this pull request Jun 30, 2024
## Proposed changes
The legacy coordinator act not only scheduler but also distribute planner. The code is so complex to understand, and hard to extend, and exist many limitations.

This pr extract and refine the computation of degree of parallel(dop) to a new DistributePlanner and resolve the limitations.


## How to use this function
This function only use for nereids + pipelinex, and current only support query statement, and non cloud mode.
Open this session variables to use this function:
```sql
set enable_nereids_distribute_planner=true; -- default is false
set enable_nereids_planner=true;  -- default is true
```

## Core process and concepts
```
                                                                                                                              
 ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ 
 │                                                                                                                          │ 
 │             ┌──────────────┐         ┌───────────────┐          ┌───────────────────┐        ┌─────────────────────────┐ │ 
 │  Translate  │              │  Typed  │               │  Assign  │                   │  Wrap  │                         │ │ 
 │ ──────────► │ PlanFragment │ ──────► │ UnassignedJob │ ───────► │ StaticAssignedJob │ ─────► │ PipelineDistributedPlan │ │ 
 │             │              │         │               │          │                   │        │                         │ │ 
 │             └──────────────┘         └───────────────┘          └───────────────────┘        └─────────────────────────┘ │ 
 │                                                                                                                          │ 
 └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 
                                                                                                                              
 │                                                                                                                          │ 
 │                                                                                                                          │ 
 └──────────────────────────────────────────────────┐                 ┌─────────────────────────────────────────────────────┘ 
                                                    │                 │                                                       
                                                    │                 │                                                       
                                                                                                                              
                      ┌──────────────┐              ┌─────────────────┐         ┌───────────────────┐                         
                      │              │  Distribute  │                 │  AdHoc  │                   │                         
                      │ PhysicalPlan │ ───────────► │ DistributedPlan │ ──────► │ PipelineScheduler │                         
                      │              │              │                 │         │                   │                         
                      └──────────────┘              └─────────────────┘         └───────────────────┘                         
                                                                                                                              
```

DistributePlanner is a new planner to compute dop and generate instances, it consume PlanFragment and do this tasks
1. Use PlanFragment to generate `UnassignedJob`, it's a **Typed Fragment**, decided how to calculate dop and how to select the datasource, but this fragment not yet assigned some backends and datasources. These are some unassignedJobs: UnassignedScanSingleOlapTableJob, UnassignedScanBucketOlapTableJob, UnassignedShuffleJob, UnassignedQueryConstantJob. Keep UnassignedJob different can decoupling unrelated logic, and easy to extend: just and a new type of UnassignedJob.
2. Use UnassignedJob to select datasource, compute dop, and generate `AssignedJob`, means a instance, which already assigned datasource and backend. There are StaticAssignedJob and LocalShuffleAssignedJob, we will add DynamicAssignedJob when support StageScheduler and adaptive query execution
3. Wrap PlanFragment, UnassignedJob and AssignedJob to `PipelineDistributedPlan`, the coordinator will consume the DistributedPlan and translate to TPlan and schedule instances


## Resolve limitations
**1. left table shuffle to right table**
if right table has distribution which distribute by `storage hash`, and left table has distribution which distribute by `compute hash`, we can shuffle left to right by `storage hash` to do shuffle bucket join, and keep right side not move.

```sql
select *
from
(
  select id2
  from test_shuffle_left
  group by id2
) a
inner join [shuffle]
test_shuffle_left b
on a.id2=b.id;

| PhysicalResultSink[288] ( outputExprs=[id2#1, id#2, id2#3] )                                                                                                                                ...
| +--PhysicalHashJoin[285]@4 ( type=INNER_JOIN, stats=3, hashCondition=[(id2#1 = id#2)], otherCondition=[], markCondition=[], hint=[shuffle] )                                                ...
|    |--PhysicalDistribute[281]@2 ( stats=1.5, distributionSpec=DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=STORAGE_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=...
|    |  +--PhysicalHashAggregate[278]@2 ( aggPhase=GLOBAL, aggMode=BUFFER_TO_RESULT, maybeUseStreaming=false, groupByExpr=[id2#1], outputExpr=[id2#1], partitionExpr=Optional[[id2#1]], requir...
|    |     +--PhysicalDistribute[275]@7 ( stats=1.5, distributionSpec=DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, parti...
|    |        +--PhysicalHashAggregate[272]@7 ( aggPhase=LOCAL, aggMode=INPUT_TO_BUFFER, maybeUseStreaming=true, groupByExpr=[id2#1], outputExpr=[id2#1], partitionExpr=Optional[[id2#1]], req...
|    |           +--PhysicalProject[269]@1 ( stats=3, projects=[id2#1] )                                                                                                                      ...
|    |              +--PhysicalOlapScan[test_shuffle_left]@0 ( stats=3 )                                                                                                                      ...
|    +--PhysicalOlapScan[test_shuffle_left]@3 ( stats=3 )
```

**2. support colocate union numbers function**
support use one instance to union/join numbers, note this plan no any PhysicalDistribute plan:
```sql
explain physical plan
select * from numbers('number'='3')a
union all
select * from numbers('number'='4')b

PhysicalResultSink[98] ( outputExprs=[number#2] )
+--PhysicalUnion@ ( qualifier=ALL, outputs=[number#2], regularChildrenOutputs=[[number#0], [number#1]], constantExprsList=[], stats=7 )
   |--PhysicalTVFRelation ( qualified=NumbersTableValuedFunction, output=[number#0], function=numbers('number' = '3') )
   +--PhysicalTVFRelation ( qualified=NumbersTableValuedFunction, output=[number#1], function=numbers('number' = '4') )
```

**3. support bucket prune with right outer bucket shuffle join**
left table prune some buckets, say [bucket 1, bucket 3]

we should process the right bucket shuffle join like this
```
[
  (left bucket 1) right outer join (exchange right table which should process by bucket 1),
  (empty bucket) right outer join (exchange right table which should process by bucket 2),
  (left bucket 3) right outer join (exchange right table which should process by bucket 3)
]
```
the left bucket 2 is pruned, so right table can not shuffle to left, because the left instance not exists, so bucket 2 will return empty rows and wrong.

new DistributePlanner can fill up this instance.

the case:
```sql
explain physical plan
SELECT * FROM
(select * from test_outer_join1 where c0 =1)a
RIGHT OUTER JOIN
(select * from test_outer_join2)b
ON a.c0 = b.c0
```

### New feature

add an explain statement to show distributed plans
```sql
explain distributed plan select ...
```

for example, you can use this function to check how many instances generated, how many bytes the instance will scan, which backend will process the instance:
```sql
MySQL [email protected]:test> explain distributed plan select * from test_shuffle_left2 a join [shuffle] test_shuffle_left2 b on a.id2=b.id;
Explain String(Nereids Planner)
-------------------------------------------------------------------------------------------------------
PipelineDistributedPlan(
  id: 0,
  parallel: 2,
  fragmentJob: UnassignedScanSingleOlapTableJob,
  fragment: {
    OUTPUT EXPRS:
      id[#8]
      id2[#9]
      id[#10]
      id2[#11]
    PARTITION: HASH_PARTITIONED: id2[#3]

    HAS_COLO_PLAN_NODE: false

    VRESULT SINK
       MYSQL_PROTOCAL

    3:VHASH JOIN(152)
    |  join op: INNER JOIN(PARTITIONED)[]
    |  equal join conjunct: (id2[#3] = id[#0])
    |  cardinality=3
    |  vec output tuple id: 3
    |  output tuple id: 3
    |  vIntermediate tuple ids: 2
    |  hash output slot ids: 0 1 2 3
    |  isMarkJoin: false
    |  final projections: id[#4], id2[#5], id[#6], id2[#7]
    |  final project output tuple id: 3
    |  distribute expr lists: id2[#3]
    |  distribute expr lists: id[#0]
    |  tuple ids: 1 0
    |
    |----0:VOlapScanNode(149)
    |       TABLE: test.test_shuffle_left2(test_shuffle_left2), PREAGGREGATION: ON
    |       partitions=1/1 (test_shuffle_left2)
    |       tablets=10/10, tabletList=22038,22040,22042 ...
    |       cardinality=3, avgRowSize=0.0, numNodes=1
    |       pushAggOp=NONE
    |       tuple ids: 0
    |
    2:VEXCHANGE
       offset: 0
       distribute expr lists: id[#2]
       tuple ids: 1
  },
  instanceJobs: [
    LocalShuffleAssignedJob(
      index: 0,
      worker: BackendWorker(id: 10095, address: 192.168.126.1:9050),
      shareScanIndex: 0,
      scanSource: [
        {
          scanNode: OlapScanNode{id=0, tid=0, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 400, ranges: [
            tablet 22038, bytes: 0,
            tablet 22042, bytes: 0,
            tablet 22046, bytes: 0,
            tablet 22050, bytes: 400,
            tablet 22054, bytes: 0
          ])
        }
      ]
    ),
    LocalShuffleAssignedJob(
      index: 1,
      worker: BackendWorker(id: 10096, address: 192.168.126.2:9051),
      shareScanIndex: 1,
      scanSource: [
        {
          scanNode: OlapScanNode{id=0, tid=0, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 796, ranges: [
            tablet 22040, bytes: 397,
            tablet 22044, bytes: 0,
            tablet 22048, bytes: 399,
            tablet 22052, bytes: 0,
            tablet 22056, bytes: 0
          ])
        }
      ]
    )
  ]
)
PipelineDistributedPlan(
  id: 1,
  parallel: 2,
  fragmentJob: UnassignedScanSingleOlapTableJob,
  fragment: {
    PARTITION: HASH_PARTITIONED: id[#2]

    HAS_COLO_PLAN_NODE: false

    STREAM DATA SINK
      EXCHANGE ID: 02
      HASH_PARTITIONED: id2[#3]

    1:VOlapScanNode(145)
       TABLE: test.test_shuffle_left2(test_shuffle_left2), PREAGGREGATION: ON
       partitions=1/1 (test_shuffle_left2)
       tablets=10/10, tabletList=22038,22040,22042 ...
       cardinality=3, avgRowSize=0.0, numNodes=1
       pushAggOp=NONE
       tuple ids: 1
  },
  instanceJobs: [
    LocalShuffleAssignedJob(
      index: 0,
      worker: BackendWorker(id: 10095, address: 192.168.126.1:9050),
      shareScanIndex: 0,
      scanSource: [
        {
          scanNode: OlapScanNode{id=1, tid=1, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 400, ranges: [
            tablet 22038, bytes: 0,
            tablet 22042, bytes: 0,
            tablet 22046, bytes: 0,
            tablet 22050, bytes: 400,
            tablet 22054, bytes: 0
          ])
        }
      ]
    ),
    LocalShuffleAssignedJob(
      index: 1,
      worker: BackendWorker(id: 10096, address: 192.168.126.2:9051),
      shareScanIndex: 1,
      scanSource: [
        {
          scanNode: OlapScanNode{id=1, tid=1, tblName=test_shuffle_left2, keyRanges=, preds= limit=-1},
          scanRanges: ScanRanges(bytes: 796, ranges: [
            tablet 22040, bytes: 397,
            tablet 22044, bytes: 0,
            tablet 22048, bytes: 399,
            tablet 22052, bytes: 0,
            tablet 22056, bytes: 0
          ])
        }
      ]
    )
  ]
)



Hint log:
Used: [shuffle]_2
UnUsed:
SyntaxError:
```

## TODO
1. extract PipelineScheduler from Coordinator
2. move this framework into cascades and compute cost by dop
3. support StageScheduler, adaptive query execution and DynamicAssignedJob
dataroaring added a commit to dataroaring/incubator-doris that referenced this pull request Jul 14, 2024
924060929 added a commit that referenced this pull request Nov 7, 2024
Use NereidsSqlCoordinator instead of Coordinator because the code of Coordinator is too hard to maintaining

The main design approach is as follows:

1. Divide the original flat Coordinator into multiple modules, with each module maintaining high cohesion.
- `DistributePlanner`: The logic for calculating parallelism has been extracted in #36531, and in the future, we will dynamically calculate parallelism based on cost.
- `CoordinatorContext`: Some global parameters and states related to the Coordinator are encapsulated within CoordinatorContext.
- `PipelineExecutionTask`: The entire scheduling task is encapsulated by PipelineExecutionTask, which includes the mapping relationship between each Backend and Pipeline task. PipelineExecutionTask contains two layers of tasks, each responsible for specific duties, with state maintenance handled internally rather than being centralized in the Coordinator.
  - `MultiFragmentsPipelineTask`: A Backend will generate multiple fragment tasks, which are bundled together and sent concurrently to the corresponding Backend.
  - `SingleFragmentPipelineTask`: A single fragment task for a Backend.
- `JobProcessor`: Describes two types of tasks: SQL tasks and Load tasks.
  - `QueryProcessor`: Represents query tasks and provides a ResultReceiver to obtain query results.
  - `LoadProcessor`: Represents Insert into and Broker load tasks, providing a blocking function to wait for load completion.
- `ThriftPlansBuilder`: Uses the DistributedPlan structure to build thrift parameters and encapsulates some intermediate temporary variables within functions, rather than placing them in the Coordinator.

2. The overall Coordinator logic is more clearly organized. We can see that the NereidsCoordinator consists of only a few functions, allowing quick understanding of the main flow when reading the code.
  - Construct CoordinatorContext.
  - Enqueue the tasks.
  - Handle different sinks accordingly.
  - Register the Coordinator with `QeProcessorImpl` for cancellation and progress tracking.
  - Construct thrift parameters.
  - Build PipelineTask.
  - Initiate RPC calls to each Backend.


TODO:
1. delete old `Coordinator`
2. support cloud mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/3.0.0-merged not-merge/2.1 reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants