[fix](array-type) Forbid ARRAY<NOT_NULL(T)> temporarily (#12262)
Currently, there are still lots of bugs related to ARRAY<NOT_NULL(T)>. We decide that we don't support ARRAY<NOT_NULL(T)> types at the first version and all elements in ARRAY are nullable. Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
This commit is contained in:
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<NOT_NULL>, set it too true temporarily
|
||||
boolean containsNull = true;
|
||||
for (Expr child : children) {
|
||||
Type childType = child.getType();
|
||||
if (childType instanceof ArrayType) {
|
||||
|
||||
@ -41,7 +41,7 @@ public class ArrayType extends Type {
|
||||
|
||||
public ArrayType() {
|
||||
itemType = NULL;
|
||||
containsNull = false;
|
||||
containsNull = true;
|
||||
}
|
||||
|
||||
public ArrayType(Type itemType) {
|
||||
|
||||
@ -569,10 +569,5 @@ public class CreateTableTest {
|
||||
createTable("create table test.table2(k1 INT, k2 Array<Array<int>>) duplicate key (k1) "
|
||||
+ "distributed by hash(k1) buckets 1 properties('replication_num' = '1');");
|
||||
});
|
||||
|
||||
ExceptionChecker.expectThrowsNoException(() -> {
|
||||
createTable("create table test.table3(k1 INT, k2 Array<not_null(int)>) duplicate key (k1) "
|
||||
+ "distributed by hash(k1) buckets 1 properties('replication_num' = '1');");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user