Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7043cfb6
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7043cfb6
编写于
4月 20, 2020
作者:
S
slguan
提交者:
GitHub
4月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1668 from taosdata/feature/2.0tsdb
fix compile error
上级
fed69849
f61e749b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
32 deletion
+32
-32
src/query/tests/astTest.cpp
src/query/tests/astTest.cpp
+31
-31
src/util/tests/CMakeLists.txt
src/util/tests/CMakeLists.txt
+1
-1
未找到文件。
src/query/tests/astTest.cpp
浏览文件 @
7043cfb6
...
@@ -21,21 +21,21 @@ static void initSchema(SSchema *pSchema, int32_t numOfCols);
...
@@ -21,21 +21,21 @@ static void initSchema(SSchema *pSchema, int32_t numOfCols);
static
void
initSchema_binary
(
SSchema
*
schema
,
int32_t
numOfCols
);
static
void
initSchema_binary
(
SSchema
*
schema
,
int32_t
numOfCols
);
static
t
SkipList
*
createSkipList
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
S
SkipList
*
createSkipList
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
t
SkipList
*
createSkipList_binary
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
S
SkipList
*
createSkipList_binary
(
SSchema
*
pSchema
,
int32_t
numOfTags
);
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
t
SkipList
*
pSkipList
,
ResultObj
*
expectedVal
);
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
S
SkipList
*
pSkipList
,
ResultObj
*
expectedVal
);
static
void
dropMeter
(
t
SkipList
*
pSkipList
);
static
void
dropMeter
(
S
SkipList
*
pSkipList
);
static
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
);
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
);
void
setValue
(
ResultObj
*
pResult
,
int32_t
num
,
char
**
val
)
{
void
setValue
(
ResultObj
*
pResult
,
int32_t
num
,
char
**
val
)
{
pResult
->
numOfResult
=
num
;
pResult
->
numOfResult
=
num
;
...
@@ -112,7 +112,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -112,7 +112,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
strcpy
(
schema
[
7
].
name
,
"h"
);
strcpy
(
schema
[
7
].
name
,
"h"
);
}
}
// static void addOneNode(SSchema *pSchema, int32_t tagsLen,
t
SkipList *pSkipList,
// static void addOneNode(SSchema *pSchema, int32_t tagsLen,
S
SkipList *pSkipList,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// bool h, int32_t numOfTags) {
// bool h, int32_t numOfTags) {
// STabObj *pMeter = calloc(1, sizeof(STabObj));
// STabObj *pMeter = calloc(1, sizeof(STabObj));
...
@@ -146,11 +146,11 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -146,11 +146,11 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// offset += pSchema[6].bytes;
// offset += pSchema[6].bytes;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
//
//
//
tSkipListKey pKey = t
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
SSkipListKey pKey = S
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
t
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
S
SkipListPut(pSkipList, pMeter, &pKey, 1);
//}
//}
//
//
// static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen,
t
SkipList *pSkipList,
// static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen,
S
SkipList *pSkipList,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// char *meterId, int32_t a, double b, char *c, int64_t d, int16_t e, int8_t f, float g,
// bool h, int32_t numOfTags) {
// bool h, int32_t numOfTags) {
// STabObj *pMeter = calloc(1, sizeof(STabObj));
// STabObj *pMeter = calloc(1, sizeof(STabObj));
...
@@ -183,16 +183,16 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -183,16 +183,16 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// offset += pSchema[6].bytes;
// offset += pSchema[6].bytes;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
// *(int8_t *) (tags + offset) = h ? 1 : 0;
//
//
//
tSkipListKey pKey = t
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
SSkipListKey pKey = S
SkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
//
t
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
S
SkipListPut(pSkipList, pMeter, &pKey, 1);
//
t
SkipListDestroyKey(&pKey);
//
S
SkipListDestroyKey(&pKey);
//}
//}
// static void dropMeter(
t
SkipList *pSkipList) {
// static void dropMeter(
S
SkipList *pSkipList) {
//
t
SkipListNode **pRes = NULL;
//
S
SkipListNode **pRes = NULL;
// int32_t num =
t
SkipListIterateList(pSkipList, &pRes, NULL, NULL);
// int32_t num =
S
SkipListIterateList(pSkipList, &pRes, NULL, NULL);
// for (int32_t i = 0; i < num; ++i) {
// for (int32_t i = 0; i < num; ++i) {
//
t
SkipListNode *pNode = pRes[i];
//
S
SkipListNode *pNode = pRes[i];
// STabObj *pMeter = (STabObj *) pNode->pData;
// STabObj *pMeter = (STabObj *) pNode->pData;
// free(pMeter->pTagData);
// free(pMeter->pTagData);
// free(pMeter);
// free(pMeter);
...
@@ -201,13 +201,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -201,13 +201,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// free(pRes);
// free(pRes);
//}
//}
// static
t
SkipList *createSkipList(SSchema *pSchema, int32_t numOfTags) {
// static
S
SkipList *createSkipList(SSchema *pSchema, int32_t numOfTags) {
// int32_t tagsLen = 0;
// int32_t tagsLen = 0;
// for (int32_t i = 0; i < numOfTags; ++i) {
// for (int32_t i = 0; i < numOfTags; ++i) {
// tagsLen += pSchema[i].bytes;
// tagsLen += pSchema[i].bytes;
// }
// }
//
//
//
tSkipList *pSkipList = t
SkipListCreate(10, pSchema[0].type, 4);
//
SSkipList *pSkipList = S
SkipListCreate(10, pSchema[0].type, 4);
//
//
// addOneNode(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
// addOneNode(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
...
@@ -220,13 +220,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -220,13 +220,13 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// return pSkipList;
// return pSkipList;
//}
//}
//
//
// static
t
SkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags) {
// static
S
SkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags) {
// int32_t tagsLen = 0;
// int32_t tagsLen = 0;
// for (int32_t i = 0; i < numOfTags; ++i) {
// for (int32_t i = 0; i < numOfTags; ++i) {
// tagsLen += pSchema[i].bytes;
// tagsLen += pSchema[i].bytes;
// }
// }
//
//
//
tSkipList *pSkipList = t
SkipListCreate(10, pSchema[0].type, 4);
//
SSkipList *pSkipList = S
SkipListCreate(10, pSchema[0].type, 4);
//
//
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm0\0", 0, 10.5, "abc", 1000, -10000, -20, 1.0, true, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
// addOneNode_binary(pSchema, tagsLen, pSkipList, "tm1\0", 1, 20.5, "def", 1100, -10500, -30, 2.0, false, 8);
...
@@ -239,7 +239,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
...
@@ -239,7 +239,7 @@ static void initSchema(SSchema *schema, int32_t numOfCols) {
// return pSkipList;
// return pSkipList;
//}
//}
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
t
SkipList
*
pSkipList
,
ResultObj
*
pResult
)
{
static
void
testQueryStr
(
SSchema
*
schema
,
int32_t
numOfCols
,
char
*
sql
,
S
SkipList
*
pSkipList
,
ResultObj
*
pResult
)
{
tExprNode
*
pExpr
=
NULL
;
tExprNode
*
pExpr
=
NULL
;
tSQLBinaryExprFromString
(
&
pExpr
,
schema
,
numOfCols
,
sql
,
strlen
(
sql
));
tSQLBinaryExprFromString
(
&
pExpr
,
schema
,
numOfCols
,
sql
,
strlen
(
sql
));
...
@@ -255,7 +255,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
...
@@ -255,7 +255,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
printf
(
"expr is: %s
\n
"
,
str
);
printf
(
"expr is: %s
\n
"
,
str
);
SArray
*
result
=
NULL
;
SArray
*
result
=
NULL
;
// tExprTreeTraverse(pExpr, pSkipList, result,
t
SkipListNodeFilterCallback, &result);
// tExprTreeTraverse(pExpr, pSkipList, result,
S
SkipListNodeFilterCallback, &result);
// printf("the result is:%lld\n", result.num);
// printf("the result is:%lld\n", result.num);
//
//
// bool findResult = false;
// bool findResult = false;
...
@@ -277,7 +277,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
...
@@ -277,7 +277,7 @@ static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipLis
tExprTreeDestroy
(
&
pExpr
,
NULL
);
tExprTreeDestroy
(
&
pExpr
,
NULL
);
}
}
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Left2RightTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
t0
[
1
]
=
{
"tm0"
};
char
*
t0
[
1
]
=
{
"tm0"
};
...
@@ -342,7 +342,7 @@ static void Left2RightTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipL
...
@@ -342,7 +342,7 @@ static void Left2RightTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipL
testQueryStr
(
schema
,
numOfCols
,
"f > -65"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"f > -65"
,
pSkipList
,
&
res
);
}
}
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
void
Right2LeftTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
ResultObj
res
=
{
1
,
{
"tm1"
}};
ResultObj
res
=
{
1
,
{
"tm1"
}};
testQueryStr
(
schema
,
numOfCols
,
"((1=a))"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"((1=a))"
,
pSkipList
,
&
res
);
...
@@ -359,7 +359,7 @@ void Right2LeftTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList) {
...
@@ -359,7 +359,7 @@ void Right2LeftTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList) {
testQueryStr
(
schema
,
numOfCols
,
"0=h"
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
"0=h"
,
pSkipList
,
&
res
);
}
}
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
IllegalExprTest
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
testQueryStr
(
schema
,
numOfCols
,
"h="
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h="
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h<"
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"h<"
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
...
@@ -374,7 +374,7 @@ static void IllegalExprTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkip
...
@@ -374,7 +374,7 @@ static void IllegalExprTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkip
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
testQueryStr
(
schema
,
numOfCols
,
"a=1 and "
,
pSkipList
,
NULL
);
}
}
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Left2RightTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
sql
=
NULL
;
char
*
sql
=
NULL
;
...
@@ -432,7 +432,7 @@ static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, tSkipList
...
@@ -432,7 +432,7 @@ static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, tSkipList
testQueryStr
(
schema
,
numOfCols
,
sql
,
pSkipList
,
&
res
);
testQueryStr
(
schema
,
numOfCols
,
sql
,
pSkipList
,
&
res
);
}
}
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
t
SkipList
*
pSkipList
)
{
static
void
Right2LeftTest_binary
(
SSchema
*
schema
,
int32_t
numOfCols
,
S
SkipList
*
pSkipList
)
{
char
str
[
256
]
=
{
0
};
char
str
[
256
]
=
{
0
};
char
*
sql
=
NULL
;
char
*
sql
=
NULL
;
...
...
src/util/tests/CMakeLists.txt
浏览文件 @
7043cfb6
...
@@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
...
@@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
utilTest
${
SOURCE_LIST
}
)
ADD_EXECUTABLE
(
utilTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
utilTest tutil gtest pthread
)
TARGET_LINK_LIBRARIES
(
utilTest tutil
common
gtest pthread
)
ENDIF
()
ENDIF
()
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录