This is an automated email from the ASF dual-hosted git repository. liaoxin pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 9c9827b92e9 [chore](routine load) make error msg clear if routine load name illegal (#40037) (#40510) 9c9827b92e9 is described below commit 9c9827b92e92439876b97d4ba9b4a8a70d333d81 Author: hui lai <1353307...@qq.com> AuthorDate: Mon Sep 9 15:47:18 2024 +0800 [chore](routine load) make error msg clear if routine load name illegal (#40037) (#40510) pick (#40037) --- .../doris/analysis/CreateRoutineLoadStmt.java | 9 ++++- .../java/org/apache/doris/common/FeNameFormat.java | 2 + .../routine_load/test_routine_load_name.groovy | 43 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java index fb794bfa7b3..28d93e7b8ba 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java @@ -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. diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java b/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java index 922edd99d2f..bbc83ee330d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java @@ -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-_]*$"; diff --git a/regression-test/suites/load_p0/routine_load/test_routine_load_name.groovy b/regression-test/suites/load_p0/routine_load/test_routine_load_name.groovy new file mode 100644 index 00000000000..2aeba89827f --- /dev/null +++ b/regression-test/suites/load_p0/routine_load/test_routine_load_name.groovy @@ -0,0 +1,43 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_routine_load_name","p0") { + String kafka_port = context.config.otherConfigs.get("kafka_port") + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") + try { + sql """ + CREATE ROUTINE LOAD test_routine_load_name_too_much_filler_filler_filler_filler_filler_filler_filler + COLUMNS TERMINATED BY "|" + PROPERTIES + ( + "max_batch_interval" = "5", + "max_batch_rows" = "300000", + "max_batch_size" = "209715200" + ) + FROM KAFKA + ( + "kafka_broker_list" = "${externalEnvIp}:${kafka_port}", + "kafka_topic" = "multi_table_load_invalid_table", + "property.kafka_default_offsets" = "OFFSET_BEGINNING" + ); + """ + } catch (Exception e) { + log.info("exception: ${e.toString()}".toString()) + assertEquals(e.toString().contains("Incorrect ROUTINE LOAD NAME name"), true) + assertEquals(e.toString().contains("Maybe routine load job name is longer than 64 or contains illegal characters"), true) + } +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org