Skip to content

[fix](fe) Support dollar sign in mysql pattern#63972

Merged
Gabriel39 merged 2 commits into
apache:masterfrom
Gabriel39:fix_0602
Jun 2, 2026
Merged

[fix](fe) Support dollar sign in mysql pattern#63972
Gabriel39 merged 2 commits into
apache:masterfrom
Gabriel39:fix_0602

Conversation

@Gabriel39
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #26112

Related PR: None

Problem Summary: Querying information_schema.columns with an external system table name such as table can call FrontendServiceImpl.getTableNames with the table name as a pattern. The MySQL pattern converter rejected '$' as a forbidden regex character, so the FE thrift service threw an internal getTableNames error before metadata resolution. This change treats '$' as a literal character in MySQL patterns by escaping it for the generated Java regex, allowing system table names to be matched safely.

Release note

Fixes metadata lookup for table names containing '$', including external system tables such as table.

Check List (For Author)

  • Test: Manual test
    • Ran git diff --check and git diff --cached --check.
    • Tried ./run-fe-ut.sh --run org.apache.doris.common.PatternMatcherTest, but the local environment only has JDK 11 and the script requires JDK 17.
  • Behavior changed: Yes. MySQL pattern matching now allows '$' as a literal table-name character.
  • Does this need documentation: No

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

### What problem does this PR solve?

Issue Number: close apache#26112

Related PR: None

Problem Summary: Querying information_schema.columns with an external system table name such as table can call FrontendServiceImpl.getTableNames with the table name as a pattern. The MySQL pattern converter rejected '$' as a forbidden regex character, so the FE thrift service threw an internal getTableNames error before metadata resolution. This change treats '$' as a literal character in MySQL patterns by escaping it for the generated Java regex, allowing system table names to be matched safely.

### Release note

Fixes metadata lookup for table names containing '$', including external system tables such as table.

### Check List (For Author)

- Test: Manual test
    - Ran git diff --check and git diff --cached --check.
    - Tried ./run-fe-ut.sh --run org.apache.doris.common.PatternMatcherTest, but the local environment only has JDK 11 and the script requires JDK 17.
- Behavior changed: Yes. MySQL pattern matching now allows '$' as a literal table-name character.
- Does this need documentation: No
@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?

@Gabriel39
Copy link
Copy Markdown
Contributor Author

/review

@Gabriel39
Copy link
Copy Markdown
Contributor Author

run buildall

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.

I found one blocking functional issue in the pattern conversion. The PR goal is valid and focused, but the current escaping path still fails to match table names containing a literal $.

Critical checkpoint conclusions:

  • Goal/test: the goal is to allow MySQL-pattern table matching for names containing $; the added direct unit test covers this, but it would fail with the current conversion.
  • Scope: the code change is small and focused.
  • Concurrency/lifecycle/config/compatibility/persistence/data writes: not applicable; this is FE pattern conversion only.
  • Parallel paths: createMysqlPattern is shared by table-name/list-status matching, so fixing this conversion should cover both downstream paths.
  • Test coverage: tests were added for PatternMatcher and FrontendServiceImpl, but the implementation needs adjustment before they can pass.
  • Observability/performance: not applicable; no new logging or hot-path concern found.

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

### What problem does this PR solve?

Issue Number: close apache#63972

Related PR: apache#63972

Problem Summary: MySQL pattern conversion escaped '$' in the first pass, but the second pass only preserved escaped '.', so the escaped dollar became a regex that did not match a literal '$'. This change preserves '$' during the second pass so table names containing '$' can be matched literally.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - Ran git diff --check and git diff --cached --check. FE unit test org.apache.doris.common.PatternMatcherTest could not run because local JAVA_HOME points to JDK 11 and JDK_17 is not set.
- Behavior changed: No
- Does this need documentation: No
@Gabriel39
Copy link
Copy Markdown
Contributor Author

/review

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 result: no additional blocking issues found.

