This is an automated email from the ASF dual-hosted git repository.

lide pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new e55d22eb6ee [fix](array) disable ALTER TABLE add ARRAY column into AGG 
table (#52567)
e55d22eb6ee is described below

commit e55d22eb6ee848fff4c63d15598bd066396a884c
Author: camby <[email protected]>
AuthorDate: Tue Jul 1 19:23:39 2025 +0800

    [fix](array) disable ALTER TABLE add ARRAY column into AGG table (#52567)
    
    While create AGG table with ARRAY column, we return an error:
    ```
    > CREATE TABLE `test_v3` (
        ->   `id` varchar(16),
        ->   `v_array` array<string> REPLACE_IF_NOT_NULL NULL
        -> ) ENGINE=OLAP
        -> AGGREGATE KEY(`id`)
        -> DISTRIBUTED BY HASH(`id`) BUCKETS 16
        -> PROPERTIES (
        -> "replication_allocation" = "tag.location.default: 1"
        -> );
    ERROR 1105 (HY000): errCode = 2, detailMessage = Array column can't be used 
in aggregate table
    ```
    
    But we can use ALTER command to add an ARRAY Column, this pr disable
    this case:
    ```
    ALTER TABLE test_v2 ADD COLUMN v2 ARRAY<string> REPLACE_IF_NOT_NULL;
    ```
---
 .../src/main/java/org/apache/doris/common/Config.java       |  6 ++----
 .../java/org/apache/doris/analysis/AddColumnClause.java     | 13 ++++++++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index edb01513626..36e362e6259 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -1386,15 +1386,13 @@ public class Config extends ConfigBase {
     /**
      * Set the maximum number of rows that can be cached
      */
-    @ConfField(mutable = true, masterOnly = false, description = 
{"SQL/Partition Cache可以缓存的最大行数。",
-        "Maximum number of rows that can be cached in SQL/Partition Cache, is 
3000 by default."})
+    @ConfField(mutable = true, masterOnly = false)
     public static int cache_result_max_row_count = 3000;
 
     /**
      * Set the maximum data size that can be cached
      */
-    @ConfField(mutable = true, masterOnly = false, description = 
{"SQL/Partition Cache可以缓存的最大数据大小。",
-        "Maximum data size of rows that can be cached in SQL/Partition Cache, 
is 3000 by default."})
+    @ConfField(mutable = true, masterOnly = false)
     public static int cache_result_max_data_size = 31457280; // 30M
 
     /**
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
index 2d472cd5495..a0468973106 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddColumnClause.java
@@ -73,12 +73,15 @@ public class AddColumnClause extends AlterTableClause {
         if (columnDef == null) {
             throw new AnalysisException("No column definition in add column 
clause.");
         }
+        boolean isAggKey = false;
         if (tableName != null) {
             Table table = 
Env.getCurrentInternalCatalog().getDbOrDdlException(tableName.getDb())
                     .getTableOrDdlException(tableName.getTbl());
-            if (table instanceof OlapTable && ((OlapTable) 
table).getKeysType() == KeysType.AGG_KEYS
-                    && columnDef.getAggregateType() == null) {
-                columnDef.setIsKey(true);
+            if (table instanceof OlapTable && ((OlapTable) 
table).getKeysType() == KeysType.AGG_KEYS) {
+                isAggKey = true;
+                if (columnDef.getAggregateType() == null) {
+                    columnDef.setIsKey(true);
+                }
             }
         }
         columnDef.analyze(true);
@@ -94,6 +97,10 @@ public class AddColumnClause extends AlterTableClause {
             throw new AnalysisException("Cannot add value column[" + 
columnDef.getName() + "] at first");
         }
 
+        if (isAggKey && columnDef.getType().isArrayType()) {
+            throw new AnalysisException("Array column can't be used in 
aggregate table");
+        }
+
         if (Strings.isNullOrEmpty(rollupName)) {
             rollupName = null;
         }


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

Reply via email to