Skip to content

Conversation

@mymeiyi
Copy link
Contributor

@mymeiyi mymeiyi commented Sep 10, 2025

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:
if http stream parse sql failed, the exception is ignored and continue execute, then throw exception:

    "Message": "[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = exec sql error catch unknown result.java.lang.NullPointerException: Cannot invoke \"org.apache.doris.planner.Planner.getFragments()\" because \"planner\" is null"

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

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

@mymeiyi
Copy link
Contributor Author

mymeiyi commented Sep 10, 2025

run buildall

@dataroaring dataroaring requested a review from Copilot September 10, 2025 08:05
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

This PR fixes an issue where HTTP stream failed to properly handle SQL parsing errors, resulting in confusing null pointer exceptions instead of meaningful error messages. The fix ensures that parsing failures are properly caught and rethrown with descriptive error messages.

  • Improves error handling by properly propagating SQL parsing exceptions in HTTP stream
  • Enhances error message clarity by including the original SQL statement in logs
  • Adds test coverage for SQL parsing error scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
regression-test/suites/load_p0/http_stream/test_http_stream.groovy Adds test case for invalid SQL to verify proper error handling
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java Improves error logging with original SQL statement context
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java Fixes control flow to properly propagate parsing exceptions and prevent null pointer errors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

LOG.warn("Analyze failed. {}", context.getQueryIdentifier(), e);
throw ((NereidsException) e).getException();
}
throw e;
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

The removal of the specific exception handling for NereidsException breaks the original logic. The code should still throw the nested exception from NereidsException rather than the wrapper exception itself.

Suggested change
throw e;
if (e instanceof NereidsException && e.getCause() != null) {
// Restore original logic: throw the nested cause of NereidsException
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
} else {
throw new RuntimeException(e.getCause());
}
} else {
throw e;
}

Copilot uses AI. Check for mistakes.
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17648	5202	5048	5048
q2	2002	310	210	210
q3	10271	1277	730	730
q4	10250	1021	524	524
q5	7543	2426	2313	2313
q6	181	164	137	137
q7	936	758	637	637
q8	9338	1327	1122	1122
q9	6875	5101	5176	5101
q10	6925	2377	1996	1996
q11	491	319	295	295
q12	360	363	235	235
q13	17777	3654	3032	3032
q14	244	235	215	215
q15	576	494	488	488
q16	1002	1006	942	942
q17	613	867	357	357
q18	7620	7063	7054	7054
q19	1468	964	566	566
q20	356	338	234	234
q21	3793	3193	2335	2335
q22	1014	1022	958	958
Total cold run time: 107283 ms
Total hot run time: 34529 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5195	5097	5086	5086
q2	259	340	243	243
q3	2262	2708	2332	2332
q4	1406	1794	1377	1377
q5	4388	4818	4641	4641
q6	221	174	142	142
q7	2037	1897	1843	1843
q8	2731	2643	2551	2551
q9	7288	7343	7122	7122
q10	3208	3289	2842	2842
q11	571	506	515	506
q12	811	790	622	622
q13	3660	3870	3606	3606
q14	304	298	285	285
q15	520	480	491	480
q16	1085	1127	1059	1059
q17	1219	1589	1393	1393
q18	7923	7772	7656	7656
q19	819	822	1037	822
q20	1989	2114	1995	1995
q21	4814	4247	4208	4208
q22	1092	1030	1026	1026
Total cold run time: 53802 ms
Total hot run time: 51837 ms

@doris-robot
Copy link

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

query1	1067	441	418	418
query2	6547	1723	1708	1708
query3	6752	231	225	225
query4	26254	24024	22815	22815
query5	4406	666	524	524
query6	370	251	243	243
query7	4640	522	320	320
query8	309	271	253	253
query9	8649	2932	2942	2932
query10	502	360	309	309
query11	15762	15160	14684	14684
query12	175	123	149	123
query13	1674	549	430	430
query14	11261	9243	9125	9125
query15	224	191	175	175
query16	7674	654	490	490
query17	1234	735	618	618
query18	2038	428	344	344
query19	240	199	186	186
query20	137	130	124	124
query21	218	134	119	119
query22	4155	4279	4007	4007
query23	33862	32986	32979	32979
query24	8225	2351	2447	2351
query25	604	528	462	462
query26	1254	282	168	168
query27	2706	514	358	358
query28	4417	2256	2229	2229
query29	792	643	490	490
query30	294	234	194	194
query31	913	809	728	728
query32	89	79	81	79
query33	585	389	403	389
query34	796	851	522	522
query35	831	820	745	745
query36	954	1020	936	936
query37	129	113	94	94
query38	3460	3527	3494	3494
query39	1520	1507	1439	1439
query40	243	142	130	130
query41	63	63	60	60
query42	133	122	120	120
query43	542	499	470	470
query44	1338	856	856	856
query45	182	177	172	172
query46	848	1017	651	651
query47	1800	1787	1719	1719
query48	406	429	315	315
query49	771	506	412	412
query50	648	691	401	401
query51	4014	4062	3900	3900
query52	121	116	107	107
query53	256	270	197	197
query54	613	607	550	550
query55	94	92	100	92
query56	343	335	330	330
query57	1181	1199	1144	1144
query58	297	289	280	280
query59	2559	2686	2458	2458
query60	366	372	343	343
query61	171	161	162	161
query62	801	720	660	660
query63	233	203	210	203
query64	4620	1324	829	829
query65	4058	3946	4003	3946
query66	1111	445	363	363
query67	15733	15222	15055	15055
query68	7904	944	579	579
query69	477	337	308	308
query70	1320	1323	1343	1323
query71	614	354	337	337
query72	5998	4969	5047	4969
query73	678	650	364	364
query74	9149	9038	8896	8896
query75	3493	3238	2745	2745
query76	3364	1178	754	754
query77	801	402	331	331
query78	9567	9942	8904	8904
query79	1692	851	615	615
query80	649	592	510	510
query81	508	336	228	228
query82	244	169	137	137
query83	268	259	272	259
query84	254	111	86	86
query85	841	460	422	422
query86	379	334	304	304
query87	3766	3784	3677	3677
query88	2795	2240	2231	2231
query89	470	338	291	291
query90	1839	233	224	224
query91	165	167	130	130
query92	80	78	73	73
query93	1140	993	667	667
query94	653	441	322	322
query95	411	338	329	329
query96	482	598	284	284
query97	2905	2996	2856	2856
query98	251	225	222	222
query99	1356	1406	1305	1305
Total cold run time: 273777 ms
Total hot run time: 188435 ms

@doris-robot
Copy link

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

query1	0.06	0.04	0.04
query2	0.09	0.05	0.06
query3	0.26	0.08	0.08
query4	1.61	0.11	0.12
query5	0.28	0.26	0.25
query6	1.19	0.65	0.64
query7	0.03	0.03	0.02
query8	0.05	0.05	0.05
query9	0.62	0.52	0.52
query10	0.58	0.58	0.58
query11	0.17	0.12	0.11
query12	0.16	0.12	0.12
query13	0.63	0.62	0.62
query14	1.02	1.04	1.05
query15	0.88	0.85	0.87
query16	0.41	0.40	0.40
query17	1.04	1.09	1.04
query18	0.22	0.20	0.20
query19	1.97	1.80	1.88
query20	0.01	0.01	0.01
query21	15.40	0.97	0.58
query22	0.75	1.23	0.78
query23	14.78	1.40	0.63
query24	7.28	0.92	1.06
query25	0.51	0.20	0.18
query26	0.65	0.17	0.13
query27	0.07	0.05	0.06
query28	9.45	0.92	0.43
query29	12.55	3.84	3.24
query30	0.28	0.12	0.11
query31	2.83	0.60	0.38
query32	3.23	0.56	0.49
query33	3.12	3.15	3.11
query34	15.92	5.47	4.89
query35	4.93	4.92	4.88
query36	0.71	0.52	0.50
query37	0.11	0.07	0.06
query38	0.06	0.04	0.04
query39	0.03	0.03	0.03
query40	0.19	0.15	0.15
query41	0.08	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 104.29 s
Total hot run time: 30.2 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/7) 🎉
Increment coverage report
Complete coverage report

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

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

LGTM

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

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

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@liaoxin01 liaoxin01 left a comment

Choose a reason for hiding this comment

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

LGTM

@dataroaring dataroaring merged commit 1eaa1c9 into apache:master Sep 11, 2025
33 of 36 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 11, 2025
…iled (#55863)

Problem Summary:
if http stream parse sql failed, the exception is ignored and continue
execute, then throw exception:
```
    "Message": "[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = exec sql error catch unknown result.java.lang.NullPointerException: Cannot invoke \"org.apache.doris.planner.Planner.getFragments()\" because \"planner\" is null"
```
github-actions bot pushed a commit that referenced this pull request Sep 11, 2025
…iled (#55863)

Problem Summary:
if http stream parse sql failed, the exception is ignored and continue
execute, then throw exception:
```
    "Message": "[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = exec sql error catch unknown result.java.lang.NullPointerException: Cannot invoke \"org.apache.doris.planner.Planner.getFragments()\" because \"planner\" is null"
```
dataroaring pushed a commit that referenced this pull request Sep 11, 2025
morrySnow pushed a commit that referenced this pull request Sep 12, 2025
@morrySnow morrySnow mentioned this pull request Sep 22, 2025
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.0.9-merged dev/3.1.1-merged p0_b reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants