This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 1ed068a4e2c9bee378654a6c189b4e15cdeb60e4 Author: GoGoWen <[email protected]> AuthorDate: Sun Apr 9 20:11:18 2023 +0800 [BugFix](backup) fix show backup with where clause (#17736) 1 show backup where SnapshotName="xxx"; 2. show backup where SnapshotName like "%XXX%" --- .../org/apache/doris/analysis/ShowBackupStmt.java | 22 +++++++++++----------- .../java/org/apache/doris/qe/ShowExecutor.java | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBackupStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBackupStmt.java index c5adcf45c8..a220517778 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBackupStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBackupStmt.java @@ -47,7 +47,7 @@ public class ShowBackupStmt extends ShowStmt { private String dbName; private final Expr where; private boolean isAccurateMatch; - private String labelValue; + private String snapshotName; public ShowBackupStmt(String dbName, Expr where) { this.dbName = dbName; @@ -81,8 +81,8 @@ public class ShowBackupStmt extends ShowStmt { } boolean valid = analyzeWhereClause(); if (!valid) { - throw new AnalysisException("Where clause should like: LABEL = \"your_label_name\", " - + " or LABEL LIKE \"matcher\""); + throw new AnalysisException("Where clause should like: SnapshotName = \"your_snapshot_name\", " + + " or SnapshotName LIKE \"matcher\""); } } @@ -111,7 +111,7 @@ public class ShowBackupStmt extends ShowStmt { return false; } String leftKey = ((SlotRef) where.getChild(0)).getColumnName(); - if (!"label".equalsIgnoreCase(leftKey)) { + if (!"snapshotname".equalsIgnoreCase(leftKey)) { return false; } @@ -119,8 +119,8 @@ public class ShowBackupStmt extends ShowStmt { if (!(where.getChild(1) instanceof StringLiteral)) { return false; } - labelValue = ((StringLiteral) where.getChild(1)).getStringValue(); - if (Strings.isNullOrEmpty(labelValue)) { + snapshotName = ((StringLiteral) where.getChild(1)).getStringValue(); + if (Strings.isNullOrEmpty(snapshotName)) { return false; } @@ -165,24 +165,24 @@ public class ShowBackupStmt extends ShowStmt { return isAccurateMatch; } - public String getLabelValue() { - return labelValue; + public String getSnapshotName() { + return snapshotName; } public Expr getWhere() { return where; } - public Predicate<String> getLabelPredicate() throws AnalysisException { + public Predicate<String> getSnapshotPredicate() throws AnalysisException { if (null == where) { return label -> true; } if (isAccurateMatch) { return CaseSensibility.LABEL.getCaseSensibility() - ? label -> label.equals(labelValue) : label -> label.equalsIgnoreCase(labelValue); + ? label -> label.equals(snapshotName) : label -> label.equalsIgnoreCase(snapshotName); } else { PatternMatcher patternMatcher = PatternMatcherWrapper.createMysqlPattern( - labelValue, CaseSensibility.LABEL.getCaseSensibility()); + snapshotName, CaseSensibility.LABEL.getCaseSensibility()); return patternMatcher::match; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java index e9a8b45e10..065c69a68e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java @@ -1764,7 +1764,7 @@ public class ShowExecutor { Database db = Env.getCurrentInternalCatalog().getDbOrAnalysisException(showStmt.getDbName()); List<AbstractJob> jobs = Env.getCurrentEnv().getBackupHandler() - .getJobs(db.getId(), showStmt.getLabelPredicate()); + .getJobs(db.getId(), showStmt.getSnapshotPredicate()); List<BackupJob> backupJobs = jobs.stream().filter(job -> job instanceof BackupJob) .map(job -> (BackupJob) job).collect(Collectors.toList()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
