Skip to content

[fix](parquet) Fix SIGSEGV on nullptr ColumnArray::data when query is cancelled during Parquet read - #66619

Open
LemonCL wants to merge 3 commits into
apache:masterfrom
LemonCL:fix_parquet_column_npe
Open

[fix](parquet) Fix SIGSEGV on nullptr ColumnArray::data when query is cancelled during Parquet read#66619
LemonCL wants to merge 3 commits into
apache:masterfrom
LemonCL:fix_parquet_column_npe

Conversation

@LemonCL

@LemonCL LemonCL commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

When reading Parquet external tables with nested columns (e.g. ARRAY), ScalarColumnReader::read_column_data() moves doris_column into resolved_column for the direct-read optimization path. If the query is cancelled (KILL/timeout) between the move and _converter->convert(), the EndOfFile error skips convert(), leaving doris_column permanently nullptr.

For nested readers, doris_column aliases ColumnArray::data. The nullptr breaks the column invariant and crashes in Block::clear_column_data() -> ColumnArray::is_exclusive() with SIGSEGV.

Add a DEFER guard to move resolved_column back into doris_column on the error/unwind path, ensuring the column array data pointer is never left as nullptr.

Crash stack:
ColumnArray::is_exclusive() @0x0
ColumnNullable::is_exclusive()
Block::clear_column_data()
ParquetReader::get_next_block() (EOF branch)
IcebergTableReader::get_next_block_inner()

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

… cancelled during Parquet read

When reading Parquet external tables with nested columns (e.g. ARRAY),
ScalarColumnReader::read_column_data() moves doris_column into
resolved_column for the direct-read optimization path. If the query is
cancelled (KILL/timeout) between the move and _converter->convert(),
the EndOfFile error skips convert(), leaving doris_column permanently
nullptr.

For nested readers, doris_column aliases ColumnArray::data. The nullptr
breaks the column invariant and crashes in Block::clear_column_data()
-> ColumnArray::is_exclusive() with SIGSEGV.

Add a DEFER guard to move resolved_column back into doris_column on
the error/unwind path, ensuring the column array data pointer is never
left as nullptr.

Crash stack:
  ColumnArray::is_exclusive() @0x0
  ColumnNullable::is_exclusive()
  Block::clear_column_data()
  ParquetReader::get_next_block() (EOF branch)
  IcebergTableReader::get_next_block_inner()
@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?

@LemonCL LemonCL changed the title [fix](parquet) Fix SIGSEGV on nullptr ColumnArray::data when query is… [fix](parquet) Fix SIGSEGV on nullptr ColumnArray::data when query is cancelled during Parquet read Aug 10, 2026
@LemonCL

LemonCL commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17688	3953	3974	3953
q2	2014	312	199	199
q3	10304	1395	806	806
q4	4677	467	338	338
q5	7605	936	563	563
q6	186	170	133	133
q7	731	800	591	591
q8	9434	1526	1591	1526
q9	5319	4068	4080	4068
q10	6673	1608	1333	1333
q11	499	354	341	341
q12	717	596	455	455
q13	18099	3283	2735	2735
q14	264	259	235	235
q15	q16	732	731	666	666
q17	972	1039	989	989
q18	6591	5630	5561	5561
q19	1201	1282	1122	1122
q20	802	688	557	557
q21	5965	2820	2641	2641
q22	450	372	328	328
Total cold run time: 100923 ms
Total hot run time: 29140 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4929	4539	4541	4539
q2	288	325	212	212
q3	4982	5280	4633	4633
q4	2190	2236	1445	1445
q5	4488	4689	4348	4348
q6	236	175	129	129
q7	1890	1671	1488	1488
q8	2317	1967	2036	1967
q9	7115	6900	6664	6664
q10	4234	4201	3823	3823
q11	510	368	338	338
q12	687	713	492	492
q13	2891	3221	2773	2773
q14	271	289	247	247
q15	q16	660	684	595	595
q17	1226	1201	1215	1201
q18	12045	10965	11769	10965
q19	1071	1052	1076	1052
q20	2191	2172	1908	1908
q21	5224	4476	4478	4476
q22	520	467	426	426
Total cold run time: 59965 ms
Total hot run time: 53721 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 157914 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 603b48c942c555cec3c26a57a0f35fe18a640cfe, data reload: false

query5	4323	584	453	453
query6	479	217	224	217
query7	4863	583	355	355
query8	314	167	145	145
query9	8799	3978	3993	3978
query10	452	385	297	297
query11	5844	2214	2038	2038
query12	156	104	102	102
query13	1293	627	424	424
query14	6060	4280	3947	3947
query14_1	3777	3795	3799	3795
query15	198	194	177	177
query16	986	484	486	484
query17	932	705	573	573
query18	2441	472	343	343
query19	212	195	153	153
query20	104	102	101	101
query21	234	155	139	139
query22	13026	12996	12780	12780
query23	15756	15120	14514	14514
query23_1	14745	14738	14700	14700
query24	7474	1681	1229	1229
query24_1	1273	1241	1244	1241
query25	561	457	382	382
query26	1318	345	227	227
query27	2581	594	397	397
query28	4555	2027	2028	2027
query29	1088	636	491	491
query30	339	268	228	228
query31	1196	1121	1033	1033
query32	113	66	60	60
query33	523	309	243	243
query34	1181	1197	640	640
query35	732	744	643	643
query36	756	770	676	676
query37	155	102	90	90
query38	1832	1751	1675	1675
query39	828	817	814	814
query39_1	770	784	790	784
query40	245	165	135	135
query41	62	61	63	61
query42	94	88	89	88
query43	316	313	271	271
query44	1425	760	763	760
query45	183	174	169	169
query46	1025	1153	743	743
query47	1538	1505	1406	1406
query48	413	413	316	316
query49	584	408	296	296
query50	1090	426	332	332
query51	10366	10567	10186	10186
query52	85	88	71	71
query53	262	271	191	191
query54	303	248	212	212
query55	77	71	67	67
query56	306	290	310	290
query57	1039	994	939	939
query58	294	257	235	235
query59	1538	1579	1363	1363
query60	313	264	251	251
query61	167	149	145	145
query62	402	324	270	270
query63	234	202	194	194
query64	2856	1030	851	851
query65	3843	3807	3804	3804
query66	1815	489	354	354
query67	20038	20245	19984	19984
query68	3272	1504	972	972
query69	408	298	269	269
query70	864	758	750	750
query71	369	337	302	302
query72	3009	2792	2326	2326
query73	810	772	439	439
query74	4627	4479	4311	4311
query75	2389	2347	1986	1986
query76	2332	1131	749	749
query77	346	378	287	287
query78	11076	11083	10626	10626
query79	1350	1140	735	735
query80	668	579	507	507
query81	446	319	280	280
query82	615	175	132	132
query83	406	330	302	302
query84	327	166	127	127
query85	925	603	529	529
query86	318	233	225	225
query87	2004	1974	1829	1829
query88	3704	2777	2768	2768
query89	393	313	283	283
query90	1925	198	193	193
query91	203	193	161	161
query92	61	59	55	55
query93	1619	1530	1037	1037
query94	547	368	320	320
query95	809	596	465	465
query96	1085	773	334	334
query97	2484	2465	2317	2317
query98	197	187	178	178
query99	744	726	646	646
Total cold run time: 243779 ms
Total hot run time: 157914 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 23.77 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 603b48c942c555cec3c26a57a0f35fe18a640cfe, data reload: false

query1	0.00	0.00	0.01
query2	0.10	0.05	0.04
query3	0.25	0.13	0.14
query4	1.61	0.14	0.14
query5	0.23	0.22	0.22
query6	1.16	0.82	0.78
query7	0.04	0.00	0.01
query8	0.06	0.04	0.03
query9	0.43	0.32	0.31
query10	0.55	0.56	0.54
query11	0.19	0.14	0.13
query12	0.18	0.14	0.14
query13	0.48	0.45	0.47
query14	1.01	0.97	0.98
query15	0.61	0.58	0.59
query16	0.32	0.33	0.33
query17	1.12	1.06	1.08
query18	0.21	0.21	0.21
query19	2.05	2.01	1.97
query20	0.02	0.02	0.01
query21	15.46	0.18	0.13
query22	4.98	0.05	0.06
query23	16.14	0.31	0.12
query24	2.95	0.43	0.32
query25	0.12	0.04	0.05
query26	0.71	0.20	0.16
query27	0.03	0.04	0.03
query28	3.51	0.78	0.35
query29	12.51	4.02	3.15
query30	0.27	0.15	0.16
query31	2.77	0.54	0.31
query32	3.21	0.58	0.49
query33	3.25	3.25	3.13
query34	15.58	3.94	3.28
query35	3.24	3.23	3.26
query36	0.55	0.44	0.42
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.03	0.04	0.04
query40	0.17	0.15	0.14
query41	0.08	0.03	0.03
query42	0.03	0.03	0.03
query43	0.04	0.03	0.03
Total cold run time: 96.39 s
Total hot run time: 23.77 s

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.

3 participants