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

morningman 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 f4aa7873c6 [branch-1.2] fix some ut and forbit array in unique key 
table (#18532)
f4aa7873c6 is described below

commit f4aa7873c64896945c5231f79dfe9f12e04f79ad
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Mon Apr 10 22:59:07 2023 +0800

    [branch-1.2] fix some ut and forbit array in unique key table (#18532)
    
    1. Forbid array type in unique key table
    2. Fix some unit test and regression test
---
 be/test/exprs/string_functions_test.cpp             | 21 ---------------------
 .../org/apache/doris/analysis/CreateTableStmt.java  |  4 ++++
 .../data/query_p0/show/test_show_create_table.out   |  2 +-
 .../sql_functions/test_alias_function.groovy        |  2 +-
 4 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/be/test/exprs/string_functions_test.cpp 
b/be/test/exprs/string_functions_test.cpp
index 89c58ecfb3..231e9a8844 100644
--- a/be/test/exprs/string_functions_test.cpp
+++ b/be/test/exprs/string_functions_test.cpp
@@ -129,27 +129,6 @@ TEST_F(StringFunctionsTest, money_format_double) {
     delete context;
 }
 
-TEST_F(StringFunctionsTest, money_format_decimal_v2) {
-    doris_udf::FunctionContext* context = new doris_udf::FunctionContext();
-
-    DecimalV2Value dv1(std::string("3333333333.2222222222"));
-    DecimalV2Val value1;
-    dv1.to_decimal_val(&value1);
-
-    StringVal result = StringFunctions::money_format(context, value1);
-    StringVal expected = AnyValUtil::from_string(ctx, 
std::string("3,333,333,333.22"));
-    EXPECT_EQ(expected, result);
-
-    DecimalV2Value dv2(std::string("-740740740.71604938271975308642"));
-    DecimalV2Val value2;
-    dv2.to_decimal_val(&value2);
-
-    result = StringFunctions::money_format(context, value2);
-    expected = AnyValUtil::from_string(ctx, std::string("-740,740,740.72"));
-    EXPECT_EQ(expected, result);
-    delete context;
-}
-
 TEST_F(StringFunctionsTest, split_part) {
     doris_udf::FunctionContext* context = new doris_udf::FunctionContext();
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
index 805e366bc9..d68a80f3da 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
@@ -438,6 +438,9 @@ public class CreateTableStmt extends DdlStmt {
             columnDef.analyze(engineName.equals("olap"));
 
             if (columnDef.getType().isArrayType() && 
engineName.equals("olap")) {
+                if (keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
+                    throw new AnalysisException("Array column can't be used in 
unique table");
+                }
                 if (columnDef.getAggregateType() != null && 
columnDef.getAggregateType() != AggregateType.NONE) {
                     throw new AnalysisException("Array column can't support 
aggregation "
                             + columnDef.getAggregateType());
@@ -675,3 +678,4 @@ public class CreateTableStmt extends DdlStmt {
         return !engineName.equals("olap");
     }
 }
+
diff --git a/regression-test/data/query_p0/show/test_show_create_table.out 
b/regression-test/data/query_p0/show/test_show_create_table.out
index cc64b17c40..8f476d5b25 100644
--- a/regression-test/data/query_p0/show/test_show_create_table.out
+++ b/regression-test/data/query_p0/show/test_show_create_table.out
@@ -1,4 +1,4 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !select --
-tb_show_create_table   CREATE TABLE `tb_show_create_table` (\n  `datek1` date 
NULL COMMENT 'a',\n  `datetimek1` datetime NULL COMMENT 'b',\n  `datetimek2` 
datetime NULL COMMENT 'c',\n  `datetimek3` datetime NULL COMMENT 'd',\n  
`datev1` date MAX NOT NULL COMMENT 'e',\n  `datetimev1` datetime MAX NOT NULL 
COMMENT 'f',\n  `datetimev2` datetime MAX NOT NULL COMMENT 'g',\n  `datetimev3` 
datetime MAX NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nAGGREGATE KEY(`datek1`, 
`datetimek1`, `datetimek2`, `datet [...]
+tb_show_create_table   CREATE TABLE `tb_show_create_table` (\n  `datek1` date 
NULL COMMENT 'a',\n  `datetimek1` datetime NULL COMMENT 'b',\n  `datetimek2` 
datetime NULL COMMENT 'c',\n  `datetimek3` datetime NULL COMMENT 'd',\n  
`datev1` date MAX NOT NULL COMMENT 'e',\n  `datetimev1` datetime MAX NOT NULL 
COMMENT 'f',\n  `datetimev2` datetime MAX NOT NULL COMMENT 'g',\n  `datetimev3` 
datetime MAX NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nAGGREGATE KEY(`datek1`, 
`datetimek1`, `datetimek2`, `datet [...]
 
diff --git 
a/regression-test/suites/query_p0/sql_functions/test_alias_function.groovy 
b/regression-test/suites/query_p0/sql_functions/test_alias_function.groovy
index 4693c79067..5cd25fd694 100644
--- a/regression-test/suites/query_p0/sql_functions/test_alias_function.groovy
+++ b/regression-test/suites/query_p0/sql_functions/test_alias_function.groovy
@@ -28,7 +28,7 @@ suite('test_alias_function') {
             ), '%Y%m%d:%H');'''
 
     test {
-        sql 'select f2(f1(now(3), 2), 3)'
+        sql '''select f2(f1('2023-03-29', 2), 3)'''
         result([['20230327:01']])
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to