Skip to content

[refactor](be) Use column check helper for type casts#63946

Open
Mryange wants to merge 1 commit into
apache:masterfrom
Mryange:use-check-and-get-column-not-typeidcast
Open

[refactor](be) Use column check helper for type casts#63946
Mryange wants to merge 1 commit into
apache:masterfrom
Mryange:use-check-and-get-column-not-typeidcast

Conversation

@Mryange
Copy link
Copy Markdown
Contributor

@Mryange Mryange commented Jun 1, 2026

What problem does this PR solve?

Problem Summary: Replace direct typeid_cast usage for Doris column type checks with the column-specific check_and_get_column helper. This keeps column downcast checks consistent across core column code, expression evaluation, storage segment code, and related table reader tests without changing behavior.

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

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Replace direct typeid_cast usage for Doris column type checks with the column-specific check_and_get_column helper. This keeps column downcast checks consistent across core column code, expression evaluation, storage segment code, and related table reader tests without changing behavior.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - Built BE with sh build.sh --be -j48
- Behavior changed: No
- Does this need documentation: No
@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jun 1, 2026

/review

@hello-stephen
Copy link
Copy Markdown
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?

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review Summary

No blocking issues found. The changed call sites replace typeid_cast with check_and_get_column, whose current implementation delegates to the same typeid_cast overloads, so the reviewed paths preserve the previous null-on-mismatch behavior and const/mutable pointer semantics.

Critical checkpoint conclusions:

  • Goal/test: The PR goal is a focused BE refactor for column type checks. The code accomplishes that goal. The PR body reports a BE build with sh build.sh --be -j48; I did not rerun the full build in this review runner.
  • Scope/focus: The code change is small and focused in the actual GitHub diff.
  • Concurrency/lifecycle: No new shared state, locking, threads, or lifecycle ownership changes were introduced.
  • Configuration/compatibility: No config items, storage formats, RPC/thrift interfaces, or incompatible serialized formats changed.
  • Parallel paths: The modified call sites are consistent with existing check_and_get_column usage in column helpers.
  • Error handling: Existing failure behavior is preserved; check_array_offsets_column still throws on mismatch.
  • Tests: No new tests are needed for this mechanical refactor; touched tests were updated consistently.
  • Observability/performance: No new observability need. Performance should be equivalent because the helper inlines to typeid_cast.
  • Data correctness/MoW/transaction: No data visibility, delete bitmap, transaction, or persistence behavior changed.

User focus: No additional user-provided review focus was specified.

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jun 1, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 84.09% (37/44) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 54.09% (21055/38925)
Line Coverage 37.61% (199505/530435)
Region Coverage 33.90% (156344/461254)
Branch Coverage 34.86% (67957/194965)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 88.64% (39/44) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 72.03% (27454/38114)
Line Coverage 55.38% (292986/529058)
Region Coverage 52.35% (243800/465681)
Branch Coverage 53.66% (105012/195715)

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 28850 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b5962c45f222511deefcfb9c5b1540c8ce919ade, 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	17620	4049	3973	3973
q2	q3	10770	1463	868	868
q4	4726	474	349	349
q5	7934	889	592	592
q6	233	175	137	137
q7	835	869	622	622
q8	10505	1619	1597	1597
q9	6862	4558	4528	4528
q10	6760	1840	1520	1520
q11	443	278	261	261
q12	639	422	286	286
q13	18131	3383	2742	2742
q14	269	255	233	233
q15	q16	826	806	705	705
q17	987	904	1017	904
q18	6784	5888	5520	5520
q19	1180	1282	1034	1034
q20	505	404	261	261
q21	5621	2538	2418	2418
q22	436	353	300	300
Total cold run time: 102066 ms
Total hot run time: 28850 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	4333	4289	4243	4243
q2	q3	4510	4912	4322	4322
q4	2083	2177	1394	1394
q5	4440	4342	4336	4336
q6	230	176	128	128
q7	1752	2113	1622	1622
q8	2577	2214	2159	2159
q9	7969	7968	8079	7968
q10	4822	4765	4325	4325
q11	573	438	427	427
q12	735	759	545	545
q13	3483	3619	3021	3021
q14	315	296	277	277
q15	q16	756	749	651	651
q17	1337	1310	1334	1310
q18	7901	7369	7097	7097
q19	1114	1137	1100	1100
q20	2240	2226	1951	1951
q21	5284	4564	4471	4471
q22	517	463	421	421
Total cold run time: 56971 ms
Total hot run time: 51768 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4341	656	520	520
query6	347	224	201	201
query7	4244	573	311	311
query8	327	236	227	227
query9	8772	4053	4030	4030
query10	455	339	298	298
query11	5804	2387	2177	2177
query12	188	133	131	131
query13	1316	655	458	458
query14	6199	5468	5209	5209
query14_1	4455	4492	4468	4468
query15	217	215	191	191
query16	1021	460	449	449
query17	1168	768	629	629
query18	2632	512	387	387
query19	235	216	180	180
query20	143	140	137	137
query21	220	142	120	120
query22	13778	13704	13463	13463
query23	17434	16661	16240	16240
query23_1	16393	16375	16260	16260
query24	7397	1779	1280	1280
query24_1	1309	1307	1308	1307
query25	570	486	427	427
query26	1306	311	174	174
query27	2702	563	350	350
query28	4430	2033	2015	2015
query29	996	639	499	499
query30	319	239	196	196
query31	1128	1082	960	960
query32	91	76	75	75
query33	536	356	294	294
query34	1185	1129	655	655
query35	800	797	732	732
query36	1358	1411	1186	1186
query37	156	107	93	93
query38	3227	3205	3090	3090
query39	960	924	910	910
query39_1	872	880	862	862
query40	241	149	128	128
query41	67	68	61	61
query42	123	114	113	113
query43	334	343	297	297
query44	
query45	214	198	202	198
query46	1093	1246	717	717
query47	2300	2317	2272	2272
query48	406	410	310	310
query49	649	496	394	394
query50	959	357	253	253
query51	4340	4278	4340	4278
query52	109	110	95	95
query53	267	288	207	207
query54	329	297	263	263
query55	133	91	85	85
query56	302	307	300	300
query57	1448	1421	1291	1291
query58	311	286	280	280
query59	1616	1689	1475	1475
query60	327	335	317	317
query61	157	151	155	151
query62	707	651	584	584
query63	254	208	217	208
query64	2447	797	647	647
query65	
query66	1690	493	366	366
query67	29926	29831	29664	29664
query68	
query69	464	342	306	306
query70	1077	1053	990	990
query71	323	285	284	284
query72	2962	2748	2326	2326
query73	857	815	435	435
query74	5156	4939	4773	4773
query75	2695	2616	2277	2277
query76	2295	1152	801	801
query77	403	415	342	342
query78	12403	12463	11843	11843
query79	1469	1044	737	737
query80	670	540	455	455
query81	451	285	252	252
query82	1378	158	124	124
query83	364	276	260	260
query84	256	140	114	114
query85	870	528	466	466
query86	416	375	347	347
query87	3404	3405	3230	3230
query88	3652	2806	2771	2771
query89	443	414	357	357
query90	1928	185	218	185
query91	177	171	143	143
query92	85	88	77	77
query93	1591	1421	888	888
query94	556	353	312	312
query95	674	488	374	374
query96	1075	823	364	364
query97	2751	2727	2592	2592
query98	245	231	229	229
query99	1179	1157	1042	1042
Total cold run time: 255060 ms
Total hot run time: 170677 ms

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.

2 participants