From fbe535bd8be422cb2ddade9528302c5eab4335db Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 5 Aug 2021 16:27:13 +0800 Subject: [PATCH] [td-225] fix compiler error and invalid in query. --- src/client/src/tscSQLParser.c | 7 ++++--- src/common/src/tname.c | 3 +-- src/query/src/qExtbuffer.c | 6 +++--- tests/pytest/query/long_where_query.py | 6 +----- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 5739333886..df2f39ee87 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3736,7 +3736,8 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, if (pRight->tokenId != TK_SET || !serializeExprListToVariant(pRight->Expr.paramList, &pVal, colType, timePrecision)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); } - pColumnFilter->pz = (int64_t)calloc(1, pVal->nLen + 1); + + pColumnFilter->pz = (int64_t)calloc(1, pVal->nLen); pColumnFilter->len = pVal->nLen; pColumnFilter->filterstr = 1; memcpy((char *)(pColumnFilter->pz), (char *)(pVal->pz), pVal->nLen); @@ -8772,13 +8773,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf tfree(p); } -#if 0 +//#if 0 SQueryNode* p = qCreateQueryPlan(pQueryInfo); char* s = queryPlanToString(p); printf("%s\n", s); tfree(s); qDestroyQueryPlan(p); -#endif +//#endif return TSDB_CODE_SUCCESS; // Does not build query message here } diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 5da48b2e9a..aeade05df2 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -70,12 +70,11 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters); for (int32_t j = 0; j < numOfFilters; ++j) { - if (pFilter[j].filterstr) { size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE; pFilter[j].pz = (int64_t) calloc(1, len); - memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t)len); + memcpy((char*)pFilter[j].pz, (char*)src[j].pz, pFilter[j].len); } } diff --git a/src/query/src/qExtbuffer.c b/src/query/src/qExtbuffer.c index c4f5d6efd5..9f9347b327 100644 --- a/src/query/src/qExtbuffer.c +++ b/src/query/src/qExtbuffer.c @@ -778,7 +778,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf for(int32_t i = 0; i < numOfRows; ++i) { char* dest = buf + size * i; - memcpy(dest, pCols[index] + bytes * i, bytes); + memcpy(dest, ((char*)pCols[index]) + bytes * i, bytes); *(int32_t*)(dest+bytes) = i; } @@ -793,7 +793,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf if (i == index) { for(int32_t j = 0; j < numOfRows; ++j){ char* src = buf + (j * size); - char* dest = pCols[i] + (j * bytes1); + char* dest = (char*) pCols[i] + (j * bytes1); memcpy(dest, src, bytes1); } } else { @@ -809,7 +809,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf memcpy(p, pCols[i], bytes1 * numOfRows); for(int32_t j = 0; j < numOfRows; ++j){ - char* dest = pCols[i] + bytes1 * j; + char* dest = (char*) pCols[i] + bytes1 * j; int32_t newPos = *(int32_t*)(buf + (j * size) + bytes); char* src = p + (newPos * bytes1); diff --git a/tests/pytest/query/long_where_query.py b/tests/pytest/query/long_where_query.py index 62e9533b62..9bb5f0b3d7 100644 --- a/tests/pytest/query/long_where_query.py +++ b/tests/pytest/query/long_where_query.py @@ -287,13 +287,9 @@ class TDTestCase: tdLog.info(len(sql)) tdSql.error(sql) - endTime = time.time() print("total time %ds" % (endTime - startTime)) - - - - os.system("rm -rf query/long_where_query.py.sql") + #os.system("rm -rf query/long_where_query.py.sql") def stop(self):