[chore](routine load) make error msg clear if routine load name illegal (#40037) (#40510)

pick (#40037)
This commit is contained in:
hui lai
2024-09-09 15:47:18 +08:00
committed by GitHub
parent 314f6ae823
commit 9c9827b92e
3 changed files with 53 additions and 1 deletions

View File

@ -347,7 +347,14 @@ public class CreateRoutineLoadStmt extends DdlStmt {
// check dbName and tableName
checkDBTable(analyzer);
// check name
FeNameFormat.checkCommonName(NAME_TYPE, name);
try {
FeNameFormat.checkCommonName(NAME_TYPE, name);
} catch (AnalysisException e) {
// 64 is the length of regular expression matching
// (FeNameFormat.COMMON_NAME_REGEX/UNDERSCORE_COMMON_NAME_REGEX)
throw new AnalysisException(e.getMessage()
+ " Maybe routine load job name is longer than 64 or contains illegal characters");
}
// check load properties include column separator etc.
checkLoadProperties();
// check routine load job properties include desired concurrent number etc.

View File

@ -29,6 +29,8 @@ import com.google.common.base.Strings;
public class FeNameFormat {
private static final String LABEL_REGEX = "^[-_A-Za-z0-9:]{1," + Config.label_regex_length + "}$";
// if modify the matching length of a regular expression,
// please modify error msg when FeNameFormat.checkCommonName throw exception in CreateRoutineLoadStmt
private static final String COMMON_NAME_REGEX = "^[a-zA-Z][a-zA-Z0-9-_]{0,63}$";
private static final String UNDERSCORE_COMMON_NAME_REGEX = "^[_a-zA-Z][a-zA-Z0-9-_]{0,63}$";
private static final String TABLE_NAME_REGEX = "^[a-zA-Z][a-zA-Z0-9-_]*$";