This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new c15da4285d7 Backport #63972 branch 4.1 (#64260)
c15da4285d7 is described below
commit c15da4285d789e6ea7ea78a6451e286d96725987
Author: Gabriel <[email protected]>
AuthorDate: Wed Jun 17 12:02:50 2026 +0800
Backport #63972 branch 4.1 (#64260)
#63972
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
.../java/org/apache/doris/common/PatternMatcher.java | 11 +++++++----
.../java/org/apache/doris/common/PatternMatcherTest.java | 4 ++++
.../apache/doris/service/FrontendServiceImplTest.java | 16 ++++++++++++++++
3 files changed, 27 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 dc9e25158f2..36eb1bcf28e 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;
@@ -147,6 +149,20 @@ 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 {
String createOlapTblStmt = new String("CREATE TABLE
test.partition_range(\n"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]