未验证 提交 7043cfb6 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1668 from taosdata/feature/2.0tsdb

fix compile error
...@@ -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 tSkipList *createSkipList(SSchema *pSchema, int32_t numOfTags); static SSkipList *createSkipList(SSchema *pSchema, int32_t numOfTags);
static tSkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags); static SSkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags);
static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, tSkipList *pSkipList, ResultObj *expectedVal); static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, SSkipList *pSkipList, ResultObj *expectedVal);
static void dropMeter(tSkipList *pSkipList); static void dropMeter(SSkipList *pSkipList);
static void Right2LeftTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList); static void Right2LeftTest(SSchema *schema, int32_t numOfCols, SSkipList *pSkipList);
static void Left2RightTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList); static void Left2RightTest(SSchema *schema, int32_t numOfCols, SSkipList *pSkipList);
static void IllegalExprTest(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList); static void IllegalExprTest(SSchema *schema, int32_t numOfCols, SSkipList *pSkipList);
static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList); static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, SSkipList *pSkipList);
static void Right2LeftTest_binary(SSchema *schema, int32_t numOfCols, tSkipList *pSkipList); static void Right2LeftTest_binary(SSchema *schema, int32_t numOfCols, SSkipList *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, tSkipList *pSkipList, // static void addOneNode(SSchema *pSchema, int32_t tagsLen, SSkipList *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 = tSkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes); // SSkipListKey pKey = SSkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
// tSkipListPut(pSkipList, pMeter, &pKey, 1); // SSkipListPut(pSkipList, pMeter, &pKey, 1);
//} //}
// //
// static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen, tSkipList *pSkipList, // static void addOneNode_binary(SSchema *pSchema, int32_t tagsLen, SSkipList *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 = tSkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes); // SSkipListKey pKey = SSkipListCreateKey(pSchema[0].type, tags, pSchema[0].bytes);
// tSkipListPut(pSkipList, pMeter, &pKey, 1); // SSkipListPut(pSkipList, pMeter, &pKey, 1);
// tSkipListDestroyKey(&pKey); // SSkipListDestroyKey(&pKey);
//} //}
// static void dropMeter(tSkipList *pSkipList) { // static void dropMeter(SSkipList *pSkipList) {
// tSkipListNode **pRes = NULL; // SSkipListNode **pRes = NULL;
// int32_t num = tSkipListIterateList(pSkipList, &pRes, NULL, NULL); // int32_t num = SSkipListIterateList(pSkipList, &pRes, NULL, NULL);
// for (int32_t i = 0; i < num; ++i) { // for (int32_t i = 0; i < num; ++i) {
// tSkipListNode *pNode = pRes[i]; // SSkipListNode *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 tSkipList *createSkipList(SSchema *pSchema, int32_t numOfTags) { // static SSkipList *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 = tSkipListCreate(10, pSchema[0].type, 4); // SSkipList *pSkipList = SSkipListCreate(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 tSkipList *createSkipList_binary(SSchema *pSchema, int32_t numOfTags) { // static SSkipList *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 = tSkipListCreate(10, pSchema[0].type, 4); // SSkipList *pSkipList = SSkipListCreate(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, tSkipList *pSkipList, ResultObj *pResult) { static void testQueryStr(SSchema *schema, int32_t numOfCols, char *sql, SSkipList *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, tSkipListNodeFilterCallback, &result); // tExprTreeTraverse(pExpr, pSkipList, result, SSkipListNodeFilterCallback, &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, tSkipList *pSkipList) { static void Left2RightTest(SSchema *schema, int32_t numOfCols, SSkipList *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, tSkipList *pSkipList) { void Right2LeftTest(SSchema *schema, int32_t numOfCols, SSkipList *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, tSkipList *pSkipList) { static void IllegalExprTest(SSchema *schema, int32_t numOfCols, SSkipList *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, tSkipList *pSkipList) { static void Left2RightTest_binary(SSchema *schema, int32_t numOfCols, SSkipList *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, tSkipList *pSkipList) { static void Right2LeftTest_binary(SSchema *schema, int32_t numOfCols, SSkipList *pSkipList) {
char str[256] = {0}; char str[256] = {0};
char *sql = NULL; char *sql = NULL;
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册