Skip to content

Conversation

@zddr
Copy link
Contributor

@zddr zddr commented Jul 11, 2025

What problem does this PR solve?

Issue:

  • When parsing SQL, the queryId has not yet been generated. However, the audit log retrieves the queryId from ConnectContext, which means it uses the queryId from the previous execution.
  • The queryId stored in queryCache is from the previous query, not the current one.

Solution:

  • Since parsing may produce multiple SQL statements, each should have its own queryId. Therefore, the queryId should not be set during parsing. As a compromise, we clear the queryId before parsing, ensuring that the audit log records an empty queryId if parsing fails.
  • Set the queryId when adding the cache, not in the constructor.

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:
Fixed an issue that the audit log would record the previous queryId when parseSQL fails.

Release note

Fixed an issue that the audit log would record the previous queryId when parseSQL fails.

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?

@zddr
Copy link
Contributor Author

zddr commented Jul 11, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17580	5258	5084	5084
q2	1928	270	200	200
q3	10294	1227	695	695
q4	10211	990	508	508
q5	7519	2380	2261	2261
q6	178	161	130	130
q7	911	735	602	602
q8	9310	1206	1045	1045
q9	6841	4983	5092	4983
q10	6878	2356	1971	1971
q11	477	292	276	276
q12	333	347	214	214
q13	17757	3655	3067	3067
q14	222	228	212	212
q15	548	480	483	480
q16	432	419	364	364
q17	594	873	388	388
q18	7527	7172	7075	7075
q19	1201	920	529	529
q20	343	337	225	225
q21	3815	3143	2321	2321
q22	358	318	283	283
Total cold run time: 105257 ms
Total hot run time: 32913 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5206	5111	5005	5005
q2	229	325	216	216
q3	2181	2663	2277	2277
q4	1327	1801	1333	1333
q5	4185	4051	4529	4051
q6	204	162	126	126
q7	2016	1945	1830	1830
q8	2598	2539	2502	2502
q9	7276	7183	7346	7183
q10	3041	3363	2868	2868
q11	564	504	495	495
q12	674	809	677	677
q13	3580	3918	3461	3461
q14	272	297	285	285
q15	516	484	484	484
q16	414	461	424	424
q17	1188	1646	1412	1412
q18	7862	7595	7625	7595
q19	761	840	1047	840
q20	1955	1954	1797	1797
q21	4735	4319	4321	4319
q22	654	590	532	532
Total cold run time: 51438 ms
Total hot run time: 49712 ms

@doris-robot
Copy link

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

