Skip to content

Conversation

@yujun777
Copy link
Contributor

@yujun777 yujun777 commented Aug 6, 2025

What problem does this PR solve?

for sql random() > 10 and random() < 5, the two random() are different, in order to deal with this case, introduce a class UniqueFunction, UniqueFunction hold a unique id, when check two unique function equal or not is just to compare their class types and the unique id.

UniqueFunction have four child classes:

  1. random;
  2. random_byte;
  3. uuid;
  4. uuid_numeric;

in most case, two unique function should treat as different and have different unique id, but in aggregate, need to treat some unique functions have the same unique id, otherwise the aggregate will throw error. so need to bind their unqiue id to some other's unique id;

here is the detail:

for unique scalar functions in PROJECT/HAVING/QUALIFY/SORT/AGG OUTPUT/REPEAT OUTPUT,
if they have a related AGG plan, need bind their unique id to the matched AGG's group by unique functions.
case as below:

  1. if no aggregate or the aggregate group by expressions don't contain unique function, then all the unique functions will be different.

example i:

     select random1(), a + random2()
     from t
     order by random3(), a + random4()

since it does not contain aggregate, so random1(), random2(), random3(), random4() will be different and have different unique id;

example ii:

    select sum(a + random1()), max(a + random2())
    from t

it will rewrite as:

    select sum(a + random1()), max(a + random2())
    from t
    group by ()

since the aggregate's group by list is empty, so random1(), random2(), will be different.

example iii:

    select a + random1(), sum(a + random2()), max(a + random3())
    from t
    group by a

since the group by list (a) not contain unique function, so random1(), random2(), random3() will be different.

  1. if some aggregate group by expressions contains unique function, then bind unique id to unique function with the longest matched group by.

example:

     select random1(), a + random2(), sum(random3()), sum(a + random4())
     from t
     where random5() > 0 and a + random6() > 0
     group by random7(), random8(), a + random9(), a + random10()
     order by random11(), abs(a + random12())

firstly, handle with the group by: if two group by can whole match, then their matched unique function will be equal and have the same unique id, so random7() equals with random8(), random9() will be equals with random10(), but random7() not equals with random9.

then handle with the PROJECT/HAVING/QUALIFY/SORT/AGG OUTPUT/REPEAT OUTPUT expressions, and we will have:
random1()/random3()/random11() are equal to random7(), and random2()/random4()/random12() are equal to random9(), then update their unique id to the same.

notice for FILTER random5()/random6(), they will be different with all other randoms.

  1. for logical repeat, will flatten grouping sets like an aggregate's group by lists, then whole match the group by expressions and bind the unique id.

example:

    select random1(),  random2(),  a + random3(), a + random4()
    from t
    group by grouping sets ((), (random5()), (random6()), (a + random7()), (a + random8()))

firstly, handle with the grouping sets: random5() equals to random6(), random7() equals random8();

then, handle with the repeat output: random1()/random2() equal to random5(), random3()/random4() equal to random7().

  1. if it's a distinct project and no contains aggregate functions and no contains aggregate plan. then it will rewrite to an aggregate, but will have some difference with the origin raw aggregate.

example:

    select distinct random1(), random2(), a + random3(), a + random4()
    from t
    order by random5(), a + random6()

it will rewrite as:

    select random1(), random2(), a + random3(), a + random4()
    from t
    group by random1(), random2(), a + random3(), a + random4()
    order by random5(), a + random6()

for the rewritten aggregate:

firstly, for the group by: the group by expressions will not try to match with each other even if they seem look the same, so random1() will not equal to random2(), random3() will not equal to random4(),

then handle with the PROJECT/HAVING/QUALIFY/SORT, they will match with the first matched longest group by expression, so random5() equals to random1 but not equal to random2(), random6() equals to random3() but not equal to random5(), then update their unique id to the same.

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?

@yujun777 yujun777 changed the title Fix non foldable [draft](nereids) Add unique scalar function Aug 6, 2025
@yujun777 yujun777 changed the title [draft](nereids) Add unique scalar function [draft](nereids) Add unique function Aug 7, 2025
@yujun777
Copy link
Contributor Author

yujun777 commented Aug 7, 2025

run buildall

This reverts commit 147c2cd.
@yujun777
Copy link
Contributor Author

yujun777 commented Aug 7, 2025

run buildall

@yujun777 yujun777 force-pushed the fix-non-foldable branch 2 times, most recently from 459e683 to 573041a Compare August 8, 2025 04:50
@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17575	5402	5270	5270
q2	1960	278	192	192
q3	10300	1424	741	741
q4	10226	1093	528	528
q5	7516	2351	2313	2313
q6	180	164	136	136
q7	896	783	623	623
q8	9312	1332	1131	1131
q9	6692	5117	5105	5105
q10	6910	2366	1987	1987
q11	457	275	269	269
q12	352	361	234	234
q13	17785	3466	2954	2954
q14	236	242	223	223
q15	521	454	466	454
q16	419	420	380	380
q17	577	833	351	351
q18	7521	7024	6967	6967
q19	1788	988	554	554
q20	339	313	218	218
q21	3453	2488	2265	2265
q22	1077	1073	1020	1020
Total cold run time: 106092 ms
Total hot run time: 33915 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5456	5316	5404	5316
q2	240	323	220	220
q3	2108	2547	2216	2216
q4	1312	1742	1359	1359
q5	4133	4411	4546	4411
q6	260	186	144	144
q7	1912	1876	1901	1876
q8	2588	2504	2548	2504
q9	7310	7322	7129	7129
q10	3193	3336	2924	2924
q11	550	552	500	500
q12	709	793	628	628
q13	3741	3736	3202	3202
q14	321	343	273	273
q15	501	462	471	462
q16	528	656	443	443
q17	1186	1478	1353	1353
q18	9404	7609	7603	7603
q19	11568	1003	1104	1003
q20	2012	2042	1843	1843
q21	15520	4249	4380	4249
q22	1054	1076	999	999
Total cold run time: 75606 ms
Total hot run time: 50657 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 169861 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 573041ad28380ecf0d4a30d9275221fb77f91e03, data reload: false

============================================
query1	985	373	412	373
query2	6525	2008	1664	1664
query3	6742	227	223	223
query4	27086	23509	22878	22878
query5	4335	630	536	536
query6	331	244	225	225
query7	4628	513	293	293
query8	284	241	231	231
query9	8553	2963	2932	2932
query10	473	342	288	288
query11	15758	14910	14747	14747
query12	183	135	137	135
query13	1664	568	419	419
query14	8697	5815	5866	5815
query15	218	202	167	167
query16	7570	662	472	472
query17	1268	756	649	649
query18	2087	453	330	330
query19	228	208	189	189
query20	152	142	142	142
query21	234	127	112	112
query22	3978	3896	3786	3786
query23	34631	34549	34175	34175
query24	6537	2379	2426	2379
query25	481	524	430	430
query26	715	287	171	171
query27	2352	518	352	352
query28	3005	2334	2302	2302
query29	655	587	488	488
query30	288	230	199	199
query31	895	793	701	701
query32	92	74	79	74
query33	559	417	364	364
query34	800	857	522	522
query35	814	834	743	743
query36	1004	1058	940	940
query37	136	113	91	91
query38	3939	3985	3903	3903
query39	1430	1395	1361	1361
query40	244	142	133	133
query41	63	58	55	55
query42	139	124	138	124
query43	516	510	480	480
query44	1410	881	877	877
query45	198	199	178	178
query46	963	1076	662	662
query47	1797	1831	1796	1796
query48	392	413	312	312
query49	672	507	431	431
query50	679	680	421	421
query51	4160	4162	4203	4162
query52	129	132	118	118
query53	259	285	207	207
query54	647	652	561	561
query55	93	95	86	86
query56	360	350	361	350
query57	1177	1219	1141	1141
query58	329	357	333	333
query59	2689	2647	2634	2634
query60	407	388	399	388
query61	130	129	121	121
query62	769	738	663	663
query63	267	211	213	211
query64	2351	1091	763	763
query65	4263	4130	4104	4104
query66	885	446	324	324
query67	query68	17132	875	969	875
query69	1094	291	279	279
query70	1327	1077	1156	1077
query71	720	315	326	315
query72	9255	2350	2168	2168
query73	3580	701	352	352
query74	9053	9039	8976	8976
query75	7610	3145	2682	2682
query76	8926	1230	799	799
query77	1156	413	340	340
query78	9542	11684	9470	9470
query79	15945	605	585	585
query80	3403	550	506	506
query81	591	262	232	232
query82	595	153	123	123
query83	443	302	265	265
query84	303	93	78	78
query85	1286	442	350	350
query86	392	332	303	303
query87	4311	4123	4069	4069
query88	5506	2245	2218	2218
query89	514	373	318	318
query90	2517	228	231	228
query91	144	137	112	112
query92	87	72	66	66
query93	6837	988	658	658
query94	1221	395	277	277
query95	423	352	328	328
query96	502	583	280	280
query97	2712	2688	2604	2604
query98	245	235	220	220
query99	1496	1430	1272	1272
Total cold run time: 305168 ms
Total hot run time: 169861 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.24	0.07	0.07
query4	1.60	0.11	0.11
query5	0.42	0.44	0.44
query6	1.16	0.70	0.69
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.57	0.48	0.47
query10	0.53	0.52	0.53
query11	0.16	0.11	0.10
query12	0.15	0.11	0.11
query13	0.68	0.64	0.64
query14	0.97	1.10	1.08
query15	0.93	0.90	0.92
query16	0.39	0.41	0.39
query17	1.05	1.06	1.09
query18	0.21	0.20	0.20
query19	2.04	1.90	1.93
query20	0.02	0.01	0.01
query21	15.38	0.86	0.57
query22	0.82	0.97	0.78
query23	15.00	1.19	0.65
query24	6.79	1.57	1.10
query25	0.52	0.17	0.14
query26	0.61	0.14	0.14
query27	0.05	0.06	0.06
query28	10.09	0.87	0.45
query29	12.62	3.79	3.28
query30	3.00	2.96	2.98
query31	2.82	0.56	0.40
query32	3.24	0.57	0.49
query33	3.01	3.17	3.25
query34	15.92	5.29	4.90
query35	4.94	4.91	5.03
query36	0.71	0.52	0.51
query37	0.10	0.07	0.06
query38	0.05	0.05	0.05
query39	0.03	0.03	0.03
query40	0.17	0.14	0.13
query41	0.08	0.03	0.04
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 107.34 s
Total hot run time: 33.68 s

@yujun777 yujun777 changed the title [draft](nereids) Add unique function [feat](nereids) Add unique function Aug 8, 2025
@yujun777 yujun777 marked this pull request as draft August 8, 2025 08:26
@yujun777 yujun777 marked this pull request as ready for review August 8, 2025 08:26
@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17595	5225	5255	5225
q2	1915	275	183	183
q3	10339	1291	675	675
q4	10220	967	519	519
q5	7507	2296	2290	2290
q6	176	163	135	135
q7	889	737	620	620
q8	9295	1242	1036	1036
q9	6717	5160	5023	5023
q10	6893	2357	1962	1962
q11	456	277	257	257
q12	357	356	226	226
q13	17766	3427	2965	2965
q14	232	253	226	226
q15	535	473	486	473
q16	435	413	381	381
q17	556	814	356	356
q18	7404	6913	6883	6883
q19	1244	983	552	552
q20	320	317	212	212
q21	3400	3011	2275	2275
q22	1056	1034	994	994
Total cold run time: 105307 ms
Total hot run time: 33468 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5274	5267	5252	5252
q2	238	304	220	220
q3	2069	2551	2201	2201
q4	1298	1692	1313	1313
q5	4124	4108	4419	4108
q6	220	178	138	138
q7	1969	1971	1846	1846
q8	2542	2644	2591	2591
q9	7287	7180	7445	7180
q10	3183	3329	2897	2897
q11	548	508	506	506
q12	667	841	642	642
q13	3362	3652	3183	3183
q14	290	328	284	284
q15	490	475	455	455
q16	455	496	465	465
q17	1240	1416	1444	1416
q18	8431	7609	7727	7609
q19	5974	979	875	875
q20	1960	2059	1861	1861
q21	15475	4290	4238	4238
q22	1053	1048	956	956
Total cold run time: 68149 ms
Total hot run time: 50236 ms

@doris-robot
Copy link

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

============================================
query1	989	380	416	380
query2	6549	1759	1670	1670
query3	6736	227	235	227
query4	26846	23750	23382	23382
query5	4398	640	509	509
query6	310	242	214	214
query7	4650	511	298	298
query8	276	227	221	221
query9	8609	2940	2929	2929
query10	478	341	315	315
query11	15458	15111	14711	14711
query12	188	138	133	133
query13	1659	551	410	410
query14	8627	6033	5941	5941
query15	215	185	181	181
query16	7551	687	495	495
query17	1222	776	647	647
query18	2037	465	333	333
query19	223	211	190	190
query20	150	143	154	143
query21	224	125	112	112
query22	3886	3911	3823	3823
query23	34701	34637	34459	34459
query24	6902	2447	2469	2447
query25	480	500	433	433
query26	716	291	160	160
query27	2352	493	353	353
query28	2988	2334	2322	2322
query29	619	653	497	497
query30	305	226	211	211
query31	882	775	722	722
query32	97	76	82	76
query33	549	419	396	396
query34	806	841	515	515
query35	808	827	756	756
query36	1001	1039	951	951
query37	139	116	95	95
query38	3947	3995	3916	3916
query39	1423	1395	1373	1373
query40	237	147	131	131
query41	62	58	53	53
query42	137	123	127	123
query43	527	521	501	501
query44	1396	881	872	872
query45	206	196	180	180
query46	947	1083	666	666
query47	1777	1812	1749	1749
query48	400	434	309	309
query49	695	508	436	436
query50	677	674	415	415
query51	4263	4216	4205	4205
query52	130	131	114	114
query53	263	288	216	216
query54	665	670	554	554
query55	92	95	87	87
query56	359	353	359	353
query57	1178	1214	1122	1122
query58	334	335	336	335
query59	2616	2613	2499	2499
query60	397	417	390	390
query61	130	142	128	128
query62	791	726	646	646
query63	259	218	227	218
query64	2380	1099	767	767
query65	4255	4107	4128	4107
query66	1000	446	331	331
query67	query68	16868	953	974	953
query69	1050	277	275	275
query70	1439	1132	1075	1075
query71	712	320	328	320
query72	9219	2269	2204	2204
query73	3410	646	359	359
query74	9145	8898	8521	8521
query75	7482	3110	2688	2688
query76	8844	1224	802	802
query77	1151	425	333	333
query78	9566	10596	9202	9202
query79	14584	664	597	597
query80	1716	556	500	500
query81	563	262	236	236
query82	440	157	124	124
query83	357	365	273	273
query84	305	94	80	80
query85	924	378	333	333
query86	358	334	326	326
query87	4264	4180	4055	4055
query88	5340	2294	2277	2277
query89	506	367	320	320
query90	2625	241	241	241
query91	145	156	111	111
query92	90	72	68	68
query93	6083	988	651	651
query94	982	395	276	276
query95	406	412	331	331
query96	524	650	293	293
query97	2739	2739	2649	2649
query98	274	242	237	237
query99	1476	1439	1299	1299
Total cold run time: 299756 ms
Total hot run time: 170462 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.06	0.03
query3	0.25	0.07	0.07
query4	1.62	0.10	0.11
query5	0.44	0.42	0.44
query6	1.18	0.67	0.66
query7	0.02	0.02	0.01
query8	0.04	0.04	0.04
query9	0.56	0.49	0.47
query10	0.53	0.54	0.53
query11	0.16	0.10	0.10
query12	0.15	0.11	0.12
query13	0.66	0.65	0.64
query14	0.94	1.03	1.24
query15	0.92	0.87	0.88
query16	0.38	0.38	0.39
query17	1.10	1.06	1.05
query18	0.22	0.20	0.21
query19	2.05	1.85	1.79
query20	0.02	0.02	0.01
query21	15.40	0.84	0.56
query22	0.75	1.23	0.74
query23	14.81	1.16	0.60
query24	7.10	1.00	1.27
query25	0.51	0.22	0.08
query26	0.56	0.14	0.14
query27	0.06	0.05	0.05
query28	10.65	0.88	0.46
query29	12.62	3.83	3.38
query30	3.05	3.06	2.96
query31	2.81	0.56	0.39
query32	3.24	0.56	0.50
query33	3.13	3.07	3.24
query34	16.21	5.29	4.93
query35	4.93	4.90	4.97
query36	0.71	0.52	0.51
query37	0.10	0.08	0.07
query38	0.06	0.05	0.04
query39	0.04	0.03	0.03
query40	0.17	0.14	0.14
query41	0.08	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 108.43 s
Total hot run time: 33.19 s

