Skip to content

Conversation

@LiBinfeng-01
Copy link
Contributor

pick: #47288
Problem Summary:
explain select substr(current_date, 1, 10);
when logicalPlanBuilder build ast from original sql of date acquired functions like current_date, it would add an alias above. Which would stop folding constant when fold constant rule traversing expression tree So remove alias when translate to ast

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

…7288)

Problem Summary:
explain select substr(current_date, 1, 10);
when logicalPlanBuilder build ast from original sql of date acquired
functions like current_date, it would add an alias above. Which would
stop folding constant when fold constant rule traversing expression tree
So remove alias when translate to ast
@Thearas
Copy link
Contributor

Thearas commented Feb 24, 2025

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

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@LiBinfeng-01
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17588	7375	7185	7185
q2	2049	172	167	167
q3	10610	1042	1159	1042
q4	10557	720	663	663
q5	7756	2833	2771	2771
q6	233	146	144	144
q7	984	622	611	611
q8	9367	2051	2031	2031
q9	6592	6381	6346	6346
q10	6981	2290	2346	2290
q11	467	261	265	261
q12	400	212	214	212
q13	18024	3078	3037	3037
q14	248	203	211	203
q15	559	504	517	504
q16	639	590	591	590
q17	964	654	542	542
q18	7315	6702	6615	6615
q19	1389	1051	968	968
q20	481	210	201	201
q21	4274	3183	3288	3183
q22	1070	992	999	992
Total cold run time: 108547 ms
Total hot run time: 40558 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7248	7221	7192	7192
q2	325	230	228	228
q3	2904	2903	2874	2874
q4	2033	1816	1777	1777
q5	5696	5748	5680	5680
q6	223	140	138	138
q7	2279	1787	1842	1787
q8	3342	3541	3501	3501
q9	8739	8858	8885	8858
q10	3600	3593	3556	3556
q11	586	505	500	500
q12	769	587	587	587
q13	9933	3180	3149	3149
q14	314	297	274	274
q15	559	523	526	523
q16	692	638	630	630
q17	1817	1616	1620	1616
q18	8326	7880	7594	7594
q19	1662	1645	1400	1400
q20	2117	1899	1907	1899
q21	5436	5271	5255	5255
q22	1125	1051	1005	1005
Total cold run time: 69725 ms
Total hot run time: 60023 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 198678 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 010acd13f664e4a8959740f4984cfc0f62aa2752, data reload: false

query1	1283	914	911	911
query2	6239	2087	2088	2087
query3	10851	4351	4315	4315
query4	66727	29533	23843	23843
query5	5009	449	433	433
query6	407	168	167	167
query7	5638	308	299	299
query8	301	215	228	215
query9	9340	2700	2691	2691
query10	484	281	274	274
query11	17933	15257	15783	15257
query12	158	109	110	109
query13	1576	439	437	437
query14	10849	7376	7594	7376
query15	203	179	176	176
query16	7114	471	520	471
query17	1146	613	597	597
query18	1789	326	348	326
query19	245	163	160	160
query20	125	122	117	117
query21	206	103	102	102
query22	4845	4417	4514	4417
query23	34549	34393	34175	34175
query24	6246	2928	2874	2874
query25	506	390	401	390
query26	673	176	184	176
query27	1882	349	352	349
query28	4469	2446	2417	2417
query29	707	470	429	429
query30	240	160	181	160
query31	1004	860	859	859
query32	70	55	60	55
query33	474	286	286	286
query34	907	511	510	510
query35	845	758	747	747
query36	1084	974	969	969
query37	121	68	74	68
query38	4129	4033	3972	3972
query39	1509	1474	1635	1474
query40	206	101	101	101
query41	51	48	48	48
query42	119	101	98	98
query43	544	515	496	496
query44	1223	844	821	821
query45	185	169	167	167
query46	1169	725	756	725
query47	2001	1940	1914	1914
query48	496	392	392	392
query49	728	389	403	389
query50	852	453	432	432
query51	7321	7326	7083	7083
query52	96	88	86	86
query53	255	179	184	179
query54	555	446	445	445
query55	79	80	73	73
query56	262	247	256	247
query57	1230	1102	1132	1102
query58	206	199	215	199
query59	3408	3250	3062	3062
query60	272	245	250	245
query61	107	124	107	107
query62	845	715	729	715
query63	232	188	189	188
query64	1368	687	616	616
query65	3310	3202	3225	3202
query66	702	307	298	298
query67	15950	15877	15509	15509
query68	3237	600	577	577
query69	418	270	269	269
query70	1223	1130	1135	1130
query71	365	262	253	253
query72	6108	4149	4092	4092
query73	751	344	358	344
query74	10316	9078	9053	9053
query75	3389	2667	2709	2667
query76	1537	1082	1184	1082
query77	478	275	285	275
query78	10463	9606	9704	9606
query79	1467	594	603	594
query80	898	454	442	442
query81	512	245	241	241
query82	1247	127	132	127
query83	299	152	143	143
query84	282	78	76	76
query85	905	306	289	289
query86	324	287	299	287
query87	4438	4334	4356	4334
query88	3818	2411	2351	2351
query89	417	293	287	287
query90	1987	193	188	188
query91	183	148	151	148
query92	70	52	51	51
query93	1896	539	535	535
query94	812	297	311	297
query95	361	267	262	262
query96	616	278	276	276
query97	3301	3184	3157	3157
query98	214	203	196	196
query99	1719	1420	1434	1420
Total cold run time: 319706 ms
Total hot run time: 198678 ms

@doris-robot
Copy link

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

query1	0.03	0.02	0.03
query2	0.07	0.03	0.03
query3	0.24	0.07	0.06
query4	1.62	0.10	0.10
query5	0.52	0.49	0.50
query6	1.13	0.73	0.72
query7	0.02	0.01	0.01
query8	0.04	0.03	0.03
query9	0.56	0.50	0.50
query10	0.56	0.55	0.56
query11	0.13	0.10	0.11
query12	0.14	0.11	0.11
query13	0.60	0.59	0.60
query14	2.71	2.87	2.85
query15	0.91	0.82	0.84
query16	0.39	0.39	0.39
query17	1.02	1.01	1.01
query18	0.24	0.23	0.22
query19	1.81	1.79	2.05
query20	0.02	0.02	0.01
query21	15.35	0.58	0.57
query22	2.80	2.14	2.41
query23	16.78	1.20	0.84
query24	3.27	1.02	1.60
query25	0.39	0.09	0.11
query26	0.43	0.12	0.12
query27	0.04	0.05	0.05
query28	10.41	1.10	1.06
query29	12.58	3.26	3.23
query30	0.24	0.06	0.06
query31	2.86	0.40	0.39
query32	3.23	0.46	0.46
query33	3.00	2.98	3.07
query34	16.71	4.45	4.45
query35	4.50	4.55	4.44
query36	0.70	0.48	0.50
query37	0.10	0.06	0.06
query38	0.04	0.04	0.04
query39	0.04	0.03	0.02
query40	0.16	0.12	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.04	0.03
Total cold run time: 106.53 s
Total hot run time: 33.09 s

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dataroaring dataroaring merged commit aa4007e into apache:branch-3.0 Feb 24, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants