Skip to content

Conversation

@924060929
Copy link
Contributor

@924060929 924060929 commented Apr 1, 2024

Proposed changes

#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

@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
Copy link
Contributor Author

run buildall

@924060929
Copy link
Contributor Author

run buildall

@924060929
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	16782	4516	4470	4470
q2	2021	193	203	193
q3	10549	1314	1526	1314
q4	10430	958	1091	958
q5	7528	3193	3134	3134
q6	238	133	135	133
q7	1166	638	627	627
q8	9448	2288	2243	2243
q9	7899	7193	7154	7154
q10	8549	3683	3678	3678
q11	428	251	241	241
q12	420	219	214	214
q13	17783	2909	2944	2909
q14	277	244	239	239
q15	535	490	487	487
q16	515	406	389	389
q17	1035	978	969	969
q18	7518	6641	6583	6583
q19	1769	1679	1702	1679
q20	635	321	306	306
q21	3923	3460	3465	3460
q22	389	308	313	308
Total cold run time: 109837 ms
Total hot run time: 41688 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4517	4444	4461	4444
q2	357	233	222	222
q3	3076	3064	3078	3064
q4	1969	1985	1947	1947
q5	5399	5384	5364	5364
q6	228	127	123	123
q7	2276	1786	1777	1777
q8	3463	3586	3554	3554
q9	9321	9276	9322	9276
q10	3843	3944	3953	3944
q11	568	459	449	449
q12	742	559	541	541
q13	12836	2908	2923	2908
q14	303	263	251	251
q15	522	473	470	470
q16	481	413	420	413
q17	1854	1839	1823	1823
q18	7793	7414	7331	7331
q19	1836	1811	1827	1811
q20	1994	1734	1726	1726
q21	5219	4880	4961	4880
q22	510	426	430	426
Total cold run time: 69107 ms
Total hot run time: 56744 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 181148 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 dc0364e023a57edf499fbb7f2715553c8ba4890f, data reload: false

query1	903	1130	1129	1129
query2	6472	1780	1824	1780
query3	6675	209	213	209
query4	24342	21429	21626	21429
query5	4173	404	408	404
query6	268	190	178	178
query7	4603	307	295	295
query8	231	181	180	180
query9	8476	2234	2235	2234
query10	604	273	280	273
query11	15022	14482	14303	14303
query12	156	97	95	95
query13	1651	388	390	388
query14	8746	6742	7069	6742
query15	218	178	181	178
query16	6786	275	272	272
query17	992	635	576	576
query18	1805	303	286	286
query19	202	165	163	163
query20	99	94	96	94
query21	199	128	128	128
query22	4931	4824	4827	4824
query23	33344	32664	32525	32525
query24	11951	3158	3119	3119
query25	681	404	406	404
query26	1898	167	170	167
query27	2940	334	336	334
query28	6652	1834	1810	1810
query29	1134	597	597	597
query30	297	152	148	148
query31	983	712	736	712
query32	100	69	62	62
query33	723	260	259	259
query34	1003	492	499	492
query35	861	703	706	703
query36	1026	844	867	844
query37	245	77	80	77
query38	3526	3366	3427	3366
query39	1582	1519	1520	1519
query40	297	142	140	140
query41	50	47	46	46
query42	113	105	101	101
query43	459	403	410	403
query44	1109	720	714	714
query45	280	265	260	260
query46	1069	807	777	777
query47	1871	1788	1791	1788
query48	376	309	312	309
query49	1163	373	364	364
query50	807	393	403	393
query51	6851	6841	6721	6721
query52	121	104	99	99
query53	366	300	296	296
query54	332	248	248	248
query55	89	83	76	76
query56	253	243	228	228
query57	1210	1124	1115	1115
query58	244	228	233	228
query59	2529	2388	2359	2359
query60	255	247	273	247
query61	114	111	110	110
query62	716	464	459	459
query63	323	292	283	283
query64	6615	3349	3327	3327
query65	3077	3018	3022	3018
query66	1447	323	320	320
query67	15438	14948	15056	14948
query68	7831	568	584	568
query69	546	338	332	332
query70	1221	1113	1110	1110
query71	517	281	279	279
query72	6372	2583	2445	2445
query73	815	323	326	323
query74	6705	6418	6320	6320
query75	3615	2280	2283	2280
query76	5299	1136	1208	1136
query77	616	268	257	257
query78	10962	10209	10054	10054
query79	8402	522	538	522
query80	1443	428	430	428
query81	498	230	219	219
query82	629	105	102	102
query83	218	167	161	161
query84	277	89	91	89
query85	1461	305	287	287
query86	390	281	306	281
query87	3735	3474	3461	3461
query88	3657	2276	2277	2276
query89	572	374	368	368
query90	2039	177	180	177
query91	134	108	107	107
query92	59	56	53	53
query93	6623	556	537	537
query94	1213	193	201	193
query95	445	345	334	334
query96	607	272	266	266
query97	2676	2465	2497	2465
query98	230	226	222	222
query99	1348	841	821	821
Total cold run time: 295229 ms
Total hot run time: 181148 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.08	0.04	0.04
query3	0.23	0.04	0.05
query4	1.69	0.06	0.06
query5	0.47	0.47	0.49
query6	1.15	0.66	0.65
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.57	0.51	0.52
query10	0.56	0.57	0.58
query11	0.15	0.11	0.10
query12	0.13	0.11	0.11
query13	0.62	0.59	0.60
query14	0.77	0.79	0.80
query15	0.87	0.82	0.84
query16	0.36	0.36	0.35
query17	0.96	0.98	0.97
query18	0.24	0.26	0.25
query19	1.81	1.71	1.71
query20	0.01	0.01	0.00
query21	15.43	0.75	0.72
query22	3.24	5.41	1.36
query23	17.53	1.32	1.14
query24	1.78	0.25	0.22
query25	0.13	0.09	0.09
query26	0.29	0.17	0.19
query27	0.09	0.08	0.08
query28	13.46	0.95	0.94
query29	12.53	3.46	3.39
query30	0.25	0.06	0.06
query31	2.87	0.39	0.40
query32	3.25	0.48	0.47
query33	2.84	2.91	2.79
query34	15.53	4.31	4.30
query35	4.38	4.34	4.34
query36	0.67	0.48	0.48
query37	0.21	0.17	0.16
query38	0.18	0.15	0.16
query39	0.04	0.04	0.04
query40	0.18	0.14	0.17
query41	0.09	0.05	0.05
query42	0.05	0.05	0.06
query43	0.04	0.04	0.04
Total cold run time: 105.84 s
Total hot run time: 29.68 s

