This is an automated email from the ASF dual-hosted git repository.
adonisling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 90a0baf5f8 [fix](array-type) Forbid ARRAY<NOT_NULL(T)> temporarily
(#12262)
90a0baf5f8 is described below
commit 90a0baf5f82eb7ffd15d5d389ba760cda2c627ad
Author: camby <[email protected]>
AuthorDate: Sat Sep 3 14:26:08 2022 +0800
[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 <[email protected]>
---
fe/fe-core/src/main/cup/sql_parser.cup | 2 --
fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java | 4 ++--
.../src/main/java/org/apache/doris/analysis/FunctionCallExpr.java | 3 ++-
fe/fe-core/src/main/java/org/apache/doris/catalog/ArrayType.java | 2 +-
.../src/test/java/org/apache/doris/catalog/CreateTableTest.java | 5 -----
5 files changed, 5 insertions(+), 11 deletions(-)
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<NOT_NULL>, 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<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');");
- });
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]