This is an automated email from the ASF dual-hosted git repository.
morningman 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 78cb4a8f56 [BugFix](backup) fix show backup with where clause (#17736)
78cb4a8f56 is described below
commit 78cb4a8f56ba69f84022ef802122a6667ba06db8
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 87a2f9335f..bb81e896bd 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 e7a6c4fa57..aadc9129a0 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
@@ -1860,7 +1860,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]