[bugfix](load) fix cancel load stmt cannot recognize key words in upper case (#11906)
This commit is contained in:
@ -23,10 +23,10 @@ import org.apache.doris.common.AnalysisException;
|
||||
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 @@ import java.util.List;
|
||||
**/
|
||||
public class CancelLoadStmt extends DdlStmt {
|
||||
|
||||
private static final List<String> SUPPORT_COLUMNS = Lists.newArrayList("label", "state");
|
||||
private static final Set<String> 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 {
|
||||
|
||||
@ -67,6 +67,14 @@ public class CancelLoadStmtTest extends TestWithFeService {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user