diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup index e4111d53d4..d157bb9bb7 100644 --- a/fe/fe-core/src/main/cup/sql_parser.cup +++ b/fe/fe-core/src/main/cup/sql_parser.cup @@ -4859,8 +4859,6 @@ type ::= {: RESULT = ScalarType.createVarcharType(-1); :} | KW_ARRAY LESSTHAN type:value_type GREATERTHAN {: RESULT = new ArrayType(value_type); :} - | KW_ARRAY LESSTHAN KW_NOT_NULL LPAREN type:value_type RPAREN GREATERTHAN - {: RESULT = new ArrayType(value_type, false); :} | KW_MAP LESSTHAN type:key_type COMMA type:value_type GREATERTHAN {: RESULT = new MapType(key_type,value_type); :} | KW_STRUCT LESSTHAN struct_field_list:fields GREATERTHAN diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java index 5a6bc2bd09..cf2162c687 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java @@ -34,13 +34,13 @@ import java.util.List; public class ArrayLiteral extends LiteralExpr { public ArrayLiteral() { - type = new ArrayType(Type.NULL, false); + type = new ArrayType(Type.NULL); children = new ArrayList<>(); } public ArrayLiteral(LiteralExpr... exprs) throws AnalysisException { Type itemType = Type.NULL; - boolean containsNull = false; + boolean containsNull = true; for (LiteralExpr expr : exprs) { if (itemType == Type.NULL) { itemType = expr.getType(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java index 8d4db06794..8518052a77 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java @@ -1222,7 +1222,8 @@ public class FunctionCallExpr extends Expr { if (this.type instanceof ArrayType) { ArrayType arrayType = (ArrayType) type; - boolean containsNull = false; + // Now Array type do not support ARRAY, set it too true temporarily + boolean containsNull = true; for (Expr child : children) { Type childType = child.getType(); if (childType instanceof ArrayType) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java index 3475f1d238..ef491c9d7c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java @@ -41,7 +41,7 @@ public class ArrayType extends Type { public ArrayType() { itemType = NULL; - containsNull = false; + containsNull = true; } public ArrayType(Type itemType) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java index 870c469784..89abbbbe20 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java @@ -569,10 +569,5 @@ public class CreateTableTest { createTable("create table test.table2(k1 INT, k2 Array>) duplicate key (k1) " + "distributed by hash(k1) buckets 1 properties('replication_num' = '1');"); }); - - ExceptionChecker.expectThrowsNoException(() -> { - createTable("create table test.table3(k1 INT, k2 Array) duplicate key (k1) " - + "distributed by hash(k1) buckets 1 properties('replication_num' = '1');"); - }); } }