This is an automated email from the ASF dual-hosted git repository.
Gabriel39 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 4db157e16fd [fix](fe) Support dollar sign in mysql pattern (#63972)
4db157e16fd is described below
commit 4db157e16fdbea6dbfc44baabf77c7e9d590a709
Author: Gabriel <[email protected]>
AuthorDate: Tue Jun 2 17:55:40 2026 +0800
[fix](fe) Support dollar sign in mysql pattern (#63972)
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.
---
.../main/java/org/apache/doris/common/PatternMatcher.java | 11 +++++++----
.../java/org/apache/doris/common/PatternMatcherTest.java | 4 ++++
.../org/apache/doris/service/FrontendServiceImplTest.java | 15 +++++++++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/common/PatternMatcher.java
b/fe/fe-common/src/main/java/org/apache/doris/common/PatternMatcher.java
index 9f098134023..fddc6caa055 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/PatternMatcher.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/PatternMatcher.java
@@ -35,7 +35,7 @@ public class PatternMatcher {
private boolean caseSensitive;
private static final Set<Character> FORBIDDEN_CHARS = Sets.newHashSet('<',
'(', '[', '{', '^', '=',
- '$',
'!', '|', ']', '}', ')',
+ '!',
'|', ']', '}', ')',
'?',
'*', '+', '>', '@');
public PatternMatcher(Pattern pattern) {
@@ -121,6 +121,9 @@ public class PatternMatcher {
case '.':
sb.append("\\.");
break;
+ case '$':
+ sb.append("\\$");
+ break;
case '_':
sb.append(".");
break;
@@ -166,9 +169,9 @@ public class PatternMatcher {
break;
}
// look ahead
- if (newMysqlPattern.charAt(i + 1) == '.') {
- // leave '\.' as it is.
- sb.append('\\').append('.');
+ if (newMysqlPattern.charAt(i + 1) == '.' ||
newMysqlPattern.charAt(i + 1) == '$') {
+ // leave '\.' and '\$' as it is.
+ sb.append('\\').append(newMysqlPattern.charAt(i + 1));
i++;
break;
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/common/PatternMatcherTest.java
b/fe/fe-core/src/test/java/org/apache/doris/common/PatternMatcherTest.java
index c7eebf224ec..98c3bcae36f 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/common/PatternMatcherTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/common/PatternMatcherTest.java
@@ -98,6 +98,10 @@ public class PatternMatcherTest {
Assert.assertFalse(matcher.match("my-abc-hostabc"));
Assert.assertFalse(matcher.match("abcmy-abc-host"));
Assert.assertTrue(matcher.match("my-%-host"));
+
+ matcher =
PatternMatcher.createMysqlPattern("test_dropped_partition_field$partitions",
false);
+
Assert.assertTrue(matcher.match("test_dropped_partition_field$partitions"));
+
Assert.assertFalse(matcher.match("test_dropped_partition_fieldapartitions"));
} catch (Exception e) {
Assert.fail(e.getMessage());
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
b/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
index a1053eb1e50..5c442974eed 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
@@ -48,6 +48,8 @@ import org.apache.doris.thrift.TFetchSchemaTableDataRequest;
import org.apache.doris.thrift.TFetchSchemaTableDataResult;
import org.apache.doris.thrift.TGetDbsParams;
import org.apache.doris.thrift.TGetDbsResult;
+import org.apache.doris.thrift.TGetTablesParams;
+import org.apache.doris.thrift.TGetTablesResult;
import org.apache.doris.thrift.TGetTabletReplicaInfosRequest;
import org.apache.doris.thrift.TGetTabletReplicaInfosResult;
import org.apache.doris.thrift.TLoadTxnCommitRequest;
@@ -145,6 +147,19 @@ public class FrontendServiceImplTest {
field.set(target, value);
}
+ @Test
+ public void testGetTableNamesWithSysTablePattern() throws Exception {
+ FrontendServiceImpl impl = new FrontendServiceImpl(exeEnv);
+ TGetTablesParams params = new TGetTablesParams();
+ params.setCatalog(InternalCatalog.INTERNAL_CATALOG_NAME);
+ params.setDb("test");
+ params.setPattern("test_dropped_partition_field$partitions");
+
params.setCurrentUserIdent(connectContext.getCurrentUserIdentity().toThrift());
+
+ TGetTablesResult result = impl.getTableNames(params);
+ Assert.assertTrue(result.getTables().isEmpty());
+ }
+
@Test
public void testCreatePartitionRange() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]