Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93f9ffe0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
93f9ffe0
编写于
2月 27, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): set correct vgId and add some test case.
上级
c4a53438
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
110 addition
and
25 deletion
+110
-25
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-2
src/query/tests/CMakeLists.txt
src/query/tests/CMakeLists.txt
+7
-7
src/query/tests/apercentileTest.cpp
src/query/tests/apercentileTest.cpp
+6
-6
src/query/tests/histogramTest.cpp
src/query/tests/histogramTest.cpp
+1
-1
src/query/tests/tsBufTest.cpp
src/query/tests/tsBufTest.cpp
+93
-9
未找到文件。
src/client/src/tscServer.c
浏览文件 @
93f9ffe0
...
@@ -1254,9 +1254,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1254,9 +1254,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pQueryInfo
->
tsBuf
!=
NULL
)
{
if
(
pQueryInfo
->
tsBuf
!=
NULL
)
{
// note: here used the idx instead of actual vnode id.
// note: here used the idx instead of actual vnode id.
int32_t
vgId
=
0
;
int32_t
vgId
=
0
;
if
(
pTableMetaInfo
->
vgroupList
!=
NULL
)
{
if
(
pTableMetaInfo
->
pVgroupTables
!=
NULL
)
{
int32_t
vnodeIndex
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
vnodeIndex
=
pTableMetaInfo
->
vgroupIndex
;
vgId
=
pTableMetaInfo
->
vgroupList
->
vgroups
[
vnodeIndex
].
vgId
;
SVgroupTableInfo
*
pTableInfo
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
vnodeIndex
);
vgId
=
pTableInfo
->
vgInfo
.
vgId
;
}
else
{
}
else
{
vgId
=
query
.
vgId
;
vgId
=
query
.
vgId
;
}
}
...
...
src/query/tests/CMakeLists.txt
浏览文件 @
93f9ffe0
...
@@ -30,11 +30,11 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR))
...
@@ -30,11 +30,11 @@ IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR))
ENDIF
()
ENDIF
()
ENDIF
()
ENDIF
()
SET_SOURCE_FILES_PROPERTIES
(
./astTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./astTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./histogramTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./histogramTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./percentileTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./percentileTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./apercentileTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./apercentileTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./resultBufferTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./resultBufferTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./tsBufTest.cpp PROPERTIES COMPILE_FLAGS -w
)
SET_SOURCE_FILES_PROPERTIES
(
./tsBufTest.cpp PROPERTIES COMPILE_FLAGS -w
)
SET_SOURCE_FILES_PROPERTIES
(
./unitTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./unitTest.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES
(
./rangeMergeTest.cpp PROPERTIES COMPILE_FLAGS -w
)
#
SET_SOURCE_FILES_PROPERTIES(./rangeMergeTest.cpp PROPERTIES COMPILE_FLAGS -w)
src/query/tests/apercentileTest.cpp
浏览文件 @
93f9ffe0
...
@@ -291,13 +291,13 @@ void tdigestTest() {
...
@@ -291,13 +291,13 @@ void tdigestTest() {
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
printf
(
"DMode:%d,Type:%d,randP:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randPers
[
p
]);
printf
(
"DMode:%d,Type:%d,randP:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randPers
[
p
]);
for
(
int32_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int32_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
p
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
p
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
printf
(
"HMode:%d,Type:%d,randP:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randPers
[
p
]);
printf
(
"HMode:%d,Type:%d,randP:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randPers
[
p
]);
for
(
int32_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int32_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
p
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
p
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
...
@@ -307,13 +307,13 @@ void tdigestTest() {
...
@@ -307,13 +307,13 @@ void tdigestTest() {
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
printf
(
"DMode:%d,Type:%d,randL:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randLimits
[
p
]);
printf
(
"DMode:%d,Type:%d,randL:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randLimits
[
p
]);
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
p
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
p
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
printf
(
"HMode:%d,Type:%d,randL:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randLimits
[
p
]);
printf
(
"HMode:%d,Type:%d,randL:%d -"
,
dataMode
[
i
],
dataTypes
[
j
],
randLimits
[
p
]);
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
p
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
p
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
...
@@ -322,13 +322,13 @@ void tdigestTest() {
...
@@ -322,13 +322,13 @@ void tdigestTest() {
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
typeTimes
;
++
j
)
{
printf
(
"DMode:%d,Type:%d -"
,
dataMode
[
i
],
dataTypes
[
j
]);
printf
(
"DMode:%d,Type:%d -"
,
dataMode
[
i
],
dataTypes
[
j
]);
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
0
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
0
][
i
][
j
][
m
][
0
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
printf
(
"HMode:%d,Type:%d -"
,
dataMode
[
i
],
dataTypes
[
j
]);
printf
(
"HMode:%d,Type:%d -"
,
dataMode
[
i
],
dataTypes
[
j
]);
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
for
(
int64_t
m
=
0
;
m
<
numTimes
;
++
m
)
{
printf
(
" %d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
0
]);
printf
(
" %
l
d:%f"
,
totalNum
[
m
],
useTime
[
1
][
i
][
j
][
m
][
0
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
...
...
src/query/tests/histogramTest.cpp
浏览文件 @
93f9ffe0
...
@@ -35,7 +35,7 @@ void doHistogramAddTest() {
...
@@ -35,7 +35,7 @@ void doHistogramAddTest() {
(
int64_t
)
systemTime
.
tv_sec
*
1000L
+
(
uint64_t
)
systemTime
.
tv_usec
/
1000
;
(
int64_t
)
systemTime
.
tv_sec
*
1000L
+
(
uint64_t
)
systemTime
.
tv_usec
/
1000
;
printf
(
"total elapsed time: %ld
\n
"
,
et
-
st
);
printf
(
"total elapsed time: %ld
\n
"
,
et
-
st
);
printf
(
"elements: %d, slot:%d
\n
"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
);
printf
(
"elements: %
l
d, slot:%d
\n
"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
);
tHistogramPrint
(
pHisto
);
tHistogramPrint
(
pHisto
);
printf
(
"%ld
\n
"
,
tHistogramSum
(
pHisto
,
1.5
));
printf
(
"%ld
\n
"
,
tHistogramSum
(
pHisto
,
1.5
));
...
...
src/query/tests/tsBufTest.cpp
浏览文件 @
93f9ffe0
...
@@ -497,19 +497,103 @@ void mergeIdenticalVnodeBufferTest() {
...
@@ -497,19 +497,103 @@ void mergeIdenticalVnodeBufferTest() {
tsBufDestroy
(
pTSBuf1
);
tsBufDestroy
(
pTSBuf1
);
tsBufDestroy
(
pTSBuf2
);
tsBufDestroy
(
pTSBuf2
);
}
}
void
mergeMultiBlockFromOneGroupTest
()
{
STSBuf
*
pTSBuf1
=
tsBufCreate
(
true
,
TSDB_ORDER_ASC
);
STSBuf
*
pTSBuf2
=
tsBufCreate
(
true
,
TSDB_ORDER_ASC
);
tVariant
t
=
{
0
};
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
int32_t
step
=
30
;
int32_t
num
=
1000
;
int32_t
numOfTags
=
2
;
// vnodeId:0
int64_t
start
=
10000
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf1
,
12
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
start
+=
step
*
num
;
}
tsBufFlush
(
pTSBuf1
);
for
(
int32_t
i
=
numOfTags
;
i
<
numOfTags
*
2
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf1
,
77
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
start
+=
step
*
num
;
}
tsBufFlush
(
pTSBuf1
);
start
=
10000
;
for
(
int32_t
i
=
911
;
i
<
912
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf1
,
12
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
start
+=
step
*
num
;
}
tsBufFlush
(
pTSBuf1
);
char
*
p
=
(
char
*
)
malloc
(
1024768
);
int32_t
len
=
0
;
int32_t
numOfBlocks
=
0
;
dumpFileBlockByGroupId
(
pTSBuf1
,
12
,
p
,
&
len
,
&
numOfBlocks
);
STSBuf
*
pNew
=
tsBufCreateFromCompBlocks
(
p
,
numOfBlocks
,
len
,
1
,
12
);
printf
(
"%p
\n
"
,
pNew
);
tsBufDisplay
(
pNew
);
// tsBufMerge(pTSBuf1, pTSBuf2);
// EXPECT_EQ(pTSBuf1->numOfGroups, 2);
// EXPECT_EQ(pTSBuf1->numOfTotal, numOfTags * 2 * num);
//
// tsBufResetPos(pTSBuf1);
//
// int32_t count = 0;
// while (tsBufNextPos(pTSBuf1)) {
// STSElem elem = tsBufGetElem(pTSBuf1);
//
// if (count++ < numOfTags * num) {
// EXPECT_EQ(elem.id, 12);
// } else {
// EXPECT_EQ(elem.id, 77);
// }
//
// printf("%d-%" PRIu64 "-%" PRIu64 "\n", elem.id, elem.tag->i64, elem.ts);
// }
//
// tsBufDestroy(pTSBuf1);
// tsBufDestroy(pTSBuf2);
}
}
// namespace
}
// namespace
//TODO add binary tag value test case
//TODO add binary tag value test case
TEST
(
testCase
,
tsBufTest
)
{
TEST
(
testCase
,
tsBufTest
)
{
simpleTest
();
//
simpleTest();
largeTSTest
();
//
largeTSTest();
multiTagsTest
();
//
multiTagsTest();
multiVnodeTagsTest
();
//
multiVnodeTagsTest();
loadDataTest
();
//
loadDataTest();
invalidFileTest
();
//
invalidFileTest();
// randomIncTsTest();
// randomIncTsTest();
TSTraverse
();
// TSTraverse();
mergeDiffVnodeBufferTest
();
// mergeDiffVnodeBufferTest();
mergeIdenticalVnodeBufferTest
();
// mergeIdenticalVnodeBufferTest();
mergeMultiBlockFromOneGroupTest
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录