[td-225] fix compiler error and invalid in query.

This commit is contained in:
Haojun Liao 2021-08-05 16:27:13 +08:00
parent ed48ad1374
commit fbe535bd8b
4 changed files with 9 additions and 13 deletions

View File

@ -3736,7 +3736,8 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
if (pRight->tokenId != TK_SET || !serializeExprListToVariant(pRight->Expr.paramList, &pVal, colType, timePrecision)) { if (pRight->tokenId != TK_SET || !serializeExprListToVariant(pRight->Expr.paramList, &pVal, colType, timePrecision)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); 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->len = pVal->nLen;
pColumnFilter->filterstr = 1; pColumnFilter->filterstr = 1;
memcpy((char *)(pColumnFilter->pz), (char *)(pVal->pz), pVal->nLen); memcpy((char *)(pColumnFilter->pz), (char *)(pVal->pz), pVal->nLen);
@ -8772,13 +8773,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
tfree(p); tfree(p);
} }
#if 0 //#if 0
SQueryNode* p = qCreateQueryPlan(pQueryInfo); SQueryNode* p = qCreateQueryPlan(pQueryInfo);
char* s = queryPlanToString(p); char* s = queryPlanToString(p);
printf("%s\n", s); printf("%s\n", s);
tfree(s); tfree(s);
qDestroyQueryPlan(p); qDestroyQueryPlan(p);
#endif //#endif
return TSDB_CODE_SUCCESS; // Does not build query message here return TSDB_CODE_SUCCESS; // Does not build query message here
} }

View File

@ -70,12 +70,11 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil
memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters); memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters);
for (int32_t j = 0; j < numOfFilters; ++j) { for (int32_t j = 0; j < numOfFilters; ++j) {
if (pFilter[j].filterstr) { if (pFilter[j].filterstr) {
size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE; size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE;
pFilter[j].pz = (int64_t) calloc(1, len); 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);
} }
} }

View File

@ -778,7 +778,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf
for(int32_t i = 0; i < numOfRows; ++i) { for(int32_t i = 0; i < numOfRows; ++i) {
char* dest = buf + size * 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; *(int32_t*)(dest+bytes) = i;
} }
@ -793,7 +793,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf
if (i == index) { if (i == index) {
for(int32_t j = 0; j < numOfRows; ++j){ for(int32_t j = 0; j < numOfRows; ++j){
char* src = buf + (j * size); char* src = buf + (j * size);
char* dest = pCols[i] + (j * bytes1); char* dest = (char*) pCols[i] + (j * bytes1);
memcpy(dest, src, bytes1); memcpy(dest, src, bytes1);
} }
} else { } else {
@ -809,7 +809,7 @@ void taoscQSort(void** pCols, SSchema* pSchema, int32_t numOfCols, int32_t numOf
memcpy(p, pCols[i], bytes1 * numOfRows); memcpy(p, pCols[i], bytes1 * numOfRows);
for(int32_t j = 0; j < numOfRows; ++j){ 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); int32_t newPos = *(int32_t*)(buf + (j * size) + bytes);
char* src = p + (newPos * bytes1); char* src = p + (newPos * bytes1);

View File

@ -287,13 +287,9 @@ class TDTestCase:
tdLog.info(len(sql)) tdLog.info(len(sql))
tdSql.error(sql) tdSql.error(sql)
endTime = time.time() endTime = time.time()
print("total time %ds" % (endTime - startTime)) 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): def stop(self):