Skip to content

Revert "[feat](storage) add read_null_map support for COUNT_NULL push down aggregate (#60996)#61439

Open
HappenLee wants to merge 1 commit intoapache:masterfrom
HappenLee:revert/count_null
Open

Revert "[feat](storage) add read_null_map support for COUNT_NULL push down aggregate (#60996)#61439
HappenLee wants to merge 1 commit intoapache:masterfrom
HappenLee:revert/count_null

Conversation

@HappenLee
Copy link
Contributor

This reverts commit 03a9b93. will do a new way to fix the performance problem

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

Copilot AI review requested due to automatic review settings March 17, 2026 12:32
@Thearas
Copy link
Contributor

Thearas commented Mar 17, 2026

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?

@HappenLee
Copy link
Contributor Author

run buildall

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reverts the previously added COUNT_NULL aggregate pushdown path (which required reading null-map pages from segments) due to performance concerns, restoring the prior pushdown behavior and aligning regression expectations.

Changes:

  • Removes COUNT_NULL from FE/BE pushdown aggregate enums and translator mappings.
  • Deletes BE read_null_map plumbing and the COUNT_NULL-specific statistics-iterator logic.
  • Updates/removes regression tests that asserted COUNT_NULL pushdown behavior (including explain expectations).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
regression-test/suites/query_p0/aggregate/count_null_push_down.groovy Removes regression suite that validated COUNT_NULL pushdown results.
regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy Updates explain assertion to expect no pushdown (pushAggOp=NONE) for count(nullable_col) cases.
regression-test/data/query_p0/aggregate/count_null_push_down.out Removes expected output corresponding to the deleted regression suite.
gensrc/thrift/PlanNodes.thrift Removes COUNT_NULL from TPushAggOp.
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalStorageLayerAggregate.java Drops COUNT_NULL from FE physical pushdown op enum.
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java Removes FE rule logic that selected COUNT_NULL; blocks pushdown for count(nullable_col) instead.
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java Removes translation from FE COUNT_NULL to Thrift TPushAggOp.
be/src/storage/segment/variant/variant_column_reader.h Removes forwarding read_null_map implementation from variant iterator.
be/src/storage/segment/column_reader.h Removes read_null_map API from ColumnIterator and related iterator overrides.
be/src/storage/segment/column_reader.cpp Deletes implementations of read_null_map for column iterators.
be/src/storage/iterator/vgeneric_iterators.h Removes unused _tablet_schema member tied to COUNT_NULL handling.
be/src/storage/iterator/vgeneric_iterators.cpp Removes COUNT_NULL initialization and null-map reading logic in VStatisticsIterator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

MIX = 3,
COUNT_ON_INDEX = 4,
COUNT_NULL = 5
COUNT_ON_INDEX = 4
Comment on lines 72 to 76
size_t size = _push_down_agg_type_opt == TPushAggOp::MINMAX
? 2
: std::min(_target_rows - _output_rows, MAX_ROW_SIZE_IN_COUNT);
if (_push_down_agg_type_opt == TPushAggOp::COUNT) {
for (auto& column : columns) {
@hello-stephen
Copy link
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.15% (1796/2269)
Line Coverage 64.48% (32286/50072)
Region Coverage 65.37% (16164/24727)
Branch Coverage 55.79% (8611/15434)

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 73.33% (11/15) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17600	4550	4286	4286
q2	q3	10638	797	528	528
q4	4676	364	254	254
q5	7579	1193	1017	1017
q6	173	170	144	144
q7	786	867	676	676
q8	9295	1506	1354	1354
q9	4853	4668	4724	4668
q10	6254	1938	1717	1717
q11	464	259	256	256
q12	712	604	475	475
q13	18030	2924	2166	2166
q14	225	242	212	212
q15	q16	733	750	674	674
q17	757	873	431	431
q18	6011	5449	5203	5203
q19	1104	976	620	620
q20	528	489	389	389
q21	4026	1874	1413	1413
q22	336	306	463	306
Total cold run time: 94780 ms
Total hot run time: 26789 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4937	4656	4618	4618
q2	q3	3887	4322	3854	3854
q4	910	1201	761	761
q5	4118	4414	4407	4407
q6	193	180	142	142
q7	1758	1667	1501	1501
q8	2502	2723	2570	2570
q9	8003	7094	7366	7094
q10	3775	4040	3638	3638
q11	509	436	418	418
q12	501	613	433	433
q13	2699	3140	2380	2380
q14	284	303	276	276
q15	q16	724	769	708	708
q17	1163	1331	1349	1331
q18	7458	6861	6709	6709
q19	940	923	912	912
q20	2065	2164	1979	1979
q21	3992	3606	3495	3495
q22	489	466	396	396
Total cold run time: 50907 ms
Total hot run time: 47622 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168433 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 52dff9491e0838a5b27f9d13e6baa0bfa6d0d327, data reload: false

query5	4343	659	513	513
query6	345	224	196	196
query7	4216	475	262	262
query8	348	264	238	238
query9	8654	2760	2766	2760
query10	527	378	328	328
query11	6937	5099	4872	4872
query12	179	126	121	121
query13	1276	448	320	320
query14	5719	3672	3484	3484
query14_1	2896	2834	2778	2778
query15	206	191	175	175
query16	984	482	456	456
query17	890	747	616	616
query18	2457	453	352	352
query19	222	220	194	194
query20	142	131	132	131
query21	224	138	116	116
query22	13292	14024	14654	14024
query23	16300	15878	15378	15378
query23_1	15618	15787	15429	15429
query24	7112	1632	1229	1229
query24_1	1240	1225	1261	1225
query25	586	495	445	445
query26	1244	268	146	146
query27	2783	488	301	301
query28	4496	1865	1863	1863
query29	896	604	517	517
query30	303	224	196	196
query31	1018	970	887	887
query32	87	76	74	74
query33	527	360	308	308
query34	913	882	514	514
query35	642	714	644	644
query36	1079	1138	989	989
query37	141	99	89	89
query38	2950	2941	2897	2897
query39	865	844	872	844
query39_1	793	812	783	783
query40	230	152	133	133
query41	63	59	58	58
query42	265	263	254	254
query43	246	248	220	220
query44	
query45	201	188	179	179
query46	879	975	602	602
query47	2111	2795	2047	2047
query48	303	317	228	228
query49	629	453	386	386
query50	687	289	210	210
query51	4063	4047	3978	3978
query52	268	262	254	254
query53	290	332	283	283
query54	315	289	276	276
query55	100	92	92	92
query56	329	325	310	310
query57	1932	1648	1789	1648
query58	290	279	278	278
query59	2788	2963	2742	2742
query60	347	347	339	339
query61	158	154	212	154
query62	641	583	539	539
query63	310	288	285	285
query64	5135	1270	994	994
query65	
query66	1469	455	346	346
query67	24397	24371	24312	24312
query68	
query69	405	321	275	275
query70	935	954	957	954
query71	357	315	314	314
query72	2784	2686	2477	2477
query73	527	538	318	318
query74	9617	9588	9443	9443
query75	2893	2781	2533	2533
query76	2280	1042	687	687
query77	370	403	322	322
query78	11043	11174	10526	10526
query79	1104	815	569	569
query80	1387	618	546	546
query81	554	259	223	223
query82	1143	151	118	118
query83	352	270	248	248
query84	304	115	90	90
query85	1030	533	449	449
query86	440	292	294	292
query87	3201	3129	3032	3032
query88	3545	2657	2638	2638
query89	433	368	352	352
query90	1923	183	179	179
query91	171	174	142	142
query92	75	77	74	74
query93	920	855	507	507
query94	645	318	307	307
query95	605	346	335	335
query96	648	509	226	226
query97	2425	2461	2381	2381
query98	232	219	216	216
query99	940	953	909	909
Total cold run time: 249600 ms
Total hot run time: 168433 ms

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.65% (19759/37529)
Line Coverage 36.21% (184443/509401)
Region Coverage 32.36% (142252/439538)
Branch Coverage 33.54% (62241/185579)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.12% (26861/36735)
Line Coverage 56.52% (286947/507687)
Region Coverage 53.61% (237816/443587)
Branch Coverage 55.44% (103156/186061)

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.

5 participants