提交 1f6f6666 编写于 作者: dengyihao's avatar dengyihao

Merge branch 'NEEE' into physical

......@@ -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);
......
......@@ -200,3 +200,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, 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) == 12);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册