Critical checkpoint conclusions:

  • Goal and proof: The PR aims to allow $ in MySQL-style patterns so table names such as test_dropped_partition_field$partitions do not fail pattern conversion. The current code removes $ from the forbidden set, emits \$, and preserves that escape in the second pass, so the stated goal is met. Tests were added at both PatternMatcher and FrontendServiceImpl.getTableNames levels.
  • Scope and clarity: The functional change is small and focused on PatternMatcher plus targeted tests.
  • Concurrency and locks: No new shared mutable state, locking, or concurrent lifecycle behavior is introduced.
  • Lifecycle/static initialization: No new static initialization dependencies or lifecycle management risks were introduced.
  • Configuration and compatibility: No config, storage format, function symbol, or FE-BE protocol compatibility changes were introduced.
  • Parallel paths: The shared PatternMatcher.createMysqlPattern path is used by table/db/list/status metadata matching, so the fix applies to the relevant callers rather than only one endpoint.
  • Conditional checks: The special second-pass preservation for \$ is now aligned with the existing \. handling; no unexplained defensive checks were added.
  • Test coverage: The added unit coverage validates direct pattern matching and the frontend service call path. I did not run tests in this review environment.
  • Test result files: Not applicable.
  • Observability: Not applicable for this localized validation fix.
  • Transactions/persistence/data writes: Not applicable.
  • FE-BE variable passing: Not applicable.
  • Performance: No meaningful overhead added.
  • Other issues: The previously raised inline issue about \$ being broken in the second pass is already known and appears fixed by the latest commit. I found no distinct additional issue.

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

@Gabriel39
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 29004 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 14c184f710a499f9882d1fd346331773b77e3fe0, 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	17619	4015	4033	4015
q2	q3	10779	1388	827	827
q4	4690	476	350	350
q5	7524	875	566	566
q6	201	172	138	138
q7	816	839	633	633
q8	10090	1722	1588	1588
q9	6699	4475	4496	4475
q10	6801	1851	1503	1503
q11	456	277	247	247
q12	659	417	298	298
q13	18191	3337	2794	2794
q14	265	259	243	243
q15	q16	828	762	711	711
q17	930	987	938	938
q18	6886	5623	5617	5617
q19	1440	1241	1093	1093
q20	523	404	264	264
q21	5948	2632	2401	2401
q22	438	347	303	303
Total cold run time: 101783 ms
Total hot run time: 29004 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	4347	4278	4268	4268
q2	q3	4490	4980	4326	4326
q4	2107	2232	1378	1378
q5	4711	4313	4305	4305
q6	229	173	131	131
q7	1748	1954	1784	1784
q8	2578	2165	2099	2099
q9	8018	8062	8005	8005
q10	4794	4783	4325	4325
q11	587	424	397	397
q12	741	748	536	536
q13	3540	3612	2990	2990
q14	308	306	271	271
q15	q16	757	773	664	664
q17	1355	1327	1349	1327
q18	8017	7376	7380	7376
q19	1181	1099	1144	1099
q20	2225	2237	1965	1965
q21	5278	4671	4488	4488
q22	516	450	406	406
Total cold run time: 57527 ms
Total hot run time: 52140 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 171293 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 14c184f710a499f9882d1fd346331773b77e3fe0, data reload: false

query5	4331	681	505	505
query6	353	225	202	202
query7	4229	587	298	298
query8	335	241	225	225
query9	8792	4026	4032	4026
query10	470	352	312	312
query11	5767	2391	2234	2234
query12	201	139	131	131
query13	1314	641	421	421
query14	6090	5473	5142	5142
query14_1	4476	4463	4478	4463
query15	214	212	191	191
query16	1025	500	442	442
query17	1159	760	635	635
query18	2600	515	374	374
query19	233	214	172	172
query20	147	138	140	138
query21	220	144	122	122
query22	13546	13654	13396	13396
query23	17357	16535	16225	16225
query23_1	16387	16348	16431	16348
query24	7525	1818	1325	1325
query24_1	1316	1335	1335	1335
query25	592	517	457	457
query26	1321	337	180	180
query27	2671	583	354	354
query28	4436	2009	1986	1986
query29	1013	667	523	523
query30	316	237	202	202
query31	1133	1090	960	960
query32	99	79	77	77
query33	569	367	311	311
query34	1197	1151	644	644
query35	811	808	695	695
query36	1413	1381	1291	1291
query37	157	107	94	94
query38	3224	3156	3061	3061
query39	915	920	914	914
query39_1	878	898	885	885
query40	244	152	127	127
query41	69	62	62	62
query42	118	112	114	112
query43	324	332	290	290
query44	
query45	210	214	196	196
query46	1089	1221	707	707
query47	2374	2378	2291	2291
query48	395	399	288	288
query49	634	491	379	379
query50	1000	369	258	258
query51	4390	4474	4239	4239
query52	106	106	96	96
query53	257	286	210	210
query54	332	287	264	264
query55	99	91	88	88
query56	294	306	301	301
query57	1415	1414	1341	1341
query58	314	281	281	281
query59	1535	1637	1418	1418
query60	330	337	316	316
query61	165	164	163	163
query62	705	676	576	576
query63	246	207	211	207
query64	2383	800	640	640
query65	
query66	1697	479	356	356
query67	29852	29788	29608	29608
query68	
query69	458	341	296	296
query70	1055	1037	1003	1003
query71	321	280	262	262
query72	2945	2726	2423	2423
query73	854	793	442	442
query74	5082	4926	4748	4748
query75	2700	2603	2287	2287
query76	2329	1144	759	759
query77	405	410	341	341
query78	12395	12509	11950	11950
query79	1537	1015	741	741
query80	1352	538	469	469
query81	501	291	246	246
query82	1336	160	127	127
query83	358	270	248	248
query84	253	140	115	115
query85	944	537	466	466
query86	462	366	311	311
query87	3431	3365	3221	3221
query88	3646	2746	2759	2746
query89	457	394	347	347
query90	1909	181	179	179
query91	179	173	141	141
query92	78	75	76	75
query93	1518	1482	945	945
query94	714	367	311	311
query95	685	465	344	344
query96	1059	776	383	383
query97	2756	2730	2647	2647
query98	239	230	242	230
query99	1155	1177	1042	1042
Total cold run time: 255577 ms
Total hot run time: 171293 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 29489 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit bdd4a1b5a8fe4a5b5a70f750428cc59e1782ec32, 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	17672	4020	4015	4015
q2	q3	10782	1448	823	823
q4	4684	483	343	343
q5	7533	891	598	598
q6	189	177	142	142
q7	776	855	635	635
q8	9443	1719	1611	1611
q9	6251	4562	4498	4498
q10	6799	1858	1564	1564
q11	424	282	243	243
q12	631	423	292	292
q13	18111	3383	2791	2791
q14	263	271	240	240
q15	q16	817	777	716	716
q17	956	951	914	914
q18	7163	5834	5570	5570
q19	1327	1287	1115	1115
q20	510	401	274	274
q21	6432	2953	2775	2775
q22	458	366	330	330
Total cold run time: 101221 ms
Total hot run time: 29489 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	4984	4808	4795	4795
q2	q3	4940	5517	4686	4686
q4	2141	2228	1392	1392
q5	4796	4836	4788	4788
q6	232	175	125	125
q7	1871	1796	1610	1610
q8	2455	2104	2167	2104
q9	7911	7684	7377	7377
q10	4737	4690	4206	4206
q11	538	382	355	355
q12	740	742	522	522
q13	3069	3349	2749	2749
q14	268	284	250	250
q15	q16	681	692	604	604
q17	1291	1266	1250	1250
q18	7412	6973	6760	6760
q19	1122	1137	1085	1085
q20	2218	2210	1943	1943
q21	5298	4593	4477	4477
q22	512	459	415	415
Total cold run time: 57216 ms
Total hot run time: 51493 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4363	638	473	473
query6	455	205	180	180
query7	4940	581	332	332
query8	373	218	228	218
query9	8752	4102	4074	4074
query10	459	325	266	266
query11	5939	2382	2219	2219
query12	158	102	100	100
query13	1277	605	425	425
query14	6443	5525	5094	5094
query14_1	4444	4419	4397	4397
query15	210	204	179	179
query16	1046	466	462	462
query17	1148	720	581	581
query18	2558	499	364	364
query19	214	190	152	152
query20	115	113	108	108
query21	216	143	120	120
query22	13645	13793	13478	13478
query23	17351	16459	16248	16248
query23_1	16377	16295	16317	16295
query24	7544	1790	1327	1327
query24_1	1342	1339	1334	1334
query25	581	464	412	412
query26	1315	320	179	179
query27	2651	572	339	339
query28	4466	2046	2011	2011
query29	1083	625	515	515
query30	323	231	201	201
query31	1124	1083	971	971
query32	109	67	63	63
query33	526	349	273	273
query34	1248	1151	662	662
query35	750	784	686	686
query36	1403	1411	1229	1229
query37	157	107	89	89
query38	3210	3142	3066	3066
query39	941	924	899	899
query39_1	883	878	891	878
query40	215	121	99	99
query41	64	63	61	61
query42	95	96	93	93
query43	322	328	275	275
query44	
query45	197	195	174	174
query46	1135	1215	738	738
query47	2408	2388	2252	2252
query48	396	417	278	278
query49	630	470	354	354
query50	965	360	257	257
query51	4539	4350	4262	4262
query52	89	88	77	77
query53	238	277	190	190
query54	280	230	193	193
query55	81	75	69	69
query56	235	218	225	218
query57	1450	1418	1331	1331
query58	255	214	209	209
query59	1552	1664	1508	1508
query60	292	259	234	234
query61	159	161	157	157
query62	699	648	564	564
query63	229	188	193	188
query64	2527	806	617	617
query65	
query66	1745	462	342	342
query67	29818	29760	29715	29715
query68	
query69	415	303	265	265
query70	979	973	965	965
query71	287	221	216	216
query72	3005	2701	2433	2433
query73	859	816	459	459
query74	5101	4986	4775	4775
query75	2672	2592	2247	2247
query76	2344	1166	774	774
query77	356	380	289	289
query78	12427	12404	11920	11920
query79	1452	1020	738	738
query80	623	490	387	387
query81	460	275	245	245
query82	585	157	124	124
query83	318	278	244	244
query84	265	143	118	118
query85	920	557	455	455
query86	374	288	293	288
query87	3431	3360	3187	3187
query88	3631	2765	2769	2765
query89	440	382	326	326
query90	1933	185	187	185
query91	178	169	137	137
query92	69	59	57	57
query93	1443	1395	854	854
query94	572	359	329	329
query95	686	375	348	348
query96	1005	797	308	308
query97	2714	2724	2559	2559
query98	221	208	202	202
query99	1177	1186	1035	1035
Total cold run time: 252247 ms
Total hot run time: 170648 ms

@Gabriel39 Gabriel39 merged commit 4db157e into apache:master Jun 2, 2026
34 checks passed
Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Jun 2, 2026
### What problem does this PR solve?

Issue Number: close apache#63972

Related PR: apache#63972

Problem Summary: Iceberg data location resolution skipped the legacy object-store.path property and fell back directly to write.folder-storage.path or table location when write.data.path was not set. This could choose the wrong data location for tables that still rely on object-store.path. This change keeps write.data.path as the highest priority, then checks object-store.path before write.folder-storage.path and the default table data directory.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - Ran git diff --check and git diff --cached --check. FE unit test org.apache.doris.datasource.iceberg.IcebergUtilsTest could not run because local JAVA_HOME points to JDK 11 and JDK_17 is not set.
- Behavior changed: No
- Does this need documentation: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants