Skip to content

[chore](fe) Remove dead code from analysis, common, nereids, planner, qe packages#61738

Merged
morrySnow merged 1 commit intoapache:masterfrom
morrySnow:clean-dead-code
Mar 26, 2026
Merged

[chore](fe) Remove dead code from analysis, common, nereids, planner, qe packages#61738
morrySnow merged 1 commit intoapache:masterfrom
morrySnow:clean-dead-code

Conversation

@morrySnow
Copy link
Copy Markdown
Contributor

Proposed changes

Remove dead code across five FE packages: analysis, common, nereids, planner, qe.

What problem does this PR solve?

Problem Summary: Accumulated dead code in FE modules increases maintenance burden and cognitive load. This PR removes:

  • 13 unused classes — never imported/referenced outside their own file
    • NotLiteralExprPredicate, BaseProcNode, MysqlUtil, CommandResult, ExprCostModel, FileDumpConsumer, ParentTypeIdMapping, DecimalWiderPrecision, BucketSpecifyInstances, DefaultSpecifyInstances, CustomAssignmentJob, ScanRange (nereids), ExportSink
  • 21 unused private methods — declared but never called
  • 55 unused public methods — never called from any other file
  • 19 unused fields — declared but never read (including write-only fields like AlterTableOp.needTableStable and DistributionDesc.type)
  • Associated orphaned imports cleaned across all modified files

92 files changed, 1,781 lines deleted.

Safety guarantees

All persistence-related code was excluded from removal:

  • Classes with @SerializedName, @JsonProperty, implements Writable/GsonPostProcessable
  • Fields/methods involved in readFields, writeObject, readObject, Serializable
  • EditLog read/write paths

Known special cases intentionally preserved:

  • PatternDescribableProcessPoint.java — annotation processor trigger referenced in pom.xml
  • ParserContext.java — used by fe_plugins (spark/trino converters)
  • SessionVariable getters — accessed via reflection through @VarAttr

Review verification

Reviewed by 4 independent AI models (Claude Opus 4.6, GPT-5.4, GPT-5.3-Codex, Gemini 3 Pro):

  • All confirmed no persistence, reflection, or hierarchy issues
  • One valid finding (zombie CommandResult class after getter removal) was fixed

Release note

None

Check List (For Author)

  • Test: No need to test — pure dead code removal, FE clean build verified
  • Behavior changed: No
  • Does this need documentation: No

… qe packages

### What problem does this PR solve?

Issue Number: close #xxx

Problem Summary: Clean up dead code across five FE packages. Removed:
- 12 unused classes (never imported/referenced outside their own file)
- 21 unused private methods (declared but never called)
- 55 unused public methods (never called from any other file)
- 19 unused fields (declared but never read, including write-only fields)
- Associated orphaned imports

All persistence-related code (Gson, Writable, SerializedName, EditLog, etc.)
was excluded from removal. FE clean build verified.

### Release note

None

### Check List (For Author)

- Test: No need to test - pure dead code removal, FE clean build verified
- Behavior changed: No
- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Mar 26, 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?

@morrySnow
Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot
Copy link
Copy Markdown

TPC-H: Total hot run time: 26617 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit e07746f17fcb1969229832eb9ecd2e89b463412c, 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	17597	4479	4319	4319
q2	q3	10637	771	538	538
q4	4684	363	243	243
q5	7578	1217	1016	1016
q6	174	175	146	146
q7	806	842	685	685
q8	9313	1483	1373	1373
q9	4947	4717	4703	4703
q10	6301	1921	1650	1650
q11	450	262	238	238
q12	757	590	462	462
q13	18033	2734	1937	1937
q14	221	229	225	225
q15	q16	728	721	671	671
q17	727	855	423	423
q18	5968	5283	5269	5269
q19	1174	962	609	609
q20	542	487	376	376
q21	4598	1819	1431	1431
q22	348	303	429	303
Total cold run time: 95583 ms
Total hot run time: 26617 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	4866	4630	4576	4576
q2	q3	3851	4336	3828	3828
q4	899	1236	808	808
q5	4072	4405	4317	4317
q6	199	180	140	140
q7	1769	1693	1530	1530
q8	2513	2736	2584	2584
q9	7666	7514	7595	7514
q10	3759	3983	3613	3613
q11	508	435	417	417
q12	498	613	438	438
q13	2628	2858	2005	2005
q14	287	297	281	281
q15	q16	711	788	731	731
q17	1197	1307	1321	1307
q18	7311	6830	6597	6597
q19	969	938	984	938
q20	2083	2250	2084	2084
q21	3978	3568	3467	3467
q22	463	422	374	374
Total cold run time: 50227 ms
Total hot run time: 47549 ms

@doris-robot
Copy link
Copy Markdown

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

query5	4339	640	505	505
query6	330	224	202	202
query7	4217	468	262	262
query8	339	236	231	231
query9	8714	2702	2676	2676
query10	532	370	342	342
query11	7041	5088	4883	4883
query12	175	130	132	130
query13	1279	464	347	347
query14	5774	3664	3451	3451
query14_1	2876	2806	2831	2806
query15	208	196	181	181
query16	1048	462	438	438
query17	1118	709	603	603
query18	2445	445	331	331
query19	220	204	180	180
query20	134	126	124	124
query21	214	141	117	117
query22	13309	14078	14696	14078
query23	16630	16279	16131	16131
query23_1	15864	15639	15631	15631
query24	7223	1599	1210	1210
query24_1	1218	1213	1212	1212
query25	556	467	407	407
query26	1222	262	149	149
query27	2788	477	293	293
query28	4518	1860	1827	1827
query29	840	561	483	483
query30	292	223	192	192
query31	1034	928	879	879
query32	76	70	69	69
query33	512	333	295	295
query34	882	869	513	513
query35	632	686	599	599
query36	1075	1108	997	997
query37	135	131	82	82
query38	2950	2982	2796	2796
query39	859	834	811	811
query39_1	810	800	795	795
query40	232	152	136	136
query41	62	59	60	59
query42	260	254	262	254
query43	231	252	227	227
query44	
query45	200	189	186	186
query46	875	972	609	609
query47	2112	2148	2089	2089
query48	307	329	252	252
query49	655	455	391	391
query50	679	279	216	216
query51	4085	4055	4033	4033
query52	259	265	253	253
query53	290	337	279	279
query54	306	273	266	266
query55	92	98	82	82
query56	325	326	312	312
query57	1913	1617	1763	1617
query58	293	273	275	273
query59	2787	2924	2727	2727
query60	336	338	328	328
query61	165	159	161	159
query62	653	587	547	547
query63	310	283	283	283
query64	4998	1303	1118	1118
query65	
query66	1487	475	367	367
query67	24264	24291	24152	24152
query68	
query69	398	319	300	300
query70	983	951	900	900
query71	351	319	309	309
query72	3141	2925	2705	2705
query73	535	548	314	314
query74	9647	9542	9414	9414
query75	2868	2758	2466	2466
query76	2284	1050	682	682
query77	358	386	311	311
query78	10936	11249	10518	10518
query79	1096	763	579	579
query80	728	648	545	545
query81	501	266	224	224
query82	1343	150	120	120
query83	367	268	238	238
query84	250	117	98	98
query85	861	505	472	472
query86	360	331	261	261
query87	3216	3105	2993	2993
query88	3520	2642	2642	2642
query89	424	370	354	354
query90	1951	179	175	175
query91	176	166	156	156
query92	80	79	72	72
query93	899	864	486	486
query94	453	318	303	303
query95	585	396	323	323
query96	645	516	236	236
query97	2496	2484	2435	2435
query98	234	222	228	222
query99	1029	991	931	931
Total cold run time: 249665 ms
Total hot run time: 169083 ms

@morrySnow
Copy link
Copy Markdown
Contributor Author

/review

@github-actions
Copy link
Copy Markdown
Contributor

Code Review: Dead Code Removal

Reviewed all 92 changed files (1,781 lines deleted, 1 line added). This is a pure dead code removal PR with no behavioral changes.

Critical Checkpoint Conclusions (Part 1.3)

  • Goal: Remove dead code from FE analysis, common, nereids, planner, and qe packages. Achieved — all 13 deleted classes and all deleted methods/fields verified as having zero remaining references in the codebase.
  • Minimal and focused: Yes — pure deletions, no logic changes.
  • Concurrency: Not applicable — no concurrency-related code added or modified.
  • Lifecycle management: Not applicable.
  • Configuration items: None added.
  • Incompatible changes / storage formats: None. Verified no @SerializedName, @JsonProperty, Writable, GsonPostProcessable, or EditLog-related code is affected by the removals.
  • Parallel code paths: Not applicable — removals only.
  • Special conditional checks: Not applicable.
  • Test coverage: No tests needed — dead code removal cannot change behavior.
  • Observability: Not applicable.
  • Transaction/persistence: Verified safe. The needTableStable field in AlterTableOp was write-only (never read). The DistributionDesc.type field was write-only. No persistence paths affected.
  • Data writes: Not applicable.
  • FE-BE variables: Not applicable.
  • Performance: No concerns — removing dead code marginally reduces class loading and compilation time.
  • Other issues: One observation (not a bug): BucketSpecifyInstances and DefaultSpecifyInstances were the only concrete subclasses of the abstract NereidsSpecifyInstances. After removal, NereidsSpecifyInstances has no concrete implementations. This could indicate additional dead code to clean up in a follow-up, but is not a problem for this PR.

Verification Summary

Category Count Status
Deleted classes 13 All verified dead (zero references)
Deleted public methods 55 All verified dead (zero callers)
Deleted private methods 21 All verified dead (zero callers)
Deleted fields 10 All verified dead (write-only or unreferenced)
Serialization safety All fields No persistence/serialization impact

Result: No issues found. Clean dead code removal.

@github-actions
Copy link
Copy Markdown
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 Mar 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@morrySnow morrySnow merged commit 9d31993 into apache:master Mar 26, 2026
29 of 31 checks passed
@morrySnow morrySnow deleted the clean-dead-code branch March 26, 2026 07:05
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