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

[fix](Nereids) fix fold constant of time acquired functions #47288

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

LiBinfeng-01
Copy link
Collaborator

@LiBinfeng-01 LiBinfeng-01 commented Jan 21, 2025

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

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

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

@hello-stephen
Copy link
Contributor

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
Collaborator Author

run buildall

1 similar comment
@LiBinfeng-01
Copy link
Collaborator Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17610	5516	5369	5369
q2	2055	302	172	172
q3	10416	1228	725	725
q4	10222	964	538	538
q5	7638	2382	2156	2156
q6	187	165	134	134
q7	923	768	622	622
q8	9231	1374	1150	1150
q9	5348	4856	4880	4856
q10	6833	2304	1888	1888
q11	485	276	260	260
q12	354	361	225	225
q13	17783	3678	3049	3049
q14	236	244	235	235
q15	536	480	476	476
q16	630	664	582	582
q17	584	880	341	341
q18	7031	6734	6355	6355
q19	1965	956	562	562
q20	326	324	199	199
q21	2964	2260	2056	2056
q22	361	333	311	311
Total cold run time: 103718 ms
Total hot run time: 32261 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5514	5483	5489	5483
q2	242	327	235	235
q3	2293	2614	2278	2278
q4	1418	1820	1422	1422
q5	4313	4748	4670	4670
q6	167	161	132	132
q7	2058	1890	1869	1869
q8	2609	2843	2699	2699
q9	7373	7148	7276	7148
q10	3015	3274	2796	2796
q11	569	512	484	484
q12	658	707	594	594
q13	3603	3933	3318	3318
q14	291	298	275	275
q15	501	484	487	484
q16	658	683	655	655
q17	1254	1729	1254	1254
q18	7630	7529	7372	7372
q19	823	1005	1154	1005
q20	2017	2016	1912	1912
q21	5657	5066	4932	4932
q22	658	614	612	612
Total cold run time: 53321 ms
Total hot run time: 51629 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192935 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 69577ae5f3ee44388687ee314cc953ffa157f067, data reload: false

query1	1295	1016	925	925
query2	6304	2041	1972	1972
query3	11132	4634	4587	4587
query4	61395	29765	22758	22758
query5	5597	610	456	456
query6	434	189	166	166
query7	5558	497	299	299
query8	321	230	232	230
query9	7915	2600	2579	2579
query10	436	303	241	241
query11	17635	15023	15640	15023
query12	166	110	105	105
query13	1445	555	412	412
query14	11090	6631	7650	6631
query15	217	195	203	195
query16	7093	619	451	451
query17	1144	729	572	572
query18	1631	417	302	302
query19	198	183	157	157
query20	114	129	114	114
query21	227	118	101	101
query22	4515	4823	4342	4342
query23	33975	33218	33185	33185
query24	5545	2298	2316	2298
query25	480	497	425	425
query26	631	292	160	160
query27	1708	499	337	337
query28	3840	2443	2431	2431
query29	581	577	488	488
query30	209	191	152	152
query31	926	877	811	811
query32	64	59	60	59
query33	463	363	319	319
query34	756	880	518	518
query35	827	875	753	753
query36	1024	1063	962	962
query37	123	108	83	83
query38	4346	4407	4191	4191
query39	1514	1622	1456	1456
query40	205	127	104	104
query41	52	50	47	47
query42	125	109	103	103
query43	521	525	499	499
query44	1323	825	848	825
query45	198	174	168	168
query46	902	1081	668	668
query47	1887	1899	1814	1814
query48	394	423	316	316
query49	700	488	417	417
query50	669	680	419	419
query51	6976	7067	7066	7066
query52	106	99	95	95
query53	241	260	197	197
query54	490	506	439	439
query55	99	88	89	88
query56	297	297	266	266
query57	1239	1248	1096	1096
query58	238	234	227	227
query59	2925	2998	2866	2866
query60	272	277	265	265
query61	116	134	122	122
query62	756	701	649	649
query63	227	188	186	186
query64	1151	981	660	660
query65	3300	3164	3225	3164
query66	769	392	298	298
query67	16045	15637	15363	15363
query68	5015	825	533	533
query69	504	316	264	264
query70	1198	1101	1114	1101
query71	426	290	255	255
query72	6194	3820	3777	3777
query73	805	753	352	352
query74	10392	8976	8826	8826
query75	3218	3162	2690	2690
query76	3799	1177	783	783
query77	514	365	279	279
query78	10173	10503	9428	9428
query79	2641	842	599	599
query80	1657	538	465	465
query81	573	274	244	244
query82	319	157	125	125
query83	266	182	154	154
query84	289	89	74	74
query85	760	341	312	312
query86	444	306	276	276
query87	4471	4431	4329	4329
query88	3466	2181	2134	2134
query89	408	332	297	297
query90	1632	192	193	192
query91	136	136	104	104
query92	65	57	53	53
query93	1772	845	539	539
query94	747	418	292	292
query95	334	270	262	262
query96	498	618	282	282
query97	2756	2870	2744	2744
query98	214	198	200	198
query99	1266	1380	1299	1299
Total cold run time: 312049 ms
Total hot run time: 192935 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.07	0.03	0.04
query3	0.24	0.06	0.07
query4	1.64	0.11	0.10
query5	0.44	0.41	0.42
query6	1.17	0.65	0.65
query7	0.03	0.01	0.02
query8	0.04	0.03	0.03
query9	0.59	0.51	0.51
query10	0.55	0.56	0.55
query11	0.14	0.10	0.10
query12	0.14	0.11	0.11
query13	0.60	0.59	0.59
query14	2.71	2.86	2.74
query15	0.89	0.83	0.83
query16	0.38	0.38	0.39
query17	1.04	1.02	0.99
query18	0.23	0.21	0.21
query19	1.89	1.76	2.03
query20	0.01	0.01	0.02
query21	15.36	0.90	0.58
query22	0.76	0.84	0.92
query23	15.05	1.40	0.54
query24	2.69	1.31	1.03
query25	0.17	0.32	0.07
query26	0.22	0.15	0.15
query27	0.05	0.05	0.05
query28	13.91	1.01	0.43
query29	12.56	3.90	3.27
query30	0.25	0.09	0.06
query31	2.83	0.58	0.39
query32	3.25	0.56	0.46
query33	3.00	3.01	3.04
query34	16.41	5.15	4.57
query35	4.62	4.56	4.52
query36	0.64	0.50	0.50
query37	0.10	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.02
query40	0.18	0.13	0.12
query41	0.08	0.03	0.02
query42	0.04	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 105.13 s
Total hot run time: 30.88 s

Copy link
Contributor

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

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Jan 22, 2025
Copy link
Contributor

PR approved by anyone and no changes requested.

@starocean999 starocean999 merged commit c9cac8f into apache:master Jan 22, 2025
29 of 30 checks passed
LiBinfeng-01 added a commit to LiBinfeng-01/doris that referenced this pull request Feb 14, 2025
…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
github-actions bot pushed a commit that referenced this pull request Feb 14, 2025
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
@wm1581066 wm1581066 added the usercase Important user case type label label Feb 15, 2025
LiBinfeng-01 added a commit to LiBinfeng-01/doris that referenced this pull request Feb 17, 2025
…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
morrySnow pushed a commit that referenced this pull request Feb 17, 2025
#47288 (#47920)

pick from master #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
lzyy2024 pushed a commit to lzyy2024/doris that referenced this pull request Feb 21, 2025
…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
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.9-merged dev/3.0.x reviewed usercase Important user case type label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants