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/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 1fc6ee1  [Config] Add config to support long table name (#6501)
1fc6ee1 is described below

commit 1fc6ee159739a458542055345110963fa65b5e7c
Author: ikaruga <[email protected]>
AuthorDate: Tue Sep 7 11:52:07 2021 +0800

    [Config] Add config to support long table name (#6501)
    
    Support length of table name large than 64
---
 fe/fe-core/src/main/java/org/apache/doris/common/Config.java       | 3 +++
 fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/Config.java
index fe1d107..c958ab7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/Config.java
@@ -1496,4 +1496,7 @@ public class Config extends ConfigBase {
      */
     @ConfField(masterOnly = true)
     public static int lower_case_table_names = 0;
+
+    @ConfField(mutable = true, masterOnly = true)
+    public static int table_name_length_limit = 64;
 }
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 327f21a..002636e 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
@@ -26,6 +26,7 @@ import com.google.common.base.Strings;
 public class FeNameFormat {
     private static final String LABEL_REGEX = "^[-_A-Za-z0-9]{1,128}$";
     private static final String COMMON_NAME_REGEX = 
"^[a-zA-Z][a-zA-Z0-9_]{0,63}$";
+    private static final String COMMON_TABLE_NAME_REGEX = 
"^[a-zA-Z][a-zA-Z0-9_]*$";
     private static final String COLUMN_NAME_REGEX = 
"^[_a-zA-Z@][a-zA-Z0-9_]{0,63}$";
 
     public static final String FORBIDDEN_PARTITION_NAME = "placeholder_";
@@ -46,7 +47,9 @@ public class FeNameFormat {
     }
 
     public static void checkTableName(String tableName) throws 
AnalysisException {
-        if (Strings.isNullOrEmpty(tableName) || 
!tableName.matches(COMMON_NAME_REGEX)) {
+        if (Strings.isNullOrEmpty(tableName)
+                || !tableName.matches(COMMON_TABLE_NAME_REGEX)
+                || tableName.length() >= Config.table_name_length_limit) {
             
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_TABLE_NAME, tableName);
         }
     }
@@ -75,7 +78,7 @@ public class FeNameFormat {
             throw new AnalysisException("Label format error. regex: " + 
LABEL_REGEX + ", label: " + label);
         }
     }
-    
+
     public static void checkUserName(String userName) throws AnalysisException 
{
         if (Strings.isNullOrEmpty(userName) || 
!userName.matches(COMMON_NAME_REGEX)) {
             throw new AnalysisException("invalid user name: " + userName);

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to