@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run buildall

@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run p0

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 93.67% (222/237) 🎉
Increment coverage report
Complete coverage report

@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run p0

@yujun777
Copy link
Contributor Author

yujun777 commented Aug 8, 2025

run nonconcurrent

1 similar comment
@yujun777
Copy link
Contributor Author

yujun777 commented Aug 9, 2025

run nonconcurrent

@yujun777
Copy link
Contributor Author

yujun777 commented Aug 9, 2025

run nonConcurrent

924060929
924060929 previously approved these changes Aug 12, 2025
@github-actions
Copy link
Contributor

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 Aug 12, 2025
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@yujun777
Copy link
Contributor Author

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Aug 13, 2025
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17580	5261	5079	5079
q2	1919	294	184	184
q3	10299	1282	680	680
q4	10221	999	504	504
q5	7516	2427	2277	2277
q6	174	156	125	125
q7	914	743	604	604
q8	9295	1280	1076	1076
q9	6905	5172	5084	5084
q10	6914	2368	1956	1956
q11	476	281	260	260
q12	344	340	219	219
q13	17788	3635	2992	2992
q14	223	237	220	220
q15	560	487	480	480
q16	415	424	367	367
q17	599	848	349	349
q18	7435	7061	7004	7004
q19	1084	932	543	543
q20	343	321	226	226
q21	4025	3134	2354	2354
q22	1109	1009	985	985
Total cold run time: 106138 ms
Total hot run time: 33568 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5114	5101	5097	5097
q2	249	320	225	225
q3	2156	2655	2320	2320
q4	1391	1798	1312	1312
q5	4205	4379	4497	4379
q6	228	170	130	130
q7	2057	1930	1776	1776
q8	2592	2737	2618	2618
q9	7281	7354	7395	7354
q10	3081	3320	2854	2854
q11	571	503	506	503
q12	673	789	660	660
q13	3579	3951	3266	3266
q14	277	312	275	275
q15	518	479	479	479
q16	434	484	447	447
q17	1219	1519	1401	1401
q18	7939	7656	7647	7647
q19	800	854	841	841
q20	2051	2092	1976	1976
q21	4715	4316	4268	4268
q22	1080	1043	1030	1030
Total cold run time: 52210 ms
Total hot run time: 50858 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184582 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 0a6416f6e671b65097d329d8fa933d78e8de7380, data reload: false

query1	976	384	455	384
query2	6529	1698	1763	1698
query3	6775	222	223	222
query4	26282	23216	22848	22848
query5	4330	610	491	491
query6	308	228	189	189
query7	4619	485	283	283
query8	261	217	220	217
query9	8593	2834	2842	2834
query10	486	343	284	284
query11	15889	15192	15408	15192
query12	172	114	115	114
query13	1724	555	436	436
query14	9443	5824	5685	5685
query15	203	181	161	161
query16	7426	666	494	494
query17	1205	734	616	616
query18	2125	417	318	318
query19	192	207	166	166
query20	125	119	120	119
query21	221	128	112	112
query22	4077	4057	4071	4057
query23	34149	33446	33238	33238
query24	8124	2417	2323	2323
query25	538	468	395	395
query26	1237	274	150	150
query27	2753	497	341	341
query28	4296	2201	2184	2184
query29	809	543	440	440
query30	284	218	197	197
query31	888	810	723	723
query32	83	74	74	74
query33	560	372	327	327
query34	774	826	519	519
query35	801	829	743	743
query36	973	1034	914	914
query37	120	110	92	92
query38	4110	3920	3914	3914
query39	1472	1411	1397	1397
query40	215	124	113	113
query41	58	55	54	54
query42	120	110	110	110
query43	507	484	472	472
query44	1303	843	833	833
query45	174	170	170	170
query46	841	1004	622	622
query47	1729	1816	1724	1724
query48	375	415	302	302
query49	726	486	422	422
query50	646	676	397	397
query51	4191	4193	4018	4018
query52	109	116	103	103
query53	225	260	191	191
query54	600	595	512	512
query55	84	85	88	85
query56	308	297	293	293
query57	1202	1197	1154	1154
query58	278	261	263	261
query59	2540	2747	2672	2672
query60	344	323	313	313
query61	143	155	118	118
query62	806	755	640	640
query63	216	187	185	185
query64	4294	990	678	678
query65	4289	4204	4218	4204
query66	1191	406	316	316
query67	15459	15323	15090	15090
query68	8740	906	562	562
query69	466	332	278	278
query70	1248	1128	1151	1128
query71	455	334	310	310
query72	5234	4653	4620	4620
query73	696	570	343	343
query74	9064	9071	8939	8939
query75	3896	3068	2588	2588
query76	3620	1165	719	719
query77	795	407	310	310
query78	9544	9653	8962	8962
query79	2319	800	585	585
query80	658	595	473	473
query81	460	252	222	222
query82	451	135	106	106
query83	277	247	234	234
query84	301	110	81	81
query85	784	371	329	329
query86	340	325	278	278
query87	4257	4394	4145	4145
query88	2875	2171	2168	2168
query89	373	308	282	282
query90	1930	216	213	213
query91	144	140	109	109
query92	84	68	67	67
query93	1120	995	646	646
query94	684	405	303	303
query95	390	309	299	299
query96	476	576	271	271
query97	2653	2709	2555	2555
query98	224	214	207	207
query99	1477	1452	1307	1307
Total cold run time: 272940 ms
Total hot run time: 184582 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.24	0.07	0.08
query4	1.62	0.11	0.10
query5	0.43	0.41	0.40
query6	1.16	0.64	0.66
query7	0.02	0.02	0.02
query8	0.05	0.03	0.04
query9	0.60	0.55	0.52
query10	0.56	0.57	0.58
query11	0.16	0.11	0.11
query12	0.15	0.12	0.11
query13	0.64	0.61	0.60
query14	0.80	0.83	0.83
query15	0.88	0.85	0.86
query16	0.38	0.40	0.40
query17	1.04	1.05	1.03
query18	0.21	0.19	0.19
query19	1.95	1.88	1.82
query20	0.02	0.01	0.01
query21	15.42	0.93	0.56
query22	0.74	1.12	0.66
query23	15.00	1.33	0.64
query24	6.61	1.34	0.37
query25	0.53	0.23	0.15
query26	0.54	0.16	0.12
query27	0.06	0.06	0.06
query28	9.89	0.94	0.43
query29	12.61	3.86	3.23
query30	3.03	2.99	2.98
query31	2.81	0.62	0.37
query32	3.23	0.56	0.47
query33	3.03	3.08	3.01
query34	16.03	5.44	4.90
query35	4.90	4.90	4.92
query36	0.71	0.51	0.50
query37	0.10	0.07	0.07
query38	0.06	0.05	0.04
query39	0.03	0.02	0.02
query40	0.18	0.16	0.14
query41	0.07	0.03	0.03
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.68 s
Total hot run time: 32.07 s

@yujun777
Copy link
Contributor Author

run external

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 94.37% (218/231) 🎉
Increment coverage report
Complete coverage report

@yujun777 yujun777 changed the title [feat](nereids) Add unique function [feat](unique function) Add unique function Aug 14, 2025
@yujun777
Copy link
Contributor Author

run cloud_p0

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 22, 2025
@github-actions
Copy link
Contributor

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

@morrySnow morrySnow merged commit bdb8cab into apache:master Aug 27, 2025
30 checks passed
924060929 pushed a commit that referenced this pull request Sep 1, 2025
in logical plan builder,  there are bugs with between:
- for sql `a between random() and random()`, since the two unbound
`'random()` are the same, it will rewrite to `a = random()`, but the two
random() should be different after bind expression;
- for sql `random() between 0.1 and 0.5`, it will rewrite to `random()
>= 0.1 and random() <= 0.5`, later when bind expression, the two unbound
random() will generate two different bounded random() function, but the
two random() need to be the same.

so, in logical plan builder, the between shouldn't compare low bound and
upper bound, and should not expand before bind expression.

relate PR:
1) unique function:   #54414 
2) remove between: #23421
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. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants