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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 1783dbf  [UT] Fix list partition UT failure (#5705)
1783dbf is described below

commit 1783dbf34083b9407b79a76ce7217c91380ec575
Author: Mingyu Chen <morningman....@gmail.com>
AuthorDate: Mon Apr 26 09:31:35 2021 +0800

    [UT] Fix list partition UT failure (#5705)
---
 .../apache/doris/analysis/PartitionKeyDesc.java    |  1 +
 .../doris/analysis/ListPartitionPrunerTest.java    | 17 ++--
 .../org/apache/doris/catalog/CreateTableTest.java  | 98 +++++++++++-----------
 .../doris/catalog/RangePartitionInfoTest.java      |  2 +-
 .../apache/doris/catalog/TempPartitionTest.java    |  5 +-
 .../org/apache/doris/planner/QueryPlanTest.java    |  4 +-
 6 files changed, 65 insertions(+), 62 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionKeyDesc.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionKeyDesc.java
index 726c333..3237ee2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionKeyDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionKeyDesc.java
@@ -67,6 +67,7 @@ public class PartitionKeyDesc {
         PartitionKeyDesc desc = new PartitionKeyDesc();
         desc.lowerValues = lowerValues;
         desc.upperValues = upperValues;
+        desc.partitionKeyValueType = PartitionKeyValueType.FIXED;
         return desc;
     }
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/ListPartitionPrunerTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/ListPartitionPrunerTest.java
index e1cc577..4c4154f 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/ListPartitionPrunerTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/ListPartitionPrunerTest.java
@@ -21,6 +21,7 @@ import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
 import org.apache.doris.utframe.DorisAssert;
 import org.apache.doris.utframe.UtFrameUtils;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -48,8 +49,8 @@ public class ListPartitionPrunerTest {
         UtFrameUtils.createMinDorisCluster(runningDir);
 
         String createSinglePartColWithSinglePartKey = "create table test.t1\n"
-                + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                +"partition by list(k1)\n"
+                + "(k1 int not null, k2 varchar(128), k3 int, v1 int, v2 
int)\n"
+                + "partition by list(k1)\n"
                 + "(\n"
                 + "partition p1 values in (\"1\"),\n"
                 + "partition p2 values in (\"2\")\n"
@@ -57,8 +58,8 @@ public class ListPartitionPrunerTest {
                 + "distributed by hash(k2) buckets 1\n"
                 + "properties('replication_num' = '1');";
         String createSinglePartColWithMultiPartKey = "create table test.t2\n"
-                + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                +"partition by list(k1)\n"
+                + "(k1 int not null, k2 varchar(128), k3 int, v1 int, v2 
int)\n"
+                + "partition by list(k1)\n"
                 + "(\n"
                 + "partition p1 values in (\"1\", \"3\", \"5\"),\n"
                 + "partition p2 values in (\"2\", \"4\", \"6\"),\n"
@@ -67,8 +68,8 @@ public class ListPartitionPrunerTest {
                 + "distributed by hash(k2) buckets 1\n"
                 + "properties('replication_num' = '1');";
         String createMultiPartColWithSinglePartKey = "create table test.t3\n"
-                + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                +"partition by list(k1, k2)\n"
+                + "(k1 int not null, k2 varchar(128) not null, k3 int, v1 int, 
v2 int)\n"
+                + "partition by list(k1, k2)\n"
                 + "(\n"
                 + "partition p1 values in ((\"1\", \"beijing\")),\n"
                 + "partition p2 values in ((\"2\", \"beijing\"))\n"
@@ -76,8 +77,8 @@ public class ListPartitionPrunerTest {
                 + "distributed by hash(k2) buckets 1\n"
                 + "properties('replication_num' = '1');";
         String createMultiPartColWithMultiPartKey = "create table test.t4\n"
-                + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                +"partition by list(k1, k2)\n"
+                + "(k1 int not null, k2 varchar(128) not null, k3 int, v1 int, 
v2 int)\n"
+                + "partition by list(k1, k2)\n"
                 + "(\n"
                 + "partition p1 values in ((\"1\", \"beijing\"), (\"2\", 
\"shanghai\")),\n"
                 + "partition p2 values in ((\"2\", \"beijing\")),\n"
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 4aec3be..2ebbc40 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
@@ -149,8 +149,8 @@ public class CreateTableTest {
         // single partition column with single key
         ExceptionChecker
                 .expectThrowsNoException(() -> createTable("create table 
test.tbl9\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1)\n"
+                        + "(k1 int not null, k2 varchar(128), k3 int, v1 int, 
v2 int)\n"
+                        + "partition by list(k1)\n"
                         + "(\n"
                         + "partition p1 values in (\"1\"),\n"
                         + "partition p2 values in (\"2\")\n"
@@ -161,8 +161,8 @@ public class CreateTableTest {
         // single partition column with multi keys
         ExceptionChecker
                 .expectThrowsNoException(() -> createTable("create table 
test.tbl10\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1)\n"
+                        + "(k1 int not null, k2 varchar(128), k3 int, v1 int, 
v2 int)\n"
+                        + "partition by list(k1)\n"
                         + "(\n"
                         + "partition p1 values in (\"1\", \"3\", \"5\"),\n"
                         + "partition p2 values in (\"2\", \"4\", \"6\"),\n"
@@ -174,8 +174,8 @@ public class CreateTableTest {
         // multi partition columns with single key
         ExceptionChecker
                 .expectThrowsNoException(() -> createTable("create table 
test.tbl11\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1, k2)\n"
+                        + "(k1 int not null, k2 varchar(128) not null, k3 int, 
v1 int, v2 int)\n"
+                        + "partition by list(k1, k2)\n"
                         + "(\n"
                         + "partition p1 values in ((\"1\", \"beijing\")),\n"
                         + "partition p2 values in ((\"2\", \"beijing\"))\n"
@@ -186,8 +186,8 @@ public class CreateTableTest {
         // multi partition columns with multi keys
         ExceptionChecker
                 .expectThrowsNoException(() -> createTable("create table 
test.tbl12\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1, k2)\n"
+                        + "(k1 int not null, k2 varchar(128) not null, k3 int, 
v1 int, v2 int)\n"
+                        + "partition by list(k1, k2)\n"
                         + "(\n"
                         + "partition p1 values in ((\"1\", \"beijing\"), 
(\"1\", \"shanghai\")),\n"
                         + "partition p2 values in ((\"2\", \"beijing\"), 
(\"2\", \"shanghai\")),\n"
@@ -282,8 +282,8 @@ public class CreateTableTest {
         // single partition column with single key
         ExceptionChecker
                 .expectThrowsWithMsg(AnalysisException.class, "Syntax error", 
() -> createTable("create table test.tbl9\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1)\n"
+                        + "(k1 int not null, k2 varchar(128), k3 int, v1 int, 
v2 int)\n"
+                        + "partition by list(k1)\n"
                         + "(\n"
                         + "partition p1 values in (\"1\"),\n"
                         + "partition p2 values in ()\n"
@@ -295,56 +295,56 @@ public class CreateTableTest {
         ExceptionChecker
                 .expectThrowsWithMsg(IllegalArgumentException.class, 
"partition key desc list size[2] is not equal to partition column size[1]",
                         () -> createTable("create table test.tbl10\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1)\n"
-                        + "(\n"
-                        + "partition p1 values in (\"1\", \"3\", \"5\"),\n"
-                        + "partition p2 values in (\"2\", \"4\", \"6\"),\n"
-                        + "partition p3 values in ((\"7\", \"8\"))\n"
-                        + ")\n"
-                        + "distributed by hash(k2) buckets 1\n"
-                        + "properties('replication_num' = '1');"));
+                                + "(k1 int not null, k2 varchar(128), k3 int, 
v1 int, v2 int)\n"
+                                + "partition by list(k1)\n"
+                                + "(\n"
+                                + "partition p1 values in (\"1\", \"3\", 
\"5\"),\n"
+                                + "partition p2 values in (\"2\", \"4\", 
\"6\"),\n"
+                                + "partition p3 values in ((\"7\", \"8\"))\n"
+                                + ")\n"
+                                + "distributed by hash(k2) buckets 1\n"
+                                + "properties('replication_num' = '1');"));
 
         // multi partition columns with single key
         ExceptionChecker
                 .expectThrowsWithMsg(IllegalArgumentException.class, 
"partition key desc list size[1] is not equal to partition column size[2]",
                         () -> createTable("create table test.tbl11\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1, k2)\n"
-                        + "(\n"
-                        + "partition p1 values in ((\"1\", \"beijing\")),\n"
-                        + "partition p2 values in (\"2\", \"beijing\")\n"
-                        + ")\n"
-                        + "distributed by hash(k2) buckets 1\n"
-                        + "properties('replication_num' = '1');"));
+                                + "(k1 int not null, k2 varchar(128) not null, 
k3 int, v1 int, v2 int)\n"
+                                + "partition by list(k1, k2)\n"
+                                + "(\n"
+                                + "partition p1 values in ((\"1\", 
\"beijing\")),\n"
+                                + "partition p2 values in (\"2\", 
\"beijing\")\n"
+                                + ")\n"
+                                + "distributed by hash(k2) buckets 1\n"
+                                + "properties('replication_num' = '1');"));
 
         // multi partition columns with multi keys
         ExceptionChecker
                 .expectThrowsWithMsg(IllegalArgumentException.class, 
"partition key desc list size[3] is not equal to partition column size[2]",
                         () -> createTable("create table test.tbl12\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1, k2)\n"
-                        + "(\n"
-                        + "partition p1 values in ((\"1\", \"beijing\"), 
(\"1\", \"shanghai\")),\n"
-                        + "partition p2 values in ((\"2\", \"beijing\"), 
(\"2\", \"shanghai\")),\n"
-                        + "partition p3 values in ((\"3\", \"tianjin\", 
\"3\"))\n"
-                        + ")\n"
-                        + "distributed by hash(k2) buckets 1\n"
-                        + "properties('replication_num' = '1');"));
+                                + "(k1 int not null, k2 varchar(128) not null, 
k3 int, v1 int, v2 int)\n"
+                                + "partition by list(k1, k2)\n"
+                                + "(\n"
+                                + "partition p1 values in ((\"1\", 
\"beijing\"), (\"1\", \"shanghai\")),\n"
+                                + "partition p2 values in ((\"2\", 
\"beijing\"), (\"2\", \"shanghai\")),\n"
+                                + "partition p3 values in ((\"3\", 
\"tianjin\", \"3\"))\n"
+                                + ")\n"
+                                + "distributed by hash(k2) buckets 1\n"
+                                + "properties('replication_num' = '1');"));
 
         // multi partition columns with multi keys
         ExceptionChecker
                 .expectThrowsWithMsg(AnalysisException.class, "Syntax error",
                         () -> createTable("create table test.tbl13\n"
-                        + "(k1 int, k2 varchar(128), k3 int, v1 int, v2 int)\n"
-                        +"partition by list(k1, k2)\n"
-                        + "(\n"
-                        + "partition p1 values in ((\"1\", \"beijing\"), 
(\"1\", \"shanghai\")),\n"
-                        + "partition p2 values in ((\"2\", \"beijing\"), 
(\"2\", \"shanghai\")),\n"
-                        + "partition p3 values in ()\n"
-                        + ")\n"
-                        + "distributed by hash(k2) buckets 1\n"
-                        + "properties('replication_num' = '1');"));
+                                + "(k1 int not null, k2 varchar(128) not null, 
k3 int, v1 int, v2 int)\n"
+                                + "partition by list(k1, k2)\n"
+                                + "(\n"
+                                + "partition p1 values in ((\"1\", 
\"beijing\"), (\"1\", \"shanghai\")),\n"
+                                + "partition p2 values in ((\"2\", 
\"beijing\"), (\"2\", \"shanghai\")),\n"
+                                + "partition p3 values in ()\n"
+                                + ")\n"
+                                + "distributed by hash(k2) buckets 1\n"
+                                + "properties('replication_num' = '1');"));
 
         /**
          * create table with both list and range partition
@@ -353,7 +353,7 @@ public class CreateTableTest {
         ExceptionChecker
                 .expectThrowsWithMsg(AnalysisException.class, "You can only 
use in values to create list partitions",
                         () -> createTable("CREATE TABLE test.tbl14 (\n" +
-                                "    k1 int, k2 varchar(128), k3 int, v1 int, 
v2 int\n" +
+                                "    k1 int not null, k2 varchar(128), k3 int, 
v1 int, v2 int\n" +
                                 ")\n" +
                                 "PARTITION BY LIST(k1)\n" +
                                 "(\n" +
@@ -381,7 +381,7 @@ public class CreateTableTest {
         ExceptionChecker
                 .expectThrowsWithMsg(AnalysisException.class, "You can only 
use in values to create list partitions",
                         () -> createTable("CREATE TABLE test.tbl15 (\n" +
-                                "    k1 int, k2 varchar(128), k3 int, v1 int, 
v2 int\n" +
+                                "    k1 int not null, k2 varchar(128), k3 int, 
v1 int, v2 int\n" +
                                 ")\n" +
                                 "PARTITION BY LIST(k1)\n" +
                                 "(\n" +
@@ -423,7 +423,7 @@ public class CreateTableTest {
         ExceptionChecker
                 .expectThrowsWithMsg(DdlException.class, "Invalid number 
format: beijing",
                         () -> createTable("CREATE TABLE test.tbl18 (\n" +
-                                "    k1 int, k2 varchar(128), k3 int, v1 int, 
v2 int\n" +
+                                "    k1 int not null, k2 varchar(128), k3 int, 
v1 int, v2 int\n" +
                                 ")\n" +
                                 "PARTITION BY list(k1)\n" +
                                 "(\n" +
@@ -441,7 +441,7 @@ public class CreateTableTest {
                 .expectThrowsWithMsg(DdlException.class, "Only support dynamic 
partition properties on range partition table",
                         () -> createTable("CREATE TABLE test.tbl19\n" +
                                 "(\n" +
-                                "    k1 DATE\n" +
+                                "    k1 DATE not null\n" +
                                 ")\n" +
                                 "PARTITION BY LIST(k1) ()\n" +
                                 "DISTRIBUTED BY HASH(k1)\n" +
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/RangePartitionInfoTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/RangePartitionInfoTest.java
index 2f52178..e5067da 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/RangePartitionInfoTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/RangePartitionInfoTest.java
@@ -206,7 +206,7 @@ public class RangePartitionInfoTest {
                 Lists.newArrayList(new PartitionValue("2019-02-01"), new 
PartitionValue("100"), new PartitionValue("200")));
         PartitionKeyDesc p2 = PartitionKeyDesc.createFixed(
                 Lists.newArrayList(new PartitionValue("2020-02-01"), new 
PartitionValue("100"), new PartitionValue("200")),
-                Lists.newArrayList(new PartitionValue("10000000000")));
+                Lists.newArrayList(new PartitionValue("2020-03-01")));
         PartitionKeyDesc p3 = PartitionKeyDesc.createLessThan(
                 Lists.newArrayList(new PartitionValue("2021-02-01")));
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/TempPartitionTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/TempPartitionTest.java
index 88fce47..268ef36 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/TempPartitionTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/TempPartitionTest.java
@@ -572,7 +572,7 @@ public class TempPartitionTest {
         System.out.println(Catalog.getCurrentCatalog().getDbNames());
 
         // create table tbl4
-        String createTblStmtStr1 = "create table db4.tbl4 (k1 int, k2 int)\n" +
+        String createTblStmtStr1 = "create table db4.tbl4 (k1 int not null, k2 
int)\n" +
                 "partition by list(k1)\n" +
                 "(\n" +
                 "partition p1 values in ('1', '2', '3'),\n" +
@@ -896,6 +896,7 @@ public class TempPartitionTest {
         stmtStr = "alter table db4.tbl4 replace partition (tp1) with temporary 
partition (p4) properties('strict_range' = 'false');";
         alterTable(stmtStr, true);
     }
+
     @Test
     public void testForMultiListPartitionTable() throws Exception {
         MetaContext metaContext = new MetaContext();
@@ -909,7 +910,7 @@ public class TempPartitionTest {
         System.out.println(Catalog.getCurrentCatalog().getDbNames());
 
         // create table tbl5
-        String createTblStmtStr1 = "create table db5.tbl5 (k1 int, k2 
varchar)\n" +
+        String createTblStmtStr1 = "create table db5.tbl5 (k1 int not null, k2 
varchar not null)\n" +
                 "partition by list(k1, k2)\n" +
                 "(\n" +
                 "partition p1 values in ((\"1\",\"beijing\"), (\"1\", 
\"shanghai\")),\n" +
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index e979c0c..2f1bb8f 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -43,14 +43,14 @@ import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.QueryState.MysqlStateType;
 import org.apache.doris.utframe.UtFrameUtils;
 
+import com.google.common.collect.Lists;
+
 import org.apache.commons.lang3.StringUtils;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.google.common.collect.Lists;
-
 import java.io.File;
 import java.util.List;
 import java.util.UUID;

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

Reply via email to