@doris-robot
Copy link

Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'

Load test result on commit dc0364e023a57edf499fbb7f2715553c8ba4890f with default session variables
Stream load json:         18 seconds loaded 2358488459 Bytes, about 124 MB/s
Stream load orc:          59 seconds loaded 1101869774 Bytes, about 17 MB/s
Stream load parquet:      32 seconds loaded 861443392 Bytes, about 25 MB/s
Insert into select:       17.7 seconds inserted 10000000 Rows, about 564K ops/s

@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2024

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

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

github-actions bot commented Apr 2, 2024

PR approved by anyone and no changes requested.

@924060929 924060929 merged commit 8b070d1 into apache:master Apr 2, 2024
@924060929 924060929 deleted the fix_link_children branch April 2, 2024 02:24
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Apr 10, 2024
apache#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1)
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Apr 10, 2024
apache#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1)
yiguolei pushed a commit that referenced this pull request Apr 10, 2024
…33460)

* [enhancement](Nereids) refactor expression rewriter to pattern match (#32617)

this pr can improve the performance of the nereids planner, in plan stage.

1. refactor expression rewriter to pattern match, so the lots of expression rewrite rules can criss-crossed apply in a big bottom-up iteration, and rewrite until the expression became stable. now we can process more cases because original there has no loop, and sometimes only process the top expression, like `SimplifyArithmeticRule`.
2. replace `Collection.stream()` to `ImmutableXxx.Builder` to avoid useless method call
3. loop unrolling some codes, like `Expression.<init>`, `PlanTreeRewriteBottomUpJob.pushChildrenJobs`
4. use type/arity specified-code, like `OneRangePartitionEvaluator.toNereidsLiterals()`, `PartitionRangeExpander.tryExpandRange()`, `PartitionRangeExpander.enumerableCount()`
5. refactor `ExtractCommonFactorRule`, now we can extract more cases, and I fix the deed loop when use `ExtractCommonFactorRule` and `SimplifyRange` in one iterative, because `SimplifyRange` generate right deep tree, but `ExtractCommonFactorRule` generate left deep tree
6. refactor `FoldConstantRuleOnFE`, support visitor/pattern match mode, in ExpressionNormalization, pattern match can criss-crossed apply with other rules; in PartitionPruner, visitor can evaluate expression faster
7. lazy compute and cache some operation
8. use int field to compare date
9. use BitSet to find disableNereidsRules
10. two level loop usually faster then build Multimap when bind slot in Scope, so I revert the code
11. `PlanTreeRewriteBottomUpJob` don't need to clearStatePhase any more

### test case
100 threads parallel continuous send this sql which query an empty table, test in my mac machine(m2 chip, 8 core), enable sql cache
```sql
select  count(1),date_format(time_col,'%Y%m%d'),varchar_col1
from tbl
where  partition_date>'2024-02-15'  and (varchar_col2 ='73130' or varchar_col3='73130') and time_col>'2024-03-04'
  and  time_col<'2024-03-05'
group by date_format(time_col,'%Y%m%d'),varchar_col1
order by date_format(time_col,'%Y%m%d') desc, varchar_col1 desc,count(1) asc
limit 1000
```

before this pr: 3100 peak QPS, about 2700 avg QPS
after this pr: 4800 peak QPS, about 4400 avg QPS

(cherry picked from commit 7338683)

* [fix](Nereids) fix link children failed (#33134)

#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1)
924060929 added a commit to 924060929/incubator-doris that referenced this pull request Apr 10, 2024
apache#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1)
yiguolei pushed a commit that referenced this pull request Apr 10, 2024
#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1)
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/2.1.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants