From 091282fc5aa1cd893869dc733c196dc9948b57ef Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 25 Feb 2022 15:46:15 +0800 Subject: [PATCH 1/6] add index test UT --- source/libs/index/src/index_util.c | 5 +++++ source/libs/index/test/utilUT.cc | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/source/libs/index/src/index_util.c b/source/libs/index/src/index_util.c index ecf5e6d36c..fcaab968c2 100644 --- a/source/libs/index/src/index_util.c +++ b/source/libs/index/src/index_util.c @@ -72,6 +72,11 @@ void iUnion(SArray *inters, SArray *final) { if (sz <= 0) { return; } + if (sz == 1) { + taosArrayAddAll(final, taosArrayGetP(inters, 0)); + return; + } + MergeIndex *mi = calloc(sz, sizeof(MergeIndex)); for (int i = 0; i < sz; i++) { SArray *t = taosArrayGetP(inters, i); diff --git a/source/libs/index/test/utilUT.cc b/source/libs/index/test/utilUT.cc index 8954978344..ffa4ead774 100644 --- a/source/libs/index/test/utilUT.cc +++ b/source/libs/index/test/utilUT.cc @@ -201,3 +201,27 @@ TEST_F(UtilEnv, 03union) { iUnion(src, rslt); assert(taosArrayGetSize(rslt) == 9); } +TEST_F(UtilEnv, 04union) { + clearSourceArray(src); + clearFinalArray(rslt); + + uint64_t arr1[] = {1, 4, 5, 6}; + SArray * f = (SArray *)taosArrayGetP(src, 0); + for (int i = 0; i < sizeof(arr1) / sizeof(arr1[0]); i++) { + taosArrayPush(f, &arr1[i]); + } + + uint64_t arr2[] = {7, 8, 10}; + f = (SArray *)taosArrayGetP(src, 1); + for (int i = 0; i < sizeof(arr2) / sizeof(arr2[0]); i++) { + taosArrayPush(f, &arr2[i]); + } + + uint64_t arr3[] = {20, 21, 30, 100}; + f = (SArray *)taosArrayGetP(src, 2); + for (int i = 0; i < sizeof(arr3) / sizeof(arr3[0]); i++) { + taosArrayPush(f, &arr3[i]); + } + iUnion(src, rslt); + assert(taosArrayGetSize(rslt) == 11); +} From d18f00dfee874e96c18e340153b25daff39b24b0 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 26 Feb 2022 19:00:26 +0800 Subject: [PATCH 2/6] make CI/CD happy --- source/libs/index/test/utilUT.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/index/test/utilUT.cc b/source/libs/index/test/utilUT.cc index ffa4ead774..bb06a29b23 100644 --- a/source/libs/index/test/utilUT.cc +++ b/source/libs/index/test/utilUT.cc @@ -222,6 +222,7 @@ TEST_F(UtilEnv, 04union) { for (int i = 0; i < sizeof(arr3) / sizeof(arr3[0]); i++) { taosArrayPush(f, &arr3[i]); } + iUnion(src, rslt); assert(taosArrayGetSize(rslt) == 11); } From 8f3bec53aed1eeed1724f9fc5ecba9d2b0947386 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 26 Feb 2022 19:17:18 +0800 Subject: [PATCH 3/6] make CI/CD happy --- source/libs/index/test/utilUT.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/index/test/utilUT.cc b/source/libs/index/test/utilUT.cc index bb06a29b23..d699f0c53a 100644 --- a/source/libs/index/test/utilUT.cc +++ b/source/libs/index/test/utilUT.cc @@ -217,12 +217,12 @@ TEST_F(UtilEnv, 04union) { taosArrayPush(f, &arr2[i]); } - uint64_t arr3[] = {20, 21, 30, 100}; + uint64_t arr3[] = {20, 21, 30, 100, 120}; f = (SArray *)taosArrayGetP(src, 2); for (int i = 0; i < sizeof(arr3) / sizeof(arr3[0]); i++) { taosArrayPush(f, &arr3[i]); } iUnion(src, rslt); - assert(taosArrayGetSize(rslt) == 11); + assert(taosArrayGetSize(rslt) == 12); } From 84264ce241a7e23391b79eed98414741f497bc3e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 26 Feb 2022 19:21:06 +0800 Subject: [PATCH 4/6] make CI/CD happy --- cmake/cmake.options | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/cmake.options b/cmake/cmake.options index e19c10f6b2..343bc16260 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -47,13 +47,13 @@ option( option( BUILD_WITH_UV "If build with libuv" - ON + OFF ) option( BUILD_WITH_UV_TRANS "If build with libuv_trans " - ON + OFF ) option( From d34402a3ea173acd2a53e6b582058fe34b01945a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 26 Feb 2022 21:17:58 +0800 Subject: [PATCH 5/6] make CI/CD happy --- cmake/cmake.options | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/cmake.options b/cmake/cmake.options index 343bc16260..e19c10f6b2 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -47,13 +47,13 @@ option( option( BUILD_WITH_UV "If build with libuv" - OFF + ON ) option( BUILD_WITH_UV_TRANS "If build with libuv_trans " - OFF + ON ) option( From 2fd2172eebec705d5a732a84f58e16307e7b5217 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 27 Feb 2022 10:01:47 +0800 Subject: [PATCH 6/6] make CI/CD happy --- source/libs/index/test/utilUT.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/source/libs/index/test/utilUT.cc b/source/libs/index/test/utilUT.cc index d699f0c53a..7c5ec19212 100644 --- a/source/libs/index/test/utilUT.cc +++ b/source/libs/index/test/utilUT.cc @@ -222,7 +222,6 @@ TEST_F(UtilEnv, 04union) { for (int i = 0; i < sizeof(arr3) / sizeof(arr3[0]); i++) { taosArrayPush(f, &arr3[i]); } - iUnion(src, rslt); assert(taosArrayGetSize(rslt) == 12); }