Skip to content

[fix](show variables) Fix changed variable output in show variables#63734

Open
yujun777 wants to merge 2 commits into
apache:masterfrom
yujun777:fix-cir-20354-show-variables-where
Open

[fix](show variables) Fix changed variable output in show variables#63734
yujun777 wants to merge 2 commits into
apache:masterfrom
yujun777:fix-cir-20354-show-variables-where

Conversation

@yujun777
Copy link
Copy Markdown
Contributor

@yujun777 yujun777 commented May 27, 2026

What problem does this PR solve?

Issue Number: close #0

Related PR: #

Problem Summary: SHOW VARIABLES WHERE is evaluated through an internal schema query. During planning of that internal query, FE may call setVarOnce() and temporarily change session variables such as disable_join_reorder. The schema scan then dumps those temporary values and reports them as Changed, even though they are not user-visible session changes. This patch dumps variables from a reverted clone so one-shot internal values do not affect SHOW VARIABLES output, while preserving the existing information_schema WHERE execution behavior.

Release note

Fix incorrect SHOW VARIABLES WHERE changed = 1 output caused by internal one-shot session variables.

Check List (For Author)

  • Test: Regression test / Manual test
    • tools/fast-compile-fe.sh LogicalPlanBuilder.java ShowVariablesCommand.java FrontendServiceImpl.java
    • tools/fast-compile-fe.sh FrontendServiceImpl.java
    • run-regression-test.sh --run -d query_p0/ddl/show_variables -s show_variables_command
    • Manual test: SET enable_profile=true and SHOW VARIABLES WHERE variable_name = enable_profile
  • Behavior changed: Yes. SHOW VARIABLES no longer reports internal one-shot session variables as user changed values.
  • Does this need documentation: No

yujun777 added 2 commits May 27, 2026 16:02
SHOW VARIABLES WHERE is evaluated through an internal schema query, whose planning can temporarily set one-shot session variables and pollute the Changed column.

Key changes:

- Dump variables from a reverted clone for schema-scan SHOW VARIABLES requests.

- Keep the existing information_schema WHERE execution path so SQL predicate behavior is preserved.

- Add regression coverage for changed session variables.

Unit Test:

- tools/fast-compile-fe.sh LogicalPlanBuilder.java ShowVariablesCommand.java FrontendServiceImpl.java

- run-regression-test.sh --run -d query_p0/ddl/show_variables -s show_variables_command
Clarify why SHOW VARIABLES dumps a reverted clone instead of cloning alone.

Key changes:

- Explain that setVarOnce records the origin and changes the temporary live value.

- Document that only the clone is reverted before dumping variables.

Unit Test:

- tools/fast-compile-fe.sh FrontendServiceImpl.java
@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?

@yujun777
Copy link
Copy Markdown
Contributor Author

run buildall

@yujun777 yujun777 changed the title [fix](fe) Fix changed variable output in show variables [fix](show variables) Fix changed variable output in show variables May 27, 2026
@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 31777 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d6dc43a5f23ae56526abc75a2e2e503872a62bf5, 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	17892	4112	4046	4046
q2	q3	10758	1434	808	808
q4	4686	475	350	350
q5	7552	2267	2117	2117
q6	242	186	139	139
q7	931	795	644	644
q8	9499	1820	1629	1629
q9	5195	4946	4940	4940
q10	6414	2168	1889	1889
q11	429	276	242	242
q12	627	425	302	302
q13	18137	3343	2721	2721
q14	269	258	249	249
q15	q16	815	770	709	709
q17	960	933	927	927
q18	7000	5752	5626	5626
q19	1383	1302	1186	1186
q20	585	421	304	304
q21	6213	2862	2632	2632
q22	490	367	317	317
Total cold run time: 100077 ms
Total hot run time: 31777 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	4763	4705	4701	4701
q2	q3	4988	5217	4660	4660
q4	2133	2185	1405	1405
q5	5076	4713	4815	4713
q6	232	189	137	137
q7	1893	1830	1627	1627
q8	2415	2151	2107	2107
q9	7697	7501	7373	7373
q10	4779	4693	4236	4236
q11	526	400	360	360
q12	732	746	532	532
q13	2963	3404	2837	2837
q14	272	295	265	265
q15	q16	678	696	618	618
q17	1284	1257	1239	1239
q18	7471	7026	6931	6931
q19	1109	1088	1084	1084
q20	2228	2236	1974	1974
q21	5272	4675	4485	4485
q22	514	476	404	404
Total cold run time: 57025 ms
Total hot run time: 51688 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4338	643	499	499
query6	334	225	196	196
query7	4220	558	306	306
query8	348	250	226	226
query9	8780	3996	4001	3996
query10	450	353	302	302
query11	5800	2408	2222	2222
query12	184	127	128	127
query13	1320	636	428	428
query14	6052	5443	5062	5062
query14_1	4436	4429	4409	4409
query15	215	202	184	184
query16	1002	452	433	433
query17	965	721	586	586
query18	2454	479	358	358
query19	209	196	155	155
query20	136	133	126	126
query21	214	135	119	119
query22	13728	13620	13391	13391
query23	17233	16420	16238	16238
query23_1	16397	16290	16426	16290
query24	7376	1789	1316	1316
query24_1	1324	1352	1318	1318
query25	582	503	447	447
query26	1316	316	177	177
query27	2730	557	350	350
query28	4448	2008	2004	2004
query29	1019	650	516	516
query30	300	239	199	199
query31	1154	1084	966	966
query32	95	81	75	75
query33	574	372	307	307
query34	1196	1129	669	669
query35	772	809	707	707
query36	1403	1407	1239	1239
query37	170	108	96	96
query38	3229	3142	3095	3095
query39	935	916	888	888
query39_1	869	902	880	880
query40	242	149	128	128
query41	72	68	70	68
query42	112	112	114	112
query43	332	337	327	327
query44	
query45	217	205	200	200
query46	1095	1220	752	752
query47	2344	2361	2227	2227
query48	413	410	314	314
query49	664	519	411	411
query50	1010	354	255	255
query51	4388	4288	4292	4288
query52	107	108	98	98
query53	261	286	224	224
query54	354	293	272	272
query55	96	94	87	87
query56	337	335	309	309
query57	1437	1432	1362	1362
query58	308	289	286	286
query59	1586	1695	1437	1437
query60	314	321	307	307
query61	156	155	163	155
query62	701	652	593	593
query63	242	199	204	199
query64	2417	814	637	637
query65	
query66	1745	476	354	354
query67	29172	29707	29553	29553
query68	
query69	473	343	317	317
query70	1041	1039	996	996
query71	303	275	272	272
query72	2995	2813	2460	2460
query73	870	752	435	435
query74	5178	5015	4796	4796
query75	2694	2636	2274	2274
query76	2296	1151	788	788
query77	410	405	339	339
query78	12338	12506	11925	11925
query79	1506	1098	749	749
query80	639	537	443	443
query81	451	285	245	245
query82	1360	157	125	125
query83	348	282	249	249
query84	311	147	110	110
query85	886	530	456	456
query86	391	350	330	330
query87	3435	3389	3240	3240
query88	3688	2751	2706	2706
query89	438	397	342	342
query90	1990	175	178	175
query91	180	181	140	140
query92	82	80	74	74
query93	1442	1350	900	900
query94	541	367	318	318
query95	676	467	349	349
query96	1032	886	389	389
query97	2730	2717	2585	2585
query98	235	245	236	236
query99	1171	1147	1021	1021
Total cold run time: 253551 ms
Total hot run time: 171341 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 6.67% (4/60) 🎉
Increment coverage report
Complete coverage report

@yujun777
Copy link
Copy Markdown
Contributor Author

run feut

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