From 5ff4ffdd632c925c57b63b8e405ebf99867e94af Mon Sep 17 00:00:00 2001 From: Zhengguo Yang Date: Thu, 18 Aug 2022 18:19:10 +0800 Subject: [PATCH 1/2] [bugfix](load) fix cancel load stmt cannot recognize key words in upper case --- .../java/org/apache/doris/analysis/CancelLoadStmt.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelLoadStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelLoadStmt.java index 7af21948b5ddff..263b66cf31ab07 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelLoadStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelLoadStmt.java @@ -23,10 +23,10 @@ import org.apache.doris.common.UserException; import com.google.common.base.Strings; -import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import lombok.Getter; -import java.util.List; +import java.util.Set; /** @@ -36,7 +36,7 @@ **/ public class CancelLoadStmt extends DdlStmt { - private static final List SUPPORT_COLUMNS = Lists.newArrayList("label", "state"); + private static final Set SUPPORT_COLUMNS = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER); @Getter private String dbName; @@ -55,6 +55,8 @@ public class CancelLoadStmt extends DdlStmt { public CancelLoadStmt(String dbName, Expr whereClause) { this.dbName = dbName; this.whereClause = whereClause; + this.SUPPORT_COLUMNS.add("label"); + this.SUPPORT_COLUMNS.add("state"); } private void checkColumn(Expr expr, boolean like) throws AnalysisException { From b41532cf7eb23c9ab8d9fb659ef32f88440b6de5 Mon Sep 17 00:00:00 2001 From: Zhengguo Yang Date: Fri, 19 Aug 2022 10:01:49 +0800 Subject: [PATCH 2/2] add unit test --- .../org/apache/doris/analysis/CancelLoadStmtTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelLoadStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelLoadStmtTest.java index 3521a88f442af9..f2e9a39a630263 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelLoadStmtTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelLoadStmtTest.java @@ -67,6 +67,14 @@ public void testNormal() throws UserException { Assertions.assertEquals("CANCEL LOAD FROM default_cluster:testDb WHERE `label` = 'doris_test_label'", stmt.toString()); + SlotRef labelSlotRefUpper = new SlotRef(null, "LABEL"); + BinaryPredicate labelBinaryPredicateUpper = new BinaryPredicate(BinaryPredicate.Operator.EQ, labelSlotRefUpper, + labelStringLiteral); + CancelLoadStmt stmtUpper = new CancelLoadStmt(null, labelBinaryPredicateUpper); + stmtUpper.analyze(analyzer); + Assertions.assertEquals("CANCEL LOAD FROM default_cluster:testDb WHERE `LABEL` = 'doris_test_label'", + stmtUpper.toString()); + BinaryPredicate stateBinaryPredicate = new BinaryPredicate(BinaryPredicate.Operator.EQ, stateSlotRef, stateStringLiteral); stmt = new CancelLoadStmt(null, stateBinaryPredicate);