query1	990	394	391	391
query2	6551	1610	1636	1610
query3	6740	209	210	209
query4	26223	23691	23053	23053
query5	4323	561	422	422
query6	306	206	200	200
query7	4628	480	287	287
query8	283	213	223	213
query9	8613	2612	2628	2612
query10	505	349	261	261
query11	15194	14970	14782	14782
query12	151	106	103	103
query13	1644	520	384	384
query14	8743	5918	5974	5918
query15	204	197	162	162
query16	7750	453	261	261
query17	1313	724	578	578
query18	2027	418	319	319
query19	198	195	168	168
query20	123	124	110	110
query21	215	123	107	107
query22	4262	4266	4112	4112
query23	33951	33003	32865	32865
query24	8382	2378	2345	2345
query25	509	469	387	387
query26	1227	260	141	141
query27	2768	512	337	337
query28	4320	2102	2065	2065
query29	717	550	423	423
query30	284	214	183	183
query31	951	853	767	767
query32	71	64	58	58
query33	559	331	283	283
query34	780	829	509	509
query35	592	636	557	557
query36	941	975	841	841
query37	116	105	72	72
query38	4108	4049	4033	4033
query39	1480	1432	1439	1432
query40	218	114	102	102
query41	55	54	51	51
query42	125	110	115	110
query43	499	488	470	470
query44	1293	802	814	802
query45	176	168	163	163
query46	818	1002	617	617
query47	1706	1788	1734	1734
query48	381	402	308	308
query49	746	471	397	397
query50	626	700	413	413
query51	5583	5597	5467	5467
query52	112	103	96	96
query53	230	248	179	179
query54	551	553	500	500
query55	81	82	77	77
query56	286	282	281	281
query57	1220	1198	1134	1134
query58	262	253	259	253
query59	2576	2584	2555	2555
query60	355	309	302	302
query61	127	121	121	121
query62	804	701	645	645
query63	214	182	185	182
query64	4314	1153	831	831
query65	4256	4166	4157	4157
query66	1077	396	309	309
query67	15613	15386	15252	15252
query68	8199	868	527	527
query69	497	314	262	262
query70	1209	1083	1070	1070
query71	445	301	295	295
query72	5654	4764	4876	4764
query73	740	642	346	346
query74	8890	8857	9073	8857
query75	3716	3155	2637	2637
query76	3621	1129	713	713
query77	782	379	290	290
query78	10898	11017	10223	10223
query79	4242	806	566	566
query80	664	499	436	436
query81	462	257	221	221
query82	646	123	98	98
query83	283	257	236	236
query84	297	105	82	82
query85	823	354	311	311
query86	334	320	293	293
query87	4433	4370	4344	4344
query88	2797	2257	2260	2257
query89	440	315	275	275
query90	1937	210	204	204
query91	138	145	111	111
query92	75	59	55	55
query93	2553	944	589	589
query94	675	310	194	194
query95	376	289	335	289
query96	485	564	278	278
query97	2755	2735	2599	2599
query98	224	213	203	203
query99	1488	1397	1262	1262
Total cold run time: 277824 ms
Total hot run time: 185955 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.08	0.04	0.05
query3	0.25	0.08	0.07
query4	1.60	0.11	0.12
query5	0.44	0.42	0.41
query6	1.17	0.66	0.65
query7	0.02	0.02	0.02
query8	0.05	0.04	0.03
query9	0.60	0.50	0.53
query10	0.58	0.57	0.58
query11	0.15	0.11	0.12
query12	0.15	0.12	0.11
query13	0.63	0.61	0.62
query14	0.83	0.80	0.83
query15	0.90	0.88	0.87
query16	0.40	0.38	0.40
query17	1.09	1.11	1.08
query18	0.23	0.22	0.21
query19	1.92	1.80	1.85
query20	0.01	0.02	0.01
query21	15.39	0.92	0.56
query22	0.76	1.14	0.58
query23	15.08	1.38	0.62
query24	6.65	1.57	0.68
query25	0.49	0.18	0.13
query26	0.51	0.17	0.15
query27	0.08	0.05	0.04
query28	9.69	0.91	0.45
query29	12.58	4.06	3.41
query30	0.26	0.09	0.06
query31	2.83	0.60	0.38
query32	3.23	0.55	0.50
query33	3.18	3.09	3.19
query34	16.05	5.37	4.78
query35	4.84	4.86	4.82
query36	0.69	0.52	0.49
query37	0.09	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.02	0.03
query40	0.18	0.14	0.14
query41	0.08	0.02	0.03
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 103.97 s
Total hot run time: 29.49 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 60.00% (3/5) 🎉
Increment coverage report
Complete coverage report

@zddr
Copy link
Contributor Author

zddr commented Jul 24, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17607	5245	5197	5197
q2	1931	274	169	169
q3	10321	1263	705	705
q4	10212	1000	531	531
q5	7570	2403	2270	2270
q6	177	163	128	128
q7	926	755	598	598
q8	9314	1288	1040	1040
q9	6826	5135	5119	5119
q10	6907	2376	1980	1980
q11	466	295	270	270
q12	338	346	207	207
q13	17781	3691	3078	3078
q14	231	223	217	217
q15	537	492	485	485
q16	419	437	366	366
q17	606	854	357	357
q18	7582	7058	7197	7058
q19	1237	944	569	569
q20	339	333	220	220
q21	3953	2527	2315	2315
q22	1073	1042	999	999
Total cold run time: 106353 ms
Total hot run time: 33878 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5122	5127	5077	5077
q2	239	330	225	225
q3	2141	2630	2271	2271
q4	1371	1749	1303	1303
q5	4221	4362	4430	4362
q6	232	167	130	130
q7	2011	1962	1808	1808
q8	2647	2680	2629	2629
q9	7403	7331	7377	7331
q10	3111	3285	2826	2826
q11	603	532	507	507
q12	711	791	594	594
q13	3571	4176	3290	3290
q14	269	288	283	283
q15	524	468	479	468
q16	452	487	455	455
q17	1210	1531	1438	1438
q18	7950	7718	7565	7565
q19	801	763	734	734
q20	1914	1919	1832	1832
q21	4739	4381	4334	4334
q22	1086	1036	1011	1011
Total cold run time: 52328 ms
Total hot run time: 50473 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187418 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 17fd086fbcb11490c403c8e03a89f395938156b6, data reload: false

query1	988	378	412	378
query2	6531	1761	1731	1731
query3	6772	252	224	224
query4	26332	23318	23076	23076
query5	4414	679	489	489
query6	318	229	209	209
query7	4638	549	295	295
query8	280	227	221	221
query9	8541	2865	2824	2824
query10	495	347	281	281
query11	15816	15094	14757	14757
query12	164	117	113	113
query13	1653	556	426	426
query14	9418	5847	5813	5813
query15	203	182	171	171
query16	7383	658	465	465
query17	1176	759	572	572
query18	1999	429	313	313
query19	195	205	159	159
query20	123	115	113	113
query21	215	124	127	124
query22	4039	4196	4015	4015
query23	33842	33230	33113	33113
query24	8263	2358	2362	2358
query25	536	469	391	391
query26	1227	290	156	156
query27	2717	535	342	342
query28	4352	2185	2152	2152
query29	744	591	443	443
query30	287	210	191	191
query31	923	830	726	726
query32	82	72	74	72
query33	547	378	331	331
query34	800	908	508	508
query35	798	819	735	735
query36	989	1008	920	920
query37	125	115	88	88
query38	4120	4156	4081	4081
query39	1469	1412	1437	1412
query40	224	131	121	121
query41	59	55	56	55
query42	124	113	113	113
query43	497	522	452	452
query44	1396	847	844	844
query45	175	171	173	171
query46	903	1060	650	650
query47	1764	1830	1744	1744
query48	383	455	324	324
query49	746	537	401	401
query50	678	750	427	427
query51	5470	5672	5314	5314
query52	121	115	104	104
query53	231	274	202	202
query54	613	618	546	546
query55	92	93	93	93
query56	395	326	310	310
query57	1168	1209	1145	1145
query58	281	278	303	278
query59	2597	2714	2584	2584
query60	350	340	366	340
query61	130	124	123	123
query62	825	719	666	666
query63	231	192	184	184
query64	4269	1027	688	688
query65	4236	4182	4197	4182
query66	1152	428	334	334
query67	15664	15566	15461	15461
query68	8535	943	572	572
query69	483	332	282	282
query70	1249	1183	1170	1170
query71	467	332	325	325
query72	5717	4787	4873	4787
query73	734	645	357	357
query74	9136	9117	8739	8739
query75	3886	3144	2742	2742
query76	3718	1184	756	756
query77	800	405	319	319
query78	10124	10224	9250	9250
query79	2447	866	615	615
query80	673	563	497	497
query81	483	261	225	225
query82	438	143	110	110
query83	287	253	250	250
query84	295	112	86	86
query85	787	382	335	335
query86	347	313	321	313
query87	4492	4410	4367	4367
query88	3011	2281	2284	2281
query89	395	325	299	299
query90	1930	222	223	222
query91	148	149	169	149
query92	83	77	69	69
query93	1117	1009	637	637
query94	693	436	309	309
query95	403	323	313	313
query96	491	642	280	280
query97	2704	2741	2646	2646
query98	237	217	218	217
query99	1458	1411	1255	1255
Total cold run time: 276056 ms
Total hot run time: 187418 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.09	0.04	0.04
query3	0.24	0.07	0.08
query4	1.63	0.11	0.11
query5	0.43	0.42	0.42
query6	1.18	0.66	0.66
query7	0.02	0.02	0.02
query8	0.05	0.04	0.04
query9	0.60	0.51	0.51
query10	0.59	0.56	0.57
query11	0.16	0.11	0.10
query12	0.14	0.11	0.12
query13	0.63	0.63	0.61
query14	0.79	0.83	0.83
query15	0.90	0.88	0.89
query16	0.39	0.36	0.39
query17	1.05	1.07	1.08
query18	0.21	0.20	0.20
query19	1.94	1.88	1.82
query20	0.01	0.01	0.01
query21	15.38	0.92	0.54
query22	0.80	1.16	0.80
query23	14.79	1.39	0.64
query24	6.72	2.71	0.50
query25	0.52	0.15	0.07
query26	0.61	0.17	0.13
query27	0.07	0.05	0.05
query28	10.63	0.93	0.44
query29	12.57	3.98	3.33
query30	3.11	3.07	2.99
query31	2.82	0.58	0.38
query32	3.23	0.56	0.47
query33	3.01	3.17	3.11
query34	16.01	5.44	4.82
query35	4.86	4.87	4.96
query36	0.68	0.50	0.49
query37	0.09	0.07	0.07
query38	0.06	0.04	0.03
query39	0.04	0.02	0.03
query40	0.19	0.15	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.04
Total cold run time: 107.43 s
Total hot run time: 32.41 s

@zddr
Copy link
Contributor Author

zddr commented Jul 24, 2025

run p0

exprIdGenerator = ExprId.createGenerator(initialId);
if (connectContext != null && connectContext.getSessionVariable() != null
&& connectContext.queryId() != null
//&& connectContext.queryId() != null
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The queryId retrieved here is always null—the current query's queryId is set in subsequent steps, while what was obtained earlier actually belonged to the previous query.

protected void handleQuery(String originStmt) throws ConnectionException {
// Before executing the query, the queryId should be set to empty.
// Otherwise, if SQL parsing fails, the audit log will record the queryId from the previous query.
ctx.resetQueryId();
Copy link
Contributor

Choose a reason for hiding this comment

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

now, what will be in the audit log? null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.setQueryId(ctx.queryId() == null ? "NaN" : DebugUtil.printId(ctx.queryId()))
NAN

@zddr zddr marked this pull request as draft July 25, 2025 03:19
@zddr zddr marked this pull request as ready for review July 25, 2025 04:04
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jul 25, 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.

@zddr
Copy link
Contributor Author

zddr commented Jul 25, 2025

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 45.45% (5/11) 🎉
Increment coverage report
Complete coverage report

@zddr
Copy link
Contributor Author

zddr commented Jul 25, 2025

run performance

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17614	5190	5075	5075
q2	1942	289	187	187
q3	10306	1307	697	697
q4	10220	997	544	544
q5	8172	2448	2331	2331
q6	176	158	129	129
q7	899	727	593	593
q8	9311	1326	1098	1098
q9	6823	5136	5098	5098
q10	6881	2373	1935	1935
q11	487	280	281	280
q12	346	345	218	218
q13	17757	3682	3080	3080
q14	231	226	205	205
q15	547	472	481	472
q16	425	424	371	371
q17	598	877	359	359
q18	7732	7244	7108	7108
q19	1508	955	564	564
q20	348	340	216	216
q21	3682	3212	2340	2340
q22	1056	1036	998	998
Total cold run time: 107061 ms
Total hot run time: 33898 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5155	5100	5089	5089
q2	242	326	218	218
q3	2160	2679	2334	2334
q4	1325	1761	1287	1287
q5	4267	4556	4530	4530
q6	227	180	128	128
q7	2021	1925	1856	1856
q8	2609	2589	2696	2589
q9	7438	7259	7386	7259
q10	3082	3289	3006	3006
q11	596	522	489	489
q12	691	754	645	645
q13	3632	3987	3475	3475
q14	283	307	283	283
q15	527	487	481	481
q16	422	473	443	443
q17	1234	1591	1366	1366
q18	7927	7855	7580	7580
q19	805	824	847	824
q20	1935	1964	1795	1795
q21	4806	4417	4344	4344
q22	1074	1071	982	982
Total cold run time: 52458 ms
Total hot run time: 51003 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187085 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 08e211690152fd0ac2876d5b06a37ccc94a7fe44, data reload: false

query1	994	398	393	393
query2	6513	1669	1675	1669
query3	6741	219	220	219
query4	26326	23359	22875	22875
query5	4359	619	483	483
query6	319	214	202	202
query7	4624	519	287	287
query8	273	229	223	223
query9	8564	2902	2910	2902
query10	460	324	292	292
query11	15974	15015	14709	14709
query12	159	115	113	113
query13	1668	538	445	445
query14	9324	5868	5829	5829
query15	206	182	167	167
query16	7443	632	483	483
query17	1207	719	596	596
query18	2010	408	321	321
query19	193	207	170	170
query20	126	126	119	119
query21	221	125	112	112
query22	4122	4210	4117	4117
query23	33964	33009	33135	33009
query24	8177	2344	2351	2344
query25	552	471	414	414
query26	1242	268	157	157
query27	2741	508	345	345
query28	4359	2227	2198	2198
query29	745	562	441	441
query30	282	223	219	219
query31	938	797	736	736
query32	84	78	76	76
query33	539	364	328	328
query34	790	843	508	508
query35	790	815	748	748
query36	953	1047	918	918
query37	117	108	84	84
query38	4016	4097	3973	3973
query39	1476	1385	1408	1385
query40	222	129	112	112
query41	61	55	54	54
query42	119	107	110	107
query43	503	493	467	467
query44	1335	861	855	855
query45	174	172	168	168
query46	831	1001	631	631
query47	1835	1849	1785	1785
query48	385	433	304	304
query49	724	472	384	384
query50	635	712	389	389
query51	5417	5557	5519	5519
query52	118	108	105	105
query53	233	261	188	188
query54	592	594	514	514
query55	91	87	82	82
query56	308	299	302	299
query57	1189	1207	1155	1155
query58	286	268	269	268
query59	2618	2657	2624	2624
query60	345	343	328	328
query61	123	118	120	118
query62	802	702	655	655
query63	225	187	188	187
query64	4251	1046	732	732
query65	4224	4189	4165	4165
query66	1140	427	362	362
query67	15901	15755	15431	15431
query68	8835	902	564	564
query69	486	333	280	280
query70	1209	1179	1156	1156
query71	467	323	308	308
query72	5698	4765	4952	4765
query73	765	679	361	361
query74	9193	9081	8926	8926
query75	4100	3115	2664	2664
query76	3729	1126	728	728
query77	789	384	318	318
query78	10022	10186	9211	9211
query79	2884	793	594	594
query80	624	525	475	475
query81	485	257	223	223
query82	461	134	109	109
query83	291	252	237	237
query84	302	101	82	82
query85	818	350	329	329
query86	343	305	297	297
query87	4421	4445	4243	4243
query88	3185	2233	2235	2233
query89	409	312	282	282
query90	1945	225	214	214
query91	136	142	110	110
query92	85	70	65	65
query93	2042	996	627	627
query94	685	393	319	319
query95	391	308	307	307
query96	494	583	277	277
query97	2708	2713	2674	2674
query98	242	216	208	208
query99	1473	1404	1302	1302
Total cold run time: 277995 ms
Total hot run time: 187085 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.24	0.08	0.07
query4	1.60	0.11	0.11
query5	0.43	0.42	0.42
query6	1.18	0.65	0.68
query7	0.02	0.02	0.02
query8	0.05	0.04	0.03
query9	0.59	0.52	0.52
query10	0.57	0.57	0.57
query11	0.16	0.11	0.12
query12	0.15	0.12	0.12
query13	0.63	0.60	0.61
query14	0.80	0.82	0.82
query15	0.89	0.86	0.84
query16	0.41	0.39	0.38
query17	1.06	1.05	1.06
query18	0.21	0.19	0.20
query19	1.94	1.86	1.84
query20	0.02	0.01	0.01
query21	15.41	0.96	0.54
query22	0.79	1.38	0.89
query23	14.72	1.35	0.61
query24	6.83	0.67	0.65
query25	0.46	0.23	0.18
query26	0.65	0.16	0.14
query27	0.06	0.05	0.05
query28	9.68	0.93	0.44
query29	12.58	4.05	3.32
query30	3.05	3.08	2.92
query31	2.82	0.58	0.40
query32	3.25	0.56	0.47
query33	3.02	3.08	3.17
query34	15.93	5.40	4.84
query35	4.84	4.90	4.85
query36	0.69	0.51	0.50
query37	0.10	0.06	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.17	0.14	0.15
query41	0.08	0.03	0.02
query42	0.03	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.35 s
Total hot run time: 32.63 s

@morrySnow morrySnow merged commit dc3bc4f into apache:master Jul 28, 2025
31 of 33 checks passed
zddr added a commit to zddr/incubator-doris that referenced this pull request Jul 29, 2025
…us queryId when parseSQL fails. (apache#53107)

### What problem does this PR solve?

Issue:
- When parsing SQL, the queryId has not yet been generated. However, the
audit log retrieves the queryId from ConnectContext, which means it uses
the queryId from the previous execution.
- The queryId stored in queryCache is from the previous query, not the
current one.

Solution:
- Since parsing may produce multiple SQL statements, each should have
its own queryId. Therefore, the queryId should not be set during
parsing. As a compromise, we clear the queryId before parsing, ensuring
that the audit log records an empty queryId if parsing fails.
- Set the queryId when adding the cache, not in the constructor.
# Conflicts:
#	fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
zddr added a commit to zddr/incubator-doris that referenced this pull request Jul 29, 2025
…us queryId when parseSQL fails. (apache#53107)

### What problem does this PR solve?

Issue:
- When parsing SQL, the queryId has not yet been generated. However, the
audit log retrieves the queryId from ConnectContext, which means it uses
the queryId from the previous execution.
- The queryId stored in queryCache is from the previous query, not the
current one.

Solution:
- Since parsing may produce multiple SQL statements, each should have
its own queryId. Therefore, the queryId should not be set during
parsing. As a compromise, we clear the queryId before parsing, ensuring
that the audit log records an empty queryId if parsing fails.
- Set the queryId when adding the cache, not in the constructor.
# Conflicts:
#	fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSqlCacheManager.java
#	fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
#	fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java
zddr added a commit to zddr/incubator-doris that referenced this pull request Jul 29, 2025
…us queryId when parseSQL fails. (apache#53107)

### What problem does this PR solve?

Issue:
- When parsing SQL, the queryId has not yet been generated. However, the
audit log retrieves the queryId from ConnectContext, which means it uses
the queryId from the previous execution.
- The queryId stored in queryCache is from the previous query, not the
current one.

Solution:
- Since parsing may produce multiple SQL statements, each should have
its own queryId. Therefore, the queryId should not be set during
parsing. As a compromise, we clear the queryId before parsing, ensuring
that the audit log records an empty queryId if parsing fails.
- Set the queryId when adding the cache, not in the constructor.
# Conflicts:
#	fe/fe-core/src/main/java/org/apache/doris/common/cache/NereidsSqlCacheManager.java
#	fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
#	fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
#	fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java
morrySnow pushed a commit that referenced this pull request Jul 29, 2025
…d the previous queryId when parseSQL fails. #53107 (#54007)

picked from #53107
dataroaring pushed a commit that referenced this pull request Jul 30, 2025
… the previo… (#54008)

…us queryId when parseSQL fails. (#53107)

pick: #53107
zhiqiang-hhhh pushed a commit to zhiqiang-hhhh/doris that referenced this pull request Aug 4, 2025
…us queryId when parseSQL fails. (apache#53107)

### What problem does this PR solve?

Issue:
- When parsing SQL, the queryId has not yet been generated. However, the
audit log retrieves the queryId from ConnectContext, which means it uses
the queryId from the previous execution.
- The queryId stored in queryCache is from the previous query, not the
current one.

Solution:
- Since parsing may produce multiple SQL statements, each should have
its own queryId. Therefore, the queryId should not be set during
parsing. As a compromise, we clear the queryId before parsing, ensuring
that the audit log records an empty queryId if parsing fails.
- Set the queryId when adding the cache, not in the constructor.
yiguolei pushed a commit that referenced this pull request Sep 11, 2025
… the previo… (#54010)

…us queryId when parseSQL fails. (#53107)

pick: #53107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants