Skip to content

Conversation

@seawinde
Copy link
Contributor

Fix not in aggregate's output err after eliminate by uniform when group sets exist

if query as following, would cause ERROR 1105 (HY000): errCode = 2, detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's output

the pr fix this

SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #43391

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

@Thearas
Copy link
Contributor

Thearas commented Oct 14, 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?

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 190484 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 80639d5e1759749e2388faf9099c6c36887b05ea, data reload: false

query1	1066	414	406	406
query2	6569	1702	1680	1680
query3	6746	224	223	223
query4	27139	23849	23074	23074
query5	5085	660	488	488
query6	354	252	228	228
query7	4663	491	293	293
query8	322	261	243	243
query9	8733	2568	2570	2568
query10	529	334	274	274
query11	15324	15174	15153	15153
query12	188	118	113	113
query13	1674	547	428	428
query14	11666	9273	9241	9241
query15	207	196	178	178
query16	7683	717	508	508
query17	1389	790	637	637
query18	2917	445	338	338
query19	209	218	184	184
query20	143	139	127	127
query21	228	137	122	122
query22	4636	4660	4667	4660
query23	35066	33810	33959	33810
query24	8435	2522	2486	2486
query25	691	536	477	477
query26	1302	284	164	164
query27	2775	550	367	367
query28	4729	2228	2198	2198
query29	786	651	524	524
query30	309	250	297	250
query31	934	881	789	789
query32	100	79	76	76
query33	651	480	397	397
query34	1576	883	540	540
query35	841	885	803	803
query36	978	1054	934	934
query37	136	120	90	90
query38	3556	3544	3482	3482
query39	1518	1401	1445	1401
query40	222	134	121	121
query41	68	64	66	64
query42	126	120	113	113
query43	485	508	476	476
query44	1340	875	828	828
query45	201	185	175	175
query46	881	991	637	637
query47	1775	1841	1724	1724
query48	406	444	320	320
query49	767	516	436	436
query50	634	687	412	412
query51	3906	4005	3858	3858
query52	114	109	100	100
query53	241	260	195	195
query54	592	588	527	527
query55	85	86	84	84
query56	306	320	310	310
query57	1187	1211	1174	1174
query58	285	285	278	278
query59	2581	2648	2543	2543
query60	341	341	325	325
query61	159	168	159	159
query62	809	740	713	713
query63	226	193	190	190
query64	4411	1163	885	885
query65	4072	3964	3966	3964
query66	1096	446	353	353
query67	15667	15284	15071	15071
query68	8049	955	592	592
query69	495	333	295	295
query70	1406	1319	1276	1276
query71	510	333	322	322
query72	5775	4993	4986	4986
query73	658	590	360	360
query74	8962	9143	8648	8648
query75	4010	3373	2837	2837
query76	3759	1163	737	737
query77	832	407	337	337
query78	9605	9743	8889	8889
query79	2028	802	613	613
query80	623	573	564	564
query81	494	270	229	229
query82	463	158	137	137
query83	277	270	247	247
query84	259	113	87	87
query85	905	469	427	427
query86	348	313	316	313
query87	3769	3784	3715	3715
query88	3590	2228	2200	2200
query89	409	324	300	300
query90	2057	214	213	213
query91	165	165	137	137
query92	80	72	64	64
query93	1658	974	638	638
query94	667	440	334	334
query95	406	322	318	318
query96	484	574	277	277
query97	2964	3050	2894	2894
query98	259	218	214	214
query99	1370	1435	1295	1295
Total cold run time: 282172 ms
Total hot run time: 190484 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.06	0.06
query3	0.25	0.09	0.08
query4	1.62	0.12	0.12
query5	0.28	0.26	0.25
query6	1.20	0.66	0.64
query7	0.03	0.04	0.03
query8	0.05	0.04	0.05
query9	0.63	0.53	0.51
query10	0.58	0.61	0.58
query11	0.17	0.11	0.11
query12	0.16	0.12	0.12
query13	0.63	0.63	0.61
query14	1.04	1.04	1.01
query15	0.89	0.88	0.88
query16	0.40	0.40	0.39
query17	1.08	1.06	1.05
query18	0.22	0.20	0.20
query19	2.00	1.88	1.79
query20	0.02	0.01	0.02
query21	15.41	0.93	0.58
query22	0.76	1.15	0.98
query23	14.74	1.40	0.64
query24	7.74	0.92	0.49
query25	0.50	0.33	0.06
query26	0.50	0.15	0.13
query27	0.07	0.06	0.05
query28	9.23	1.34	0.93
query29	12.54	4.01	3.32
query30	0.29	0.14	0.13
query31	2.83	0.60	0.41
query32	3.26	0.55	0.49
query33	3.20	3.16	3.18
query34	16.18	5.52	4.86
query35	4.95	4.96	4.93
query36	0.70	0.51	0.50
query37	0.11	0.08	0.07
query38	0.07	0.05	0.04
query39	0.04	0.03	0.03
query40	0.18	0.15	0.15
query41	0.09	0.03	0.04
query42	0.04	0.04	0.03
query43	0.05	0.03	0.03
Total cold run time: 104.87 s
Total hot run time: 30.57 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 94.29% (33/35) 🎉
Increment coverage report
Complete coverage report

@seawinde seawinde force-pushed the fix_group_sets_fail_when_agg_eliminate_by_uniform branch from 80639d5 to 28c4a89 Compare October 16, 2025 08:51
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 189982 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 28c4a89ee7709ed7c5d22da87d067c3365c6f135, data reload: false

query1	1081	447	415	415
query2	6576	1690	1697	1690
query3	6759	224	227	224
query4	26987	23724	23156	23156
query5	5138	629	499	499
query6	343	236	229	229
query7	4676	491	307	307
query8	303	256	250	250
query9	8715	2556	2539	2539
query10	545	346	291	291
query11	15577	15027	15309	15027
query12	195	120	113	113
query13	1683	558	434	434
query14	11405	9183	9419	9183
query15	210	183	179	179
query16	7665	666	541	541
query17	1266	735	616	616
query18	2091	497	340	340
query19	243	244	177	177
query20	146	134	130	130
query21	228	134	138	134
query22	4726	4986	4706	4706
query23	34686	33828	34014	33828
query24	8490	2500	2524	2500
query25	641	536	478	478
query26	1282	281	176	176
query27	2891	546	364	364
query28	4415	2177	2200	2177
query29	872	627	514	514
query30	353	240	209	209
query31	948	882	815	815
query32	88	85	74	74
query33	583	386	350	350
query34	832	882	549	549
query35	861	884	839	839
query36	996	1011	917	917
query37	126	110	93	93
query38	3596	3640	3502	3502
query39	1498	1417	1411	1411
query40	231	134	122	122
query41	81	61	61	61
query42	122	113	109	109
query43	487	493	495	493
query44	1334	827	811	811
query45	182	183	167	167
query46	843	999	627	627
query47	1766	1814	1735	1735
query48	393	423	321	321
query49	749	478	411	411
query50	637	685	405	405
query51	3937	3930	3827	3827
query52	111	104	103	103
query53	237	276	201	201
query54	603	594	525	525
query55	90	84	88	84
query56	311	337	304	304
query57	1177	1201	1130	1130
query58	327	275	263	263
query59	2515	2625	2599	2599
query60	339	341	319	319
query61	166	153	151	151
query62	784	728	668	668
query63	235	189	194	189
query64	4392	1158	823	823
query65	4057	3960	3964	3960
query66	1061	431	334	334
query67	15509	15021	15015	15015
query68	7793	924	591	591
query69	483	334	295	295
query70	1329	1280	1264	1264
query71	474	331	322	322
query72	5909	4822	4734	4734
query73	615	564	362	362
query74	8882	9047	8690	8690
query75	3857	3326	2822	2822
query76	3577	1170	756	756
query77	808	408	429	408
query78	9497	9807	8918	8918
query79	2010	846	601	601
query80	644	562	494	494
query81	497	260	224	224
query82	426	161	131	131
query83	275	270	248	248
query84	255	126	91	91
query85	873	470	494	470
query86	338	317	278	278
query87	3715	3794	3620	3620
query88	3420	2278	2267	2267
query89	407	327	305	305
query90	2066	220	223	220
query91	159	168	130	130
query92	83	72	64	64
query93	1173	968	647	647
query94	690	446	333	333
query95	389	324	299	299
query96	491	595	284	284
query97	2960	2969	2881	2881
query98	240	209	215	209
query99	1462	1401	1291	1291
Total cold run time: 278189 ms
Total hot run time: 189982 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.05	0.06
query3	0.25	0.08	0.08
query4	1.61	0.12	0.12
query5	0.28	0.26	0.24
query6	1.16	0.65	0.64
query7	0.03	0.02	0.02
query8	0.06	0.05	0.05
query9	0.63	0.52	0.51
query10	0.59	0.58	0.58
query11	0.16	0.11	0.11
query12	0.15	0.12	0.12
query13	0.64	0.61	0.62
query14	1.03	1.04	1.03
query15	0.89	0.86	0.85
query16	0.42	0.39	0.39
query17	1.05	1.07	1.08
query18	0.21	0.19	0.20
query19	1.96	1.84	1.85
query20	0.02	0.01	0.02
query21	15.42	0.96	0.58
query22	0.76	1.12	0.63
query23	15.06	1.39	0.64
query24	7.54	0.97	0.70
query25	0.40	0.21	0.15
query26	0.62	0.15	0.12
query27	0.09	0.05	0.06
query28	9.34	1.36	0.92
query29	12.56	3.95	3.24
query30	0.28	0.14	0.12
query31	2.83	0.61	0.39
query32	3.24	0.54	0.47
query33	3.05	3.15	3.06
query34	16.29	5.42	4.85
query35	4.98	4.92	4.97
query36	0.67	0.52	0.50
query37	0.11	0.08	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.16	0.13
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 105 s
Total hot run time: 30.27 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 94.29% (33/35) 🎉
Increment coverage report
Complete coverage report

LogicalRepeat<?> sourceRepeat = (LogicalRepeat<?>) exprIdReplacer.rewriteExpr(
aggregate.getSourceRepeat().get(), replaceMap);
aggregate = aggregate.withSourceRepeat(sourceRepeat);
}
Copy link
Contributor

@feiniaofeiafei feiniaofeiafei Oct 22, 2025

Choose a reason for hiding this comment

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

maybe this will lead to agg source repeat be rewritten twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not same instance, so doesn't repeat be rewritten twice.

}
List<Expression> newChildren = new ArrayList<>();
List<Expression> oldChildren = originExpression.get().children();
for (Expression child : oldChildren) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. directly traverse the originExpression instead of using for loop traversing originExpression children maybe better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have fixed

newChildren.add(child.accept(new DefaultExpressionRewriter<Void>() {
@Override
public Expression visitSlotReference(SlotReference slot, Void context) {
ExprId newId = replaceMap.get(slot.getExprId());
Copy link
Contributor

Choose a reason for hiding this comment

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

these code is repeated, use a function to avoid repeated code may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have fixed

}).toRule(ExpressionRuleType.EXPR_ID_REWRITE_REPLACE)
}).toRule(ExpressionRuleType.EXPR_ID_REWRITE_REPLACE),
matchesType(VirtualSlotReference.class).thenApply(ctx -> {
VirtualSlotReference virtualSlot = ctx.expr;
Copy link
Contributor

@feiniaofeiafei feiniaofeiafei Oct 22, 2025

Choose a reason for hiding this comment

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

1.there is an attribute "realExpressions" in VirtualSlotReference, should we replace "realExpressions" too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

realExpressions is derived from original Expressions, we have replaced original Expressions rightly, realExpressions is right auto

@seawinde seawinde force-pushed the fix_group_sets_fail_when_agg_eliminate_by_uniform branch from 28c4a89 to 7e9d158 Compare November 4, 2025 03:43
@seawinde
Copy link
Contributor Author

seawinde commented Nov 4, 2025

run buildall

@doris-robot
Copy link

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

query1	1056	394	393	393
query2	6589	1669	1713	1669
query3	6748	232	219	219
query4	26462	23398	23426	23398
query5	4976	632	463	463
query6	354	247	227	227
query7	4648	509	300	300
query8	322	266	245	245
query9	8760	2574	2576	2574
query10	543	346	292	292
query11	15943	15535	15574	15535
query12	213	146	129	129
query13	1710	599	477	477
query14	12093	9634	9526	9526
query15	239	196	188	188
query16	8017	753	590	590
query17	2158	863	684	684
query18	2076	457	362	362
query19	229	211	191	191
query20	146	132	118	118
query21	213	143	114	114
query22	4869	4544	4693	4544
query23	35149	33935	33899	33899
query24	8353	2357	2416	2357
query25	557	495	443	443
query26	1233	272	154	154
query27	2711	489	349	349
query28	4296	2208	2161	2161
query29	771	611	477	477
query30	300	221	194	194
query31	889	815	721	721
query32	83	68	66	66
query33	591	367	308	308
query34	791	853	520	520
query35	816	868	742	742
query36	941	994	896	896
query37	135	106	83	83
query38	3472	3520	3485	3485
query39	1452	1407	1438	1407
query40	215	124	109	109
query41	58	56	55	55
query42	116	110	111	110
query43	475	482	468	468
query44	1203	745	735	735
query45	184	182	172	172
query46	888	1002	626	626
query47	1760	1804	1695	1695
query48	388	421	320	320
query49	748	502	418	418
query50	630	687	402	402
query51	3915	3939	3898	3898
query52	115	107	100	100
query53	230	268	196	196
query54	294	287	279	279
query55	88	86	83	83
query56	329	306	300	300
query57	1157	1203	1109	1109
query58	289	269	278	269
query59	2613	2697	2547	2547
query60	343	336	317	317
query61	159	159	160	159
query62	802	708	672	672
query63	229	189	194	189
query64	4409	1168	829	829
query65	4063	3948	3952	3948
query66	1085	439	332	332
query67	15430	15426	15165	15165
query68	8095	924	606	606
query69	479	332	293	293
query70	1354	1294	1202	1202
query71	488	347	331	331
query72	5827	4958	4883	4883
query73	677	573	358	358
query74	8868	8863	8912	8863
query75	3781	3343	2877	2877
query76	3591	1148	746	746
query77	794	412	335	335
query78	9597	9675	9038	9038
query79	2507	809	601	601
query80	684	564	509	509
query81	489	260	227	227
query82	460	159	131	131
query83	302	261	248	248
query84	302	117	90	90
query85	909	481	444	444
query86	335	299	285	285
query87	3781	3687	3598	3598
query88	2905	2241	2226	2226
query89	401	318	293	293
query90	1988	218	221	218
query91	168	168	138	138
query92	81	70	62	62
query93	1233	965	642	642
query94	700	462	347	347
query95	404	328	301	301
query96	486	569	278	278
query97	2958	2968	2872	2872
query98	228	209	209	209
query99	1441	1427	1287	1287
Total cold run time: 279432 ms
Total hot run time: 190540 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.04	0.04
query3	0.26	0.08	0.08
query4	1.60	0.11	0.12
query5	0.28	0.27	0.25
query6	1.19	0.63	0.65
query7	0.03	0.02	0.03
query8	0.06	0.04	0.05
query9	0.60	0.52	0.51
query10	0.58	0.59	0.58
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.61	0.60	0.59
query14	0.99	0.99	1.02
query15	0.85	0.83	0.84
query16	0.39	0.40	0.42
query17	1.02	1.02	1.01
query18	0.21	0.20	0.19
query19	1.91	1.84	1.84
query20	0.02	0.01	0.02
query21	15.42	0.19	0.13
query22	4.98	0.06	0.04
query23	15.69	0.26	0.10
query24	3.11	0.51	0.49
query25	0.07	0.07	0.06
query26	0.14	0.13	0.13
query27	0.06	0.05	0.04
query28	4.26	1.13	0.94
query29	12.59	3.89	3.19
query30	0.28	0.13	0.11
query31	2.81	0.60	0.39
query32	3.23	0.54	0.46
query33	3.14	3.08	3.06
query34	15.84	5.14	4.58
query35	4.53	4.59	4.53
query36	0.69	0.50	0.50
query37	0.10	0.06	0.06
query38	0.06	0.04	0.04
query39	0.03	0.04	0.03
query40	0.17	0.14	0.14
query41	0.09	0.03	0.04
query42	0.03	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 98.39 s
Total hot run time: 27.49 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (35/35) 🎉
Increment coverage report
Complete coverage report

@seawinde
Copy link
Contributor Author

seawinde commented Nov 5, 2025

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 190091 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 663e71862afb3dd700610cab699f22ca1da13338, data reload: false

query1	1060	397	390	390
query2	6575	1731	1688	1688
query3	6751	231	225	225
query4	26069	23645	23421	23421
query5	4925	633	463	463
query6	347	255	235	235
query7	4653	506	302	302
query8	307	277	260	260
query9	8712	2572	2601	2572
query10	529	366	297	297
query11	15664	15130	15815	15130
query12	196	126	131	126
query13	1747	596	501	501
query14	11932	9618	9677	9618
query15	262	215	180	180
query16	7911	717	536	536
query17	2124	852	699	699
query18	2086	455	380	380
query19	286	226	191	191
query20	138	131	130	130
query21	254	153	123	123
query22	4648	4530	4462	4462
query23	34890	33800	33956	33800
query24	8253	2382	2386	2382
query25	545	503	427	427
query26	1226	263	156	156
query27	2687	498	364	364
query28	4240	2185	2165	2165
query29	768	616	479	479
query30	300	221	199	199
query31	900	790	743	743
query32	72	70	62	62
query33	596	365	325	325
query34	815	839	530	530
query35	840	823	735	735
query36	942	982	907	907
query37	119	105	89	89
query38	3469	3619	3505	3505
query39	1475	1416	1400	1400
query40	223	124	117	117
query41	61	57	56	56
query42	126	111	113	111
query43	472	482	450	450
query44	1197	762	757	757
query45	186	179	189	179
query46	870	988	635	635
query47	1768	1791	1689	1689
query48	396	413	317	317
query49	772	501	415	415
query50	635	683	413	413
query51	3878	3827	3892	3827
query52	109	110	107	107
query53	251	265	197	197
query54	320	292	276	276
query55	83	86	83	83
query56	319	318	283	283
query57	1166	1173	1108	1108
query58	280	271	274	271
query59	2590	2620	2530	2530
query60	344	350	326	326
query61	159	158	159	158
query62	782	714	661	661
query63	228	197	193	193
query64	4394	1147	838	838
query65	4042	3955	3963	3955
query66	1109	438	331	331
query67	15458	15185	15113	15113
query68	8786	919	599	599
query69	471	315	291	291
query70	1391	1312	1291	1291
query71	506	342	306	306
query72	6008	4901	4882	4882
query73	725	577	358	358
query74	8893	9120	8940	8940
query75	4011	3339	2822	2822
query76	3807	1147	733	733
query77	817	417	316	316
query78	9492	9749	8918	8918
query79	1920	832	618	618
query80	673	549	483	483
query81	484	257	221	221
query82	468	163	128	128
query83	268	264	246	246
query84	258	110	93	93
query85	895	467	422	422
query86	339	316	286	286
query87	3718	3701	3652	3652
query88	3240	2249	2225	2225
query89	389	320	284	284
query90	2072	206	214	206
query91	163	164	133	133
query92	85	68	62	62
query93	1175	961	636	636
query94	692	460	339	339
query95	413	317	314	314
query96	485	563	282	282
query97	2946	2947	2884	2884
query98	238	217	208	208
query99	1425	1390	1320	1320
Total cold run time: 278784 ms
Total hot run time: 190091 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.04
query3	0.26	0.08	0.08
query4	1.62	0.11	0.11
query5	0.28	0.26	0.25
query6	1.17	0.64	0.64
query7	0.03	0.02	0.03
query8	0.05	0.05	0.04
query9	0.60	0.52	0.51
query10	0.58	0.58	0.57
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.62	0.61	0.61
query14	1.01	1.00	0.99
query15	0.86	0.83	0.84
query16	0.39	0.39	0.42
query17	0.98	1.02	1.03
query18	0.22	0.20	0.20
query19	1.97	1.83	1.75
query20	0.02	0.01	0.02
query21	15.44	0.18	0.13
query22	5.09	0.08	0.04
query23	15.66	0.27	0.10
query24	2.13	0.50	0.69
query25	0.08	0.07	0.05
query26	0.14	0.13	0.14
query27	0.07	0.05	0.05
query28	4.18	1.14	0.93
query29	12.55	3.95	3.26
query30	0.28	0.14	0.13
query31	2.85	0.61	0.38
query32	3.24	0.55	0.46
query33	3.06	3.10	3.03
query34	15.85	5.19	4.56
query35	4.61	4.61	4.61
query36	0.70	0.50	0.50
query37	0.10	0.06	0.06
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.16	0.14
query41	0.09	0.03	0.03
query42	0.04	0.04	0.03
query43	0.04	0.04	0.04
Total cold run time: 97.6 s
Total hot run time: 27.57 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 57.14% (20/35) 🎉
Increment coverage report
Complete coverage report

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

PR approved by anyone and no changes requested.

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

github-actions bot commented Nov 5, 2025

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

@dataroaring dataroaring merged commit a5e4e1c into apache:master Nov 6, 2025
26 of 28 checks passed
@dataroaring dataroaring added the usercase Important user case type label label Nov 6, 2025
github-actions bot pushed a commit that referenced this pull request Nov 6, 2025
…niform when group sets exist (#56942)

Fix not in aggregate's output err after eliminate by uniform when group
sets exist

if query as following, would cause `ERROR 1105 (HY000): errCode = 2,
detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's
output`

the pr fix this

```sql
SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );
```

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #43391 

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
yiguolei pushed a commit that referenced this pull request Nov 8, 2025
…niform when group sets exist (#56942)

Fix not in aggregate's output err after eliminate by uniform when group
sets exist

if query as following, would cause `ERROR 1105 (HY000): errCode = 2,
detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's
output`

the pr fix this

```sql
SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );
```

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #43391 

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
seawinde added a commit to seawinde/doris that referenced this pull request Nov 10, 2025
…niform when group sets exist (apache#56942)

Fix not in aggregate's output err after eliminate by uniform when group
sets exist

if query as following, would cause `ERROR 1105 (HY000): errCode = 2,
detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's
output`

the pr fix this

```sql
SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );
```

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: apache#43391 

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
yiguolei pushed a commit that referenced this pull request Nov 11, 2025
…iminate by uniform when group sets exist #56942 (#57869)

picked from #56942
seawinde added a commit to seawinde/doris that referenced this pull request Nov 11, 2025
…niform when group sets exist (apache#56942)

Fix not in aggregate's output err after eliminate by uniform when group
sets exist

if query as following, would cause `ERROR 1105 (HY000): errCode = 2,
detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's
output`

the pr fix this

```sql
SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );
```

Issue Number: close #xxx

Related PR: apache#43391

Problem Summary:

None

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
morrySnow pushed a commit that referenced this pull request Nov 12, 2025
…iminate by uniform when group sets exist #56942 (#57885)

picked from #56942
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Nov 18, 2025
…niform when group sets exist (apache#56942)

Fix not in aggregate's output err after eliminate by uniform when group
sets exist

if query as following, would cause `ERROR 1105 (HY000): errCode = 2,
detailMessage = GROUPING_PREFIX_event_name_group not in aggregate's
output`

the pr fix this

```sql
SELECT
  CASE WHEN GROUPING(event_date) = 1 THEN '(TOTAL)' ELSE CAST(event_date AS VARCHAR) END AS event_date,
  user_id,
  MAX(conversion_level) AS conversion_level,
  CASE WHEN GROUPING(event_name_group) = 1 THEN '(TOTAL)' ELSE event_name_group END AS event_name_group
FROM
  (
    SELECT
      src.event_date,
      src.user_id,
      WINDOW_FUNNEL(
        3600 * 24 * 1,
        'default',
        src.event_time,
        src.event_name = 'shop_buy',
        src.event_name = 'shop_buy'
      ) AS conversion_level,
      src.event_name_group
    FROM
      (
        SELECT
          CAST(etb.`@dt` AS DATE) AS event_date,
          etb.`@event_name` AS event_name,
          etb.`@event_time` AS event_time,
          etb.`@event_name` AS event_name_group,
          etb.`@user_id` AS user_id
        FROM
          `test_event` AS etb
        WHERE
          etb.`@dt` between '2025-09-03 02:00:00' AND '2025-09-10 01:59:59'
          AND etb.`@event_name` = 'shop_buy'
          AND etb.`@user_id` IS NOT NULL
          AND etb.`@user_id` > '0'
      ) AS src
    GROUP BY
      src.event_date,
      src.user_id,
      src.event_name_group
  ) AS fwt
GROUP BY
  GROUPING SETS (
    (user_id),
    (user_id, event_date),
    (user_id, event_name_group),
    (user_id, event_date, event_name_group)
  );
```

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: apache#43391 

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Dec 26, 2025
yiguolei pushed a commit to yiguolei/incubator-doris that referenced this pull request Dec 30, 2025
…niform when group sets exist (apache#56942) (apache#5631)

pr: apache#56942
commitId:
apache@961cef6

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
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.1.3-merged dev/4.0.2-merged reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants