提交 f790003e 编写于 作者: S Shengliang Guan

TD-1057

上级 c2cf92c3
...@@ -2225,7 +2225,7 @@ static void top_function(SQLFunctionCtx *pCtx) { ...@@ -2225,7 +2225,7 @@ static void top_function(SQLFunctionCtx *pCtx) {
} }
notNullElems++; notNullElems++;
do_top_function_add(pRes, pCtx->param[0].i64Key, data, pCtx->ptsList[i], pCtx->inputType, &pCtx->tagInfo, NULL, 0); do_top_function_add(pRes, (int32_t)pCtx->param[0].i64Key, data, pCtx->ptsList[i], pCtx->inputType, &pCtx->tagInfo, NULL, 0);
} }
if (!pCtx->hasNull) { if (!pCtx->hasNull) {
...@@ -2251,7 +2251,7 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) { ...@@ -2251,7 +2251,7 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) {
assert(pRes->num >= 0); assert(pRes->num >= 0);
SET_VAL(pCtx, 1, 1); SET_VAL(pCtx, 1, 1);
do_top_function_add(pRes, pCtx->param[0].i64Key, pData, pCtx->ptsList[index], pCtx->inputType, &pCtx->tagInfo, NULL, do_top_function_add(pRes, (int32_t)pCtx->param[0].i64Key, pData, pCtx->ptsList[index], pCtx->inputType, &pCtx->tagInfo, NULL,
0); 0);
SResultInfo *pResInfo = GET_RES_INFO(pCtx); SResultInfo *pResInfo = GET_RES_INFO(pCtx);
...@@ -2275,7 +2275,7 @@ static void top_func_merge(SQLFunctionCtx *pCtx) { ...@@ -2275,7 +2275,7 @@ static void top_func_merge(SQLFunctionCtx *pCtx) {
STopBotInfo *pOutput = getTopBotOutputInfo(pCtx); STopBotInfo *pOutput = getTopBotOutputInfo(pCtx);
for (int32_t i = 0; i < pInput->num; ++i) { for (int32_t i = 0; i < pInput->num; ++i) {
do_top_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, do_top_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp,
pCtx->inputType, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); pCtx->inputType, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
} }
} }
...@@ -2291,7 +2291,7 @@ static void top_func_second_merge(SQLFunctionCtx *pCtx) { ...@@ -2291,7 +2291,7 @@ static void top_func_second_merge(SQLFunctionCtx *pCtx) {
// the intermediate result is binary, we only use the output data type // the intermediate result is binary, we only use the output data type
for (int32_t i = 0; i < pInput->num; ++i) { for (int32_t i = 0; i < pInput->num; ++i) {
int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT)? TSDB_DATA_TYPE_DOUBLE:pCtx->outputType; int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT)? TSDB_DATA_TYPE_DOUBLE:pCtx->outputType;
do_top_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, do_top_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp,
type, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); type, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
} }
...@@ -2315,7 +2315,7 @@ static void bottom_function(SQLFunctionCtx *pCtx) { ...@@ -2315,7 +2315,7 @@ static void bottom_function(SQLFunctionCtx *pCtx) {
} }
notNullElems++; notNullElems++;
do_bottom_function_add(pRes, pCtx->param[0].i64Key, data, pCtx->ptsList[i], pCtx->inputType, &pCtx->tagInfo, NULL, do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64Key, data, pCtx->ptsList[i], pCtx->inputType, &pCtx->tagInfo, NULL,
0); 0);
} }
...@@ -2340,7 +2340,7 @@ static void bottom_function_f(SQLFunctionCtx *pCtx, int32_t index) { ...@@ -2340,7 +2340,7 @@ static void bottom_function_f(SQLFunctionCtx *pCtx, int32_t index) {
STopBotInfo *pRes = getTopBotOutputInfo(pCtx); STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
SET_VAL(pCtx, 1, 1); SET_VAL(pCtx, 1, 1);
do_bottom_function_add(pRes, pCtx->param[0].i64Key, pData, pCtx->ptsList[index], pCtx->inputType, &pCtx->tagInfo, do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64Key, pData, pCtx->ptsList[index], pCtx->inputType, &pCtx->tagInfo,
NULL, 0); NULL, 0);
SResultInfo *pResInfo = GET_RES_INFO(pCtx); SResultInfo *pResInfo = GET_RES_INFO(pCtx);
...@@ -2364,7 +2364,7 @@ static void bottom_func_merge(SQLFunctionCtx *pCtx) { ...@@ -2364,7 +2364,7 @@ static void bottom_func_merge(SQLFunctionCtx *pCtx) {
STopBotInfo *pOutput = getTopBotOutputInfo(pCtx); STopBotInfo *pOutput = getTopBotOutputInfo(pCtx);
for (int32_t i = 0; i < pInput->num; ++i) { for (int32_t i = 0; i < pInput->num; ++i) {
do_bottom_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, do_bottom_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp,
pCtx->inputType, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); pCtx->inputType, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
} }
} }
...@@ -2380,7 +2380,7 @@ static void bottom_func_second_merge(SQLFunctionCtx *pCtx) { ...@@ -2380,7 +2380,7 @@ static void bottom_func_second_merge(SQLFunctionCtx *pCtx) {
// the intermediate result is binary, we only use the output data type // the intermediate result is binary, we only use the output data type
for (int32_t i = 0; i < pInput->num; ++i) { for (int32_t i = 0; i < pInput->num; ++i) {
int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT) ? TSDB_DATA_TYPE_DOUBLE : pCtx->outputType; int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT) ? TSDB_DATA_TYPE_DOUBLE : pCtx->outputType;
do_bottom_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, type, do_bottom_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, type,
&pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
} }
...@@ -2430,7 +2430,7 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx) { ...@@ -2430,7 +2430,7 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx) {
} }
SResultInfo *pResInfo = GET_RES_INFO(pCtx); SResultInfo *pResInfo = GET_RES_INFO(pCtx);
SSchema field[1] = {{pCtx->inputType, "dummyCol", 0, pCtx->inputBytes}}; SSchema field[1] = { { pCtx->inputType, "dummyCol", 0, (uint8_t)pCtx->inputBytes } };
SColumnModel *pModel = createColumnModel(field, 1, 1000); SColumnModel *pModel = createColumnModel(field, 1, 1000);
int32_t orderIdx = 0; int32_t orderIdx = 0;
...@@ -2543,7 +2543,7 @@ static void apercentile_function(SQLFunctionCtx *pCtx) { ...@@ -2543,7 +2543,7 @@ static void apercentile_function(SQLFunctionCtx *pCtx) {
v = GET_INT16_VAL(data); v = GET_INT16_VAL(data);
break; break;
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
v = GET_INT64_VAL(data); v = (double)(GET_INT64_VAL(data));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
v = GET_FLOAT_VAL(data); v = GET_FLOAT_VAL(data);
...@@ -2588,7 +2588,7 @@ static void apercentile_function_f(SQLFunctionCtx *pCtx, int32_t index) { ...@@ -2588,7 +2588,7 @@ static void apercentile_function_f(SQLFunctionCtx *pCtx, int32_t index) {
v = GET_INT16_VAL(pData); v = GET_INT16_VAL(pData);
break; break;
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
v = GET_INT64_VAL(pData); v = (double)(GET_INT64_VAL(pData));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
v = GET_FLOAT_VAL(pData); v = GET_FLOAT_VAL(pData);
...@@ -3027,13 +3027,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { ...@@ -3027,13 +3027,13 @@ static void diff_function(SQLFunctionCtx *pCtx) {
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; pCtx->param[1].nType = pCtx->inputType;
} else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) {
*pOutput = pData[i] - pCtx->param[1].i64Key; *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64Key);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
} else { } else {
*pOutput = pData[i] - pCtx->param[1].i64Key; // direct previous may be null *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64Key); // direct previous may be null
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
...@@ -3121,13 +3121,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { ...@@ -3121,13 +3121,13 @@ static void diff_function(SQLFunctionCtx *pCtx) {
pCtx->param[1].dKey = pData[i]; pCtx->param[1].dKey = pData[i];
pCtx->param[1].nType = pCtx->inputType; pCtx->param[1].nType = pCtx->inputType;
} else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) {
*pOutput = pData[i] - pCtx->param[1].dKey; *pOutput = (float)(pData[i] - pCtx->param[1].dKey);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
} else { } else {
*pOutput = pData[i] - pCtx->param[1].dKey; *pOutput = (float)(pData[i] - pCtx->param[1].dKey);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
...@@ -3154,12 +3154,12 @@ static void diff_function(SQLFunctionCtx *pCtx) { ...@@ -3154,12 +3154,12 @@ static void diff_function(SQLFunctionCtx *pCtx) {
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; pCtx->param[1].nType = pCtx->inputType;
} else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) {
*pOutput = pData[i] - pCtx->param[1].i64Key; *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64Key);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
} else { } else {
*pOutput = pData[i] - pCtx->param[1].i64Key; *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64Key);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
...@@ -3185,13 +3185,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { ...@@ -3185,13 +3185,13 @@ static void diff_function(SQLFunctionCtx *pCtx) {
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; pCtx->param[1].nType = pCtx->inputType;
} else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) {
*pOutput = pData[i] - pCtx->param[1].i64Key; *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64Key);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
pTimestamp += 1; pTimestamp += 1;
} else { } else {
*pOutput = pData[i] - pCtx->param[1].i64Key; *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64Key);
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += 1; pOutput += 1;
...@@ -3256,7 +3256,7 @@ static void diff_function_f(SQLFunctionCtx *pCtx, int32_t index) { ...@@ -3256,7 +3256,7 @@ static void diff_function_f(SQLFunctionCtx *pCtx, int32_t index) {
pCtx->param[1].nType = pCtx->inputType; pCtx->param[1].nType = pCtx->inputType;
pCtx->param[1].i64Key = *(int32_t *)pData; pCtx->param[1].i64Key = *(int32_t *)pData;
} else { } else {
*(int32_t *)pCtx->aOutputBuf = *(int32_t *)pData - pCtx->param[1].i64Key; *(int32_t *)pCtx->aOutputBuf = *(int32_t *)pData - (int32_t)pCtx->param[1].i64Key;
pCtx->param[1].i64Key = *(int32_t *)pData; pCtx->param[1].i64Key = *(int32_t *)pData;
*(int64_t *)pCtx->ptsOutputBuf = pCtx->ptsList[index]; *(int64_t *)pCtx->ptsOutputBuf = pCtx->ptsList[index];
} }
...@@ -3383,11 +3383,11 @@ static void spread_function(SQLFunctionCtx *pCtx) { ...@@ -3383,11 +3383,11 @@ static void spread_function(SQLFunctionCtx *pCtx) {
if ((pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) || if ((pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) ||
(pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)) { (pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)) {
if (pInfo->min > pCtx->preAggVals.statis.min) { if (pInfo->min > pCtx->preAggVals.statis.min) {
pInfo->min = pCtx->preAggVals.statis.min; pInfo->min = (double)pCtx->preAggVals.statis.min;
} }
if (pInfo->max < pCtx->preAggVals.statis.max) { if (pInfo->max < pCtx->preAggVals.statis.max) {
pInfo->max = pCtx->preAggVals.statis.max; pInfo->max = (double)pCtx->preAggVals.statis.max;
} }
} else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) {
if (pInfo->min > GET_DOUBLE_VAL(&(pCtx->preAggVals.statis.min))) { if (pInfo->min > GET_DOUBLE_VAL(&(pCtx->preAggVals.statis.min))) {
......
...@@ -133,7 +133,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc ...@@ -133,7 +133,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc
} }
static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) { static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) {
int32_t numOfCols = tscSqlExprNumOfExprs(pQueryInfo); int32_t numOfCols = (int32_t)tscSqlExprNumOfExprs(pQueryInfo);
int32_t offset = 0; int32_t offset = 0;
SFillColInfo* pFillCol = calloc(numOfCols, sizeof(SFillColInfo)); SFillColInfo* pFillCol = calloc(numOfCols, sizeof(SFillColInfo));
...@@ -141,7 +141,7 @@ static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) { ...@@ -141,7 +141,7 @@ static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) {
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i);
pFillCol[i].col.bytes = pExpr->resBytes; pFillCol[i].col.bytes = pExpr->resBytes;
pFillCol[i].col.type = pExpr->resType; pFillCol[i].col.type = (int8_t)pExpr->resType;
pFillCol[i].flag = pExpr->colInfo.flag; pFillCol[i].flag = pExpr->colInfo.flag;
pFillCol[i].col.offset = offset; pFillCol[i].col.offset = offset;
pFillCol[i].functionId = pExpr->functionId; pFillCol[i].functionId = pExpr->functionId;
...@@ -361,7 +361,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd ...@@ -361,7 +361,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
pQueryInfo->limit.offset = pQueryInfo->prjOffset; pQueryInfo->limit.offset = pQueryInfo->prjOffset;
} }
pReducer->offset = pQueryInfo->limit.offset; pReducer->offset = (int32_t)pQueryInfo->limit.offset;
pRes->pLocalReducer = pReducer; pRes->pLocalReducer = pReducer;
pRes->numOfGroups = 0; pRes->numOfGroups = 0;
...@@ -376,7 +376,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd ...@@ -376,7 +376,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if (pQueryInfo->fillType != TSDB_FILL_NONE) { if (pQueryInfo->fillType != TSDB_FILL_NONE) {
SFillColInfo* pFillCol = createFillColInfo(pQueryInfo); SFillColInfo* pFillCol = createFillColInfo(pQueryInfo);
pReducer->pFillInfo = taosInitFillInfo(pQueryInfo->order.order, revisedSTime, pQueryInfo->groupbyExpr.numOfGroupCols, pReducer->pFillInfo = taosInitFillInfo(pQueryInfo->order.order, revisedSTime, pQueryInfo->groupbyExpr.numOfGroupCols,
4096, numOfCols, pQueryInfo->slidingTime, pQueryInfo->slidingTimeUnit, 4096, (int32_t)numOfCols, pQueryInfo->slidingTime, pQueryInfo->slidingTimeUnit,
tinfo.precision, pQueryInfo->fillType, pFillCol); tinfo.precision, pQueryInfo->fillType, pFillCol);
} }
...@@ -405,7 +405,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor ...@@ -405,7 +405,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor
// sort before flush to disk, the data must be consecutively put on tFilePage. // sort before flush to disk, the data must be consecutively put on tFilePage.
if (pDesc->orderInfo.numOfCols > 0) { if (pDesc->orderInfo.numOfCols > 0) {
tColDataQSort(pDesc, pPage->num, 0, pPage->num - 1, pPage->data, orderType); tColDataQSort(pDesc, (int32_t)pPage->num, 0, (int32_t)pPage->num - 1, pPage->data, orderType);
} }
#ifdef _DEBUG_VIEW #ifdef _DEBUG_VIEW
...@@ -414,7 +414,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor ...@@ -414,7 +414,7 @@ static int32_t tscFlushTmpBufferImpl(tExtMemBuffer *pMemoryBuf, tOrderDescriptor
#endif #endif
// write to cache after being sorted // write to cache after being sorted
if (tExtMemBufferPut(pMemoryBuf, pPage->data, pPage->num) < 0) { if (tExtMemBufferPut(pMemoryBuf, pPage->data, (int32_t)pPage->num) < 0) {
tscError("failed to save data in temporary buffer"); tscError("failed to save data in temporary buffer");
return -1; return -1;
} }
...@@ -446,7 +446,7 @@ int32_t saveToBuffer(tExtMemBuffer *pMemoryBuf, tOrderDescriptor *pDesc, tFilePa ...@@ -446,7 +446,7 @@ int32_t saveToBuffer(tExtMemBuffer *pMemoryBuf, tOrderDescriptor *pDesc, tFilePa
} }
// current buffer is overflow, flush data to extensive buffer // current buffer is overflow, flush data to extensive buffer
int32_t numOfRemainEntries = pModel->capacity - pPage->num; int32_t numOfRemainEntries = pModel->capacity - (int32_t)pPage->num;
tColModelAppend(pModel, pPage, data, 0, numOfRemainEntries, numOfRows); tColModelAppend(pModel, pPage, data, 0, numOfRemainEntries, numOfRows);
// current buffer is full, need to flushed to disk // current buffer is full, need to flushed to disk
...@@ -679,7 +679,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr ...@@ -679,7 +679,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, i); SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, i);
pSchema[i].bytes = pExpr->resBytes; pSchema[i].bytes = pExpr->resBytes;
pSchema[i].type = pExpr->resType; pSchema[i].type = (int8_t)pExpr->resType;
rlen += pExpr->resBytes; rlen += pExpr->resBytes;
} }
...@@ -689,7 +689,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr ...@@ -689,7 +689,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
capacity = nBufferSizes / rlen; capacity = nBufferSizes / rlen;
} }
pModel = createColumnModel(pSchema, size, capacity); pModel = createColumnModel(pSchema, (int32_t)size, capacity);
int32_t pg = DEFAULT_PAGE_SIZE; int32_t pg = DEFAULT_PAGE_SIZE;
int32_t overhead = sizeof(tFilePage); int32_t overhead = sizeof(tFilePage);
...@@ -740,12 +740,12 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr ...@@ -740,12 +740,12 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
getResultDataInfo(p1->type, p1->bytes, functionId, 0, &type, &bytes, &inter, 0, false); getResultDataInfo(p1->type, p1->bytes, functionId, 0, &type, &bytes, &inter, 0, false);
} }
pSchema[i].type = type; pSchema[i].type = (uint8_t)type;
pSchema[i].bytes = bytes; pSchema[i].bytes = bytes;
strcpy(pSchema[i].name, pModel->pFields[i].field.name); strcpy(pSchema[i].name, pModel->pFields[i].field.name);
} }
*pFinalModel = createColumnModel(pSchema, size, capacity); *pFinalModel = createColumnModel(pSchema, (int32_t)size, capacity);
taosTFree(pSchema); taosTFree(pSchema);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -780,7 +780,7 @@ int32_t loadNewDataFromDiskFor(SLocalReducer *pLocalReducer, SLocalDataSource *p ...@@ -780,7 +780,7 @@ int32_t loadNewDataFromDiskFor(SLocalReducer *pLocalReducer, SLocalDataSource *p
pOneInterDataSrc->rowIdx = 0; pOneInterDataSrc->rowIdx = 0;
pOneInterDataSrc->pageId += 1; pOneInterDataSrc->pageId += 1;
if (pOneInterDataSrc->pageId < if ((uint32_t)pOneInterDataSrc->pageId <
pOneInterDataSrc->pMemBuffer->fileMeta.flushoutData.pFlushoutInfo[pOneInterDataSrc->flushoutIdx].numOfPages) { pOneInterDataSrc->pMemBuffer->fileMeta.flushoutData.pFlushoutInfo[pOneInterDataSrc->flushoutIdx].numOfPages) {
tExtMemBufferLoadData(pOneInterDataSrc->pMemBuffer, &(pOneInterDataSrc->filePage), pOneInterDataSrc->flushoutIdx, tExtMemBufferLoadData(pOneInterDataSrc->pMemBuffer, &(pOneInterDataSrc->filePage), pOneInterDataSrc->flushoutIdx,
pOneInterDataSrc->pageId); pOneInterDataSrc->pageId);
...@@ -924,8 +924,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO ...@@ -924,8 +924,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
if (pQueryInfo->limit.offset > 0) { if (pQueryInfo->limit.offset > 0) {
if (pQueryInfo->limit.offset < pRes->numOfRows) { if (pQueryInfo->limit.offset < pRes->numOfRows) {
int32_t prevSize = pFinalDataPage->num; int32_t prevSize = (int32_t)pFinalDataPage->num;
tColModelErase(pLocalReducer->resColModel, pFinalDataPage, prevSize, 0, pQueryInfo->limit.offset - 1); tColModelErase(pLocalReducer->resColModel, pFinalDataPage, prevSize, 0, (int32_t)pQueryInfo->limit.offset - 1);
/* remove the hole in column model */ /* remove the hole in column model */
tColModelCompact(pLocalReducer->resColModel, pFinalDataPage, prevSize); tColModelCompact(pLocalReducer->resColModel, pFinalDataPage, prevSize);
...@@ -942,8 +942,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO ...@@ -942,8 +942,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
if (pQueryInfo->limit.limit >= 0 && pRes->numOfClauseTotal > pQueryInfo->limit.limit) { if (pQueryInfo->limit.limit >= 0 && pRes->numOfClauseTotal > pQueryInfo->limit.limit) {
/* impose the limitation of output rows on the final result */ /* impose the limitation of output rows on the final result */
int32_t prevSize = pFinalDataPage->num; int32_t prevSize = (int32_t)pFinalDataPage->num;
int32_t overflow = pRes->numOfClauseTotal - pQueryInfo->limit.limit; int32_t overflow = (int32_t)(pRes->numOfClauseTotal - pQueryInfo->limit.limit);
assert(overflow < pRes->numOfRows); assert(overflow < pRes->numOfRows);
pRes->numOfClauseTotal = pQueryInfo->limit.limit; pRes->numOfClauseTotal = pQueryInfo->limit.limit;
...@@ -1001,7 +1001,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO ...@@ -1001,7 +1001,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
} }
/* all output for current group are completed */ /* all output for current group are completed */
int32_t totalRemainRows = getFilledNumOfRes(pFillInfo, actualETime, pLocalReducer->resColModel->capacity); int32_t totalRemainRows = (int32_t)getFilledNumOfRes(pFillInfo, actualETime, pLocalReducer->resColModel->capacity);
if (totalRemainRows <= 0) { if (totalRemainRows <= 0) {
break; break;
} }
...@@ -1011,7 +1011,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO ...@@ -1011,7 +1011,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
if (pRes->numOfRows > 0) { if (pRes->numOfRows > 0) {
if (pQueryInfo->limit.limit >= 0 && pRes->numOfClauseTotal > pQueryInfo->limit.limit) { if (pQueryInfo->limit.limit >= 0 && pRes->numOfClauseTotal > pQueryInfo->limit.limit) {
int32_t overflow = pRes->numOfClauseTotal - pQueryInfo->limit.limit; int32_t overflow = (int32_t)(pRes->numOfClauseTotal - pQueryInfo->limit.limit);
pRes->numOfRows -= overflow; pRes->numOfRows -= overflow;
assert(pRes->numOfRows >= 0); assert(pRes->numOfRows >= 0);
...@@ -1279,7 +1279,7 @@ bool doGenerateFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool no ...@@ -1279,7 +1279,7 @@ bool doGenerateFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool no
SFillInfo* pFillInfo = pLocalReducer->pFillInfo; SFillInfo* pFillInfo = pLocalReducer->pFillInfo;
if (pFillInfo != NULL) { if (pFillInfo != NULL) {
taosFillSetStartInfo(pFillInfo, pResBuf->num, pQueryInfo->window.ekey); taosFillSetStartInfo(pFillInfo, (int32_t)pResBuf->num, pQueryInfo->window.ekey);
taosFillCopyInputDataFromOneFilePage(pFillInfo, pResBuf); taosFillCopyInputDataFromOneFilePage(pFillInfo, pResBuf);
} }
...@@ -1338,7 +1338,7 @@ static bool doBuildFilledResultForGroup(SSqlObj *pSql) { ...@@ -1338,7 +1338,7 @@ static bool doBuildFilledResultForGroup(SSqlObj *pSql) {
int64_t etime = *(int64_t *)(pFinalDataBuf->data + TSDB_KEYSIZE * (pFillInfo->numOfRows - 1)); int64_t etime = *(int64_t *)(pFinalDataBuf->data + TSDB_KEYSIZE * (pFillInfo->numOfRows - 1));
// the first column must be the timestamp column // the first column must be the timestamp column
int32_t rows = getFilledNumOfRes(pFillInfo, etime, pLocalReducer->resColModel->capacity); int32_t rows = (int32_t)getFilledNumOfRes(pFillInfo, etime, pLocalReducer->resColModel->capacity);
if (rows > 0) { // do fill gap if (rows > 0) { // do fill gap
doFillResult(pSql, pLocalReducer, false); doFillResult(pSql, pLocalReducer, false);
} }
...@@ -1367,7 +1367,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) { ...@@ -1367,7 +1367,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
int64_t etime = (pQueryInfo->window.skey < pQueryInfo->window.ekey) ? pQueryInfo->window.ekey : pQueryInfo->window.skey; int64_t etime = (pQueryInfo->window.skey < pQueryInfo->window.ekey) ? pQueryInfo->window.ekey : pQueryInfo->window.skey;
assert(pFillInfo->numOfRows == 0); assert(pFillInfo->numOfRows == 0);
int32_t rows = getFilledNumOfRes(pFillInfo, etime, pLocalReducer->resColModel->capacity); int32_t rows = (int32_t)getFilledNumOfRes(pFillInfo, etime, pLocalReducer->resColModel->capacity);
if (rows > 0) { // do interpo if (rows > 0) { // do interpo
doFillResult(pSql, pLocalReducer, true); doFillResult(pSql, pLocalReducer, true);
} }
......
...@@ -61,7 +61,7 @@ static int32_t tscToInteger(SSQLToken *pToken, int64_t *value, char **endPtr) { ...@@ -61,7 +61,7 @@ static int32_t tscToInteger(SSQLToken *pToken, int64_t *value, char **endPtr) {
if (v > INT64_MAX || v <= INT64_MIN) { if (v > INT64_MAX || v <= INT64_MIN) {
errno = ERANGE; errno = ERANGE;
} else { } else {
*value = v; *value = (int64_t)v;
} }
} }
...@@ -426,7 +426,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[ ...@@ -426,7 +426,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
*str += index; *str += index;
if (sToken.type == TK_QUESTION) { if (sToken.type == TK_QUESTION) {
uint32_t offset = start - pDataBlocks->pData; uint32_t offset = (uint32_t)(start - pDataBlocks->pData);
if (tscAddParamToDataBlock(pDataBlocks, pSchema->type, (uint8_t)timePrec, pSchema->bytes, offset) != NULL) { if (tscAddParamToDataBlock(pDataBlocks, pSchema->type, (uint8_t)timePrec, pSchema->bytes, offset) != NULL) {
continue; continue;
} }
...@@ -450,7 +450,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[ ...@@ -450,7 +450,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
char delim = sToken.z[0]; char delim = sToken.z[0];
int32_t cnt = 0; int32_t cnt = 0;
int32_t j = 0; int32_t j = 0;
for (int32_t k = 1; k < sToken.n - 1; ++k) { for (uint32_t k = 1; k < sToken.n - 1; ++k) {
if (sToken.z[k] == delim || sToken.z[k] == '\\') { if (sToken.z[k] == delim || sToken.z[k] == '\\') {
if (sToken.z[k + 1] == delim) { if (sToken.z[k + 1] == delim) {
cnt++; cnt++;
...@@ -504,7 +504,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[ ...@@ -504,7 +504,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
ptr += schema[i].bytes; ptr += schema[i].bytes;
} }
rowSize = ptr - payload; rowSize = (int32_t)(ptr - payload);
} }
return rowSize; return rowSize;
...@@ -846,7 +846,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { ...@@ -846,7 +846,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
if (TK_STRING == sToken.type) { if (TK_STRING == sToken.type) {
strdequote(sToken.z); strdequote(sToken.z);
sToken.n = strtrim(sToken.z); sToken.n = (uint32_t)strtrim(sToken.z);
} }
if (sToken.type == TK_RP) { if (sToken.type == TK_RP) {
...@@ -972,7 +972,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { ...@@ -972,7 +972,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
} }
} }
int32_t len = cend - cstart + 1; int32_t len = (int32_t)(cend - cstart + 1);
if (cstart != NULL && createTable == true) { if (cstart != NULL && createTable == true) {
/* move the column list to start position of the next accessed points */ /* move the column list to start position of the next accessed points */
memmove(sql - len, cstart, len); memmove(sql - len, cstart, len);
...@@ -1188,7 +1188,7 @@ int tsParseInsertSql(SSqlObj *pSql) { ...@@ -1188,7 +1188,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
if (TK_STRING == sToken.type) { if (TK_STRING == sToken.type) {
strdequote(sToken.z); strdequote(sToken.z);
sToken.n = strtrim(sToken.z); sToken.n = (uint32_t)strtrim(sToken.z);
} }
if (sToken.type == TK_RP) { if (sToken.type == TK_RP) {
...@@ -1426,7 +1426,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) { ...@@ -1426,7 +1426,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
char *tokenBuf = calloc(1, 4096); char *tokenBuf = calloc(1, 4096);
while ((readLen = getline(&line, &n, fp)) != -1) { while ((readLen = taosGetline(&line, &n, fp)) != -1) {
if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) {
line[--readLen] = 0; line[--readLen] = 0;
} }
...@@ -1471,7 +1471,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) { ...@@ -1471,7 +1471,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
pParentSql->fp = pParentSql->fetchFp; pParentSql->fp = pParentSql->fetchFp;
// all data has been sent to vnode, call user function // all data has been sent to vnode, call user function
int32_t v = (pParentSql->res.code != TSDB_CODE_SUCCESS) ? pParentSql->res.code : pParentSql->res.numOfRows; int32_t v = (pParentSql->res.code != TSDB_CODE_SUCCESS) ? pParentSql->res.code : (int32_t)pParentSql->res.numOfRows;
(*pParentSql->fp)(pParentSql->param, pParentSql, v); (*pParentSql->fp)(pParentSql->param, pParentSql, v);
} }
} }
......
...@@ -96,7 +96,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) { ...@@ -96,7 +96,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
} }
tscDebug("%p query time:%" PRId64 " sql:%s", pSql, pSql->res.useconds, pSql->sqlstr); tscDebug("%p query time:%" PRId64 " sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
int32_t sqlSize = TSDB_SLOW_QUERY_SQL_LEN + size; int32_t sqlSize = (int32_t)(TSDB_SLOW_QUERY_SQL_LEN + size);
char *sql = malloc(sqlSize); char *sql = malloc(sqlSize);
if (sql == NULL) { if (sql == NULL) {
......
...@@ -161,7 +161,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SSQLToken* pPwd) { ...@@ -161,7 +161,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SSQLToken* pPwd) {
} }
strdequote(pPwd->z); strdequote(pPwd->z);
pPwd->n = strtrim(pPwd->z); // trim space before and after passwords pPwd->n = (uint32_t)strtrim(pPwd->z); // trim space before and after passwords
if (pPwd->n <= 0) { if (pPwd->n <= 0) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
...@@ -1029,12 +1029,12 @@ static char* getAccountId(SSqlObj* pSql) { return pSql->pTscObj->acctId; } ...@@ -1029,12 +1029,12 @@ static char* getAccountId(SSqlObj* pSql) { return pSql->pTscObj->acctId; }
static void getCurrentDBName(SSqlObj* pSql, SSQLToken* pDBToken) { static void getCurrentDBName(SSqlObj* pSql, SSQLToken* pDBToken) {
pDBToken->z = pSql->pTscObj->db; pDBToken->z = pSql->pTscObj->db;
pDBToken->n = strlen(pSql->pTscObj->db); pDBToken->n = (uint32_t)strlen(pSql->pTscObj->db);
} }
/* length limitation, strstr cannot be applied */ /* length limitation, strstr cannot be applied */
static bool hasSpecifyDB(SSQLToken* pTableName) { static bool hasSpecifyDB(SSQLToken* pTableName) {
for (int32_t i = 0; i < pTableName->n; ++i) { for (uint32_t i = 0; i < pTableName->n; ++i) {
if (pTableName->z[i] == TS_PATH_DELIMITER[0]) { if (pTableName->z[i] == TS_PATH_DELIMITER[0]) {
return true; return true;
} }
...@@ -1047,7 +1047,7 @@ int32_t setObjFullName(char* fullName, const char* account, SSQLToken* pDB, SSQL ...@@ -1047,7 +1047,7 @@ int32_t setObjFullName(char* fullName, const char* account, SSQLToken* pDB, SSQL
int32_t totalLen = 0; int32_t totalLen = 0;
if (account != NULL) { if (account != NULL) {
int32_t len = strlen(account); int32_t len = (int32_t)strlen(account);
strcpy(fullName, account); strcpy(fullName, account);
fullName[len] = TS_PATH_DELIMITER[0]; fullName[len] = TS_PATH_DELIMITER[0];
totalLen += (len + 1); totalLen += (len + 1);
...@@ -1122,7 +1122,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel ...@@ -1122,7 +1122,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
} }
for (int32_t i = 0; i < pSelection->nExpr; ++i) { for (int32_t i = 0; i < pSelection->nExpr; ++i) {
int32_t outputIndex = tscSqlExprNumOfExprs(pQueryInfo); int32_t outputIndex = (int32_t)tscSqlExprNumOfExprs(pQueryInfo);
tSQLExprItem* pItem = &pSelection->a[i]; tSQLExprItem* pItem = &pSelection->a[i];
// project on all fields // project on all fields
...@@ -1205,7 +1205,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel ...@@ -1205,7 +1205,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
char* c = tbufGetData(&bw, true); char* c = tbufGetData(&bw, true);
// set the serialized binary string as the parameter of arithmetic expression // set the serialized binary string as the parameter of arithmetic expression
addExprParams(pExpr, c, TSDB_DATA_TYPE_BINARY, len, index.tableIndex); addExprParams(pExpr, c, TSDB_DATA_TYPE_BINARY, (int32_t)len, index.tableIndex);
insertResultField(pQueryInfo, i, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, pExpr->aliasName, pExpr); insertResultField(pQueryInfo, i, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, pExpr->aliasName, pExpr);
...@@ -1332,7 +1332,7 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn ...@@ -1332,7 +1332,7 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn
ids.num = 0; ids.num = 0;
} }
insertResultField(pQueryInfo, startPos, &ids, pExpr->resBytes, pExpr->resType, pExpr->aliasName, pExpr); insertResultField(pQueryInfo, startPos, &ids, pExpr->resBytes, (int8_t)pExpr->resType, pExpr->aliasName, pExpr);
} }
void tscAddSpecialColumnForSelect(SQueryInfo* pQueryInfo, int32_t outputColIndex, int16_t functionId, void tscAddSpecialColumnForSelect(SQueryInfo* pQueryInfo, int32_t outputColIndex, int16_t functionId,
...@@ -1395,7 +1395,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t ...@@ -1395,7 +1395,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
const char* msg0 = "invalid column name"; const char* msg0 = "invalid column name";
const char* msg1 = "tag for normal table query is not allowed"; const char* msg1 = "tag for normal table query is not allowed";
int32_t startPos = tscSqlExprNumOfExprs(pQueryInfo); int32_t startPos = (int32_t)tscSqlExprNumOfExprs(pQueryInfo);
if (pItem->pNode->nSQLOptr == TK_ALL) { // project on all fields if (pItem->pNode->nSQLOptr == TK_ALL) { // project on all fields
SColumnIndex index = COLUMN_INDEX_INITIALIZER; SColumnIndex index = COLUMN_INDEX_INITIALIZER;
...@@ -1486,7 +1486,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS ...@@ -1486,7 +1486,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
tscColumnListInsert(pQueryInfo->colList, &index); tscColumnListInsert(pQueryInfo->colList, &index);
SColumnList ids = getColumnList(1, pColIndex->tableIndex, pColIndex->columnIndex); SColumnList ids = getColumnList(1, pColIndex->tableIndex, pColIndex->columnIndex);
insertResultField(pQueryInfo, resColIdx, &ids, bytes, type, columnName, pExpr); insertResultField(pQueryInfo, resColIdx, &ids, bytes, (int8_t)type, columnName, pExpr);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1684,7 +1684,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -1684,7 +1684,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if (finalResult) { if (finalResult) {
int32_t numOfOutput = tscNumOfFields(pQueryInfo); int32_t numOfOutput = tscNumOfFields(pQueryInfo);
insertResultField(pQueryInfo, numOfOutput, &ids, pExpr->resBytes, pExpr->resType, pExpr->aliasName, pExpr); insertResultField(pQueryInfo, numOfOutput, &ids, pExpr->resBytes, (int32_t)pExpr->resType, pExpr->aliasName, pExpr);
} else { } else {
for (int32_t i = 0; i < ids.num; ++i) { for (int32_t i = 0; i < ids.num; ++i) {
tscColumnListInsert(pQueryInfo->colList, &(ids.ids[i])); tscColumnListInsert(pQueryInfo->colList, &(ids.ids[i]));
...@@ -1981,7 +1981,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -1981,7 +1981,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int32_t ret = getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0); int32_t ret = getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0);
assert(ret == TSDB_CODE_SUCCESS); assert(ret == TSDB_CODE_SUCCESS);
s.type = type; s.type = (uint8_t)type;
s.bytes = bytes; s.bytes = bytes;
TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY);
...@@ -2014,7 +2014,7 @@ void getColumnName(tSQLExprItem* pItem, char* resultFieldName, int32_t nameLengt ...@@ -2014,7 +2014,7 @@ void getColumnName(tSQLExprItem* pItem, char* resultFieldName, int32_t nameLengt
if (pItem->aliasName != NULL) { if (pItem->aliasName != NULL) {
strncpy(resultFieldName, pItem->aliasName, nameLength); strncpy(resultFieldName, pItem->aliasName, nameLength);
} else { } else {
int32_t len = (pItem->pNode->operand.n < nameLength) ? pItem->pNode->operand.n : nameLength; int32_t len = ((int32_t)pItem->pNode->operand.n < nameLength) ? (int32_t)pItem->pNode->operand.n : nameLength;
strncpy(resultFieldName, pItem->pNode->operand.z, len); strncpy(resultFieldName, pItem->pNode->operand.z, len);
} }
} }
...@@ -2383,7 +2383,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) { ...@@ -2383,7 +2383,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) {
if ((functionId >= TSDB_FUNC_SUM && functionId <= TSDB_FUNC_TWA) || if ((functionId >= TSDB_FUNC_SUM && functionId <= TSDB_FUNC_TWA) ||
(functionId >= TSDB_FUNC_FIRST_DST && functionId <= TSDB_FUNC_LAST_DST) || (functionId >= TSDB_FUNC_FIRST_DST && functionId <= TSDB_FUNC_LAST_DST) ||
(functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE)) { (functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE)) {
if (getResultDataInfo(pSrcSchema->type, pSrcSchema->bytes, functionId, pExpr->param[0].i64Key, &type, &bytes, if (getResultDataInfo(pSrcSchema->type, pSrcSchema->bytes, functionId, (int32_t)pExpr->param[0].i64Key, &type, &bytes,
&interBytes, 0, true) != TSDB_CODE_SUCCESS) { &interBytes, 0, true) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_SQL; return TSDB_CODE_TSC_INVALID_SQL;
} }
...@@ -3144,7 +3144,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQuer ...@@ -3144,7 +3144,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQuer
return TSDB_CODE_TSC_INVALID_SQL; return TSDB_CODE_TSC_INVALID_SQL;
} }
int32_t outputIndex = tscSqlExprNumOfExprs(pQueryInfo); int32_t outputIndex = (int32_t)tscSqlExprNumOfExprs(pQueryInfo);
tSQLExprItem item = {.pNode = pExpr, .aliasName = NULL}; tSQLExprItem item = {.pNode = pExpr, .aliasName = NULL};
...@@ -3633,7 +3633,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, ...@@ -3633,7 +3633,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
num = j; num = j;
char* name = extractDBName(pTableMetaInfo->name, db); char* name = extractDBName(pTableMetaInfo->name, db);
SSQLToken dbToken = {.type = TK_STRING, .z = name, .n = strlen(name)}; SSQLToken dbToken = { .type = TK_STRING, .z = name, .n = (uint32_t)strlen(name) };
for (int32_t i = 0; i < num; ++i) { for (int32_t i = 0; i < num; ++i) {
if (i >= 1) { if (i >= 1) {
...@@ -3641,7 +3641,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, ...@@ -3641,7 +3641,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
} }
char idBuf[TSDB_TABLE_ID_LEN] = {0}; char idBuf[TSDB_TABLE_ID_LEN] = {0};
int32_t xlen = strlen(segments[i]); int32_t xlen = (int32_t)strlen(segments[i]);
SSQLToken t = {.z = segments[i], .n = xlen, .type = TK_STRING}; SSQLToken t = {.z = segments[i], .n = xlen, .type = TK_STRING};
int32_t ret = setObjFullName(idBuf, account, &dbToken, &t, &xlen); int32_t ret = setObjFullName(idBuf, account, &dbToken, &t, &xlen);
...@@ -4110,10 +4110,10 @@ int32_t parseFillClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQuery ...@@ -4110,10 +4110,10 @@ int32_t parseFillClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQuery
startPos = 0; startPos = 0;
if (numOfFillVal > size) { if (numOfFillVal > size) {
numOfFillVal = size; numOfFillVal = (int32_t)size;
} }
} else { } else {
numOfFillVal = (pFillToken->nExpr > size) ? size : pFillToken->nExpr; numOfFillVal = (pFillToken->nExpr > (int32_t)size) ? (int32_t)size : pFillToken->nExpr;
} }
int32_t j = 1; int32_t j = 1;
...@@ -4776,7 +4776,7 @@ int32_t validateLocalConfig(tDCLSQL* pOptions) { ...@@ -4776,7 +4776,7 @@ int32_t validateLocalConfig(tDCLSQL* pOptions) {
} }
int32_t validateColumnName(char* name) { int32_t validateColumnName(char* name) {
bool ret = isKeyWord(name, strlen(name)); bool ret = isKeyWord(name, (int32_t)strlen(name));
if (ret) { if (ret) {
return TSDB_CODE_TSC_INVALID_SQL; return TSDB_CODE_TSC_INVALID_SQL;
} }
...@@ -4790,7 +4790,7 @@ int32_t validateColumnName(char* name) { ...@@ -4790,7 +4790,7 @@ int32_t validateColumnName(char* name) {
if (token.type == TK_STRING) { if (token.type == TK_STRING) {
strdequote(token.z); strdequote(token.z);
token.n = strtrim(token.z); token.n = (uint32_t)strtrim(token.z);
int32_t k = tSQLGetToken(token.z, &token.type); int32_t k = tSQLGetToken(token.z, &token.type);
if (k != token.n) { if (k != token.n) {
...@@ -4935,17 +4935,17 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* ...@@ -4935,17 +4935,17 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo*
if (pKeep != NULL) { if (pKeep != NULL) {
switch (pKeep->nExpr) { switch (pKeep->nExpr) {
case 1: case 1:
pMsg->daysToKeep = htonl(pKeep->a[0].pVar.i64Key); pMsg->daysToKeep = htonl((int32_t)pKeep->a[0].pVar.i64Key);
break; break;
case 2: { case 2: {
pMsg->daysToKeep = htonl(pKeep->a[0].pVar.i64Key); pMsg->daysToKeep = htonl((int32_t)pKeep->a[0].pVar.i64Key);
pMsg->daysToKeep1 = htonl(pKeep->a[1].pVar.i64Key); pMsg->daysToKeep1 = htonl((int32_t)pKeep->a[1].pVar.i64Key);
break; break;
} }
case 3: { case 3: {
pMsg->daysToKeep = htonl(pKeep->a[0].pVar.i64Key); pMsg->daysToKeep = htonl((int32_t)pKeep->a[0].pVar.i64Key);
pMsg->daysToKeep1 = htonl(pKeep->a[1].pVar.i64Key); pMsg->daysToKeep1 = htonl((int32_t)pKeep->a[1].pVar.i64Key);
pMsg->daysToKeep2 = htonl(pKeep->a[2].pVar.i64Key); pMsg->daysToKeep2 = htonl((int32_t)pKeep->a[2].pVar.i64Key);
break; break;
} }
default: { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } default: { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); }
...@@ -4984,7 +4984,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { ...@@ -4984,7 +4984,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
pMsg->cacheBlockSize = htonl(pCreateDb->cacheBlockSize); pMsg->cacheBlockSize = htonl(pCreateDb->cacheBlockSize);
pMsg->totalBlocks = htonl(pCreateDb->numOfBlocks); pMsg->totalBlocks = htonl(pCreateDb->numOfBlocks);
pMsg->daysPerFile = htonl(pCreateDb->daysPerFile); pMsg->daysPerFile = htonl(pCreateDb->daysPerFile);
pMsg->commitTime = htonl(pCreateDb->commitTime); pMsg->commitTime = htonl((int32_t)pCreateDb->commitTime);
pMsg->minRowsPerFileBlock = htonl(pCreateDb->minRowsPerBlock); pMsg->minRowsPerFileBlock = htonl(pCreateDb->minRowsPerBlock);
pMsg->maxRowsPerFileBlock = htonl(pCreateDb->maxRowsPerBlock); pMsg->maxRowsPerFileBlock = htonl(pCreateDb->maxRowsPerBlock);
pMsg->fsyncPeriod = htonl(pCreateDb->fsyncPeriod); pMsg->fsyncPeriod = htonl(pCreateDb->fsyncPeriod);
...@@ -5041,7 +5041,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau ...@@ -5041,7 +5041,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex); SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex);
size_t size = taosArrayGetSize(pQueryInfo->exprList); size_t size = taosArrayGetSize(pQueryInfo->exprList);
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, size - 1); SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, (int32_t)size - 1);
if (pExpr->functionId != TSDB_FUNC_TAG) { if (pExpr->functionId != TSDB_FUNC_TAG) {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, tableIndex); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, tableIndex);
...@@ -5058,7 +5058,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau ...@@ -5058,7 +5058,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
// NOTE: tag column does not add to source column list // NOTE: tag column does not add to source column list
SColumnList ids = {0}; SColumnList ids = {0};
insertResultField(pQueryInfo, size, &ids, bytes, type, name, pExpr); insertResultField(pQueryInfo, (int32_t)size, &ids, bytes, (int8_t)type, name, pExpr);
int32_t relIndex = index.columnIndex; int32_t relIndex = index.columnIndex;
...@@ -5088,9 +5088,9 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) { ...@@ -5088,9 +5088,9 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) {
SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, pColIndex->colIndex); SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, pColIndex->colIndex);
SColumnIndex colIndex = {.tableIndex = 0, .columnIndex = pColIndex->colIndex}; SColumnIndex colIndex = {.tableIndex = 0, .columnIndex = pColIndex->colIndex};
tscAddSpecialColumnForSelect(pQueryInfo, size, TSDB_FUNC_PRJ, &colIndex, pSchema, TSDB_COL_NORMAL); tscAddSpecialColumnForSelect(pQueryInfo, (int32_t)size, TSDB_FUNC_PRJ, &colIndex, pSchema, TSDB_COL_NORMAL);
SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, size); SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, (int32_t)size);
doLimitOutputNormalColOfGroupby(pInfo->pSqlExpr); doLimitOutputNormalColOfGroupby(pInfo->pSqlExpr);
pInfo->visible = false; pInfo->visible = false;
} }
...@@ -5118,7 +5118,7 @@ static void doUpdateSqlFunctionForTagPrj(SQueryInfo* pQueryInfo) { ...@@ -5118,7 +5118,7 @@ static void doUpdateSqlFunctionForTagPrj(SQueryInfo* pQueryInfo) {
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i);
if (pExpr->functionId != TSDB_FUNC_TAG_DUMMY && pExpr->functionId != TSDB_FUNC_TS_DUMMY) { if (pExpr->functionId != TSDB_FUNC_TAG_DUMMY && pExpr->functionId != TSDB_FUNC_TS_DUMMY) {
SSchema* pColSchema = &pSchema[pExpr->colInfo.colIndex]; SSchema* pColSchema = &pSchema[pExpr->colInfo.colIndex];
getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, pExpr->param[0].i64Key, &pExpr->resType, getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, (int32_t)pExpr->param[0].i64Key, &pExpr->resType,
&pExpr->resBytes, &pExpr->interBytes, tagLength, true); &pExpr->resBytes, &pExpr->interBytes, tagLength, true);
} }
} }
...@@ -5343,7 +5343,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo ...@@ -5343,7 +5343,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo
// NOTE: tag column does not add to source column list // NOTE: tag column does not add to source column list
SColumnList ids = getColumnList(1, 0, pColIndex->colIndex); SColumnList ids = getColumnList(1, 0, pColIndex->colIndex);
insertResultField(pQueryInfo, size, &ids, bytes, type, name, pExpr); insertResultField(pQueryInfo, (int32_t)size, &ids, bytes, (int8_t)type, name, pExpr);
} else { } else {
// if this query is "group by" normal column, interval is not allowed // if this query is "group by" normal column, interval is not allowed
if (pQueryInfo->intervalTime > 0) { if (pQueryInfo->intervalTime > 0) {
...@@ -5584,7 +5584,7 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) { ...@@ -5584,7 +5584,7 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) { void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex); SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex);
int32_t size = tscSqlExprNumOfExprs(pQueryInfo); int32_t size = (int32_t)tscSqlExprNumOfExprs(pQueryInfo);
if (size == 0) { if (size == 0) {
return; return;
} }
...@@ -6028,7 +6028,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { ...@@ -6028,7 +6028,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
// in case of join query, time range is required. // in case of join query, time range is required.
if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) {
int64_t timeRange = labs(pQueryInfo->window.skey - pQueryInfo->window.ekey); int64_t timeRange = ABS(pQueryInfo->window.skey - pQueryInfo->window.ekey);
if (timeRange == 0 && pQueryInfo->window.skey == 0) { if (timeRange == 0 && pQueryInfo->window.skey == 0) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
...@@ -6055,7 +6055,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { ...@@ -6055,7 +6055,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
} }
if (pQueryInfo->intervalTime > 0) { if (pQueryInfo->intervalTime > 0) {
int64_t timeRange = labs(pQueryInfo->window.skey - pQueryInfo->window.ekey); int64_t timeRange = ABS(pQueryInfo->window.skey - pQueryInfo->window.ekey);
// number of result is not greater than 10,000,000 // number of result is not greater than 10,000,000
if ((timeRange == 0) || (timeRange / pQueryInfo->intervalTime) > MAX_RETRIEVE_ROWS_IN_INTERVAL_QUERY) { if ((timeRange == 0) || (timeRange / pQueryInfo->intervalTime) > MAX_RETRIEVE_ROWS_IN_INTERVAL_QUERY) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
...@@ -6111,7 +6111,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS ...@@ -6111,7 +6111,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS
SSqlExpr* p1 = taosArrayGetP(pExprInfo, i); SSqlExpr* p1 = taosArrayGetP(pExprInfo, i);
if (strcmp((*pExpr)->pSchema->name, p1->aliasName) == 0) { if (strcmp((*pExpr)->pSchema->name, p1->aliasName) == 0) {
(*pExpr)->pSchema->type = p1->resType; (*pExpr)->pSchema->type = (uint8_t)p1->resType;
(*pExpr)->pSchema->bytes = p1->resBytes; (*pExpr)->pSchema->bytes = p1->resBytes;
break; break;
} }
......
...@@ -208,7 +208,7 @@ char* tsGetTagsValue(STableMeta* pTableMeta) { ...@@ -208,7 +208,7 @@ char* tsGetTagsValue(STableMeta* pTableMeta) {
} }
// todo refactor // todo refactor
__attribute__ ((unused))static FORCE_INLINE char* skipSegments(char* input, char delim, int32_t num) { UNUSED_FUNC static FORCE_INLINE char* skipSegments(char* input, char delim, int32_t num) {
for (int32_t i = 0; i < num; ++i) { for (int32_t i = 0; i < num; ++i) {
while (*input != 0 && *input++ != delim) { while (*input != 0 && *input++ != delim) {
}; };
...@@ -216,7 +216,7 @@ __attribute__ ((unused))static FORCE_INLINE char* skipSegments(char* input, char ...@@ -216,7 +216,7 @@ __attribute__ ((unused))static FORCE_INLINE char* skipSegments(char* input, char
return input; return input;
} }
__attribute__ ((unused)) static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) { UNUSED_FUNC static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) {
size_t len = 0; size_t len = 0;
while (*src != delimiter && *src != 0) { while (*src != delimiter && *src != 0) {
*dst++ = *src++; *dst++ = *src++;
......
...@@ -377,7 +377,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) { ...@@ -377,7 +377,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
} }
if (rpcMsg->code != TSDB_CODE_TSC_ACTION_IN_PROGRESS) { if (rpcMsg->code != TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS)? pRes->numOfRows: pRes->code; rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? (int32_t)pRes->numOfRows : pRes->code;
bool shouldFree = tscShouldBeFreed(pSql); bool shouldFree = tscShouldBeFreed(pSql);
(*pSql->fp)(pSql->param, pSql, rpcMsg->code); (*pSql->fp)(pSql->param, pSql, rpcMsg->code);
...@@ -569,10 +569,10 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) { ...@@ -569,10 +569,10 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
const static int32_t MIN_QUERY_MSG_PKT_SIZE = TSDB_MAX_BYTES_PER_ROW * 5; const static int32_t MIN_QUERY_MSG_PKT_SIZE = TSDB_MAX_BYTES_PER_ROW * 5;
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, clauseIndex); SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, clauseIndex);
int32_t srcColListSize = taosArrayGetSize(pQueryInfo->colList) * sizeof(SColumnInfo); int32_t srcColListSize = (int32_t)(taosArrayGetSize(pQueryInfo->colList) * sizeof(SColumnInfo));
size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo);
int32_t exprSize = sizeof(SSqlFuncMsg) * numOfExprs; int32_t exprSize = (int32_t)(sizeof(SSqlFuncMsg) * numOfExprs);
return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize + 4096; return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize + 4096;
} }
...@@ -612,7 +612,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char ...@@ -612,7 +612,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
pMsg += sizeof(STableIdInfo); pMsg += sizeof(STableIdInfo);
} else { // it is a subquery of the super table query, this EP info is acquired from vgroupInfo } else { // it is a subquery of the super table query, this EP info is acquired from vgroupInfo
int32_t index = pTableMetaInfo->vgroupIndex; int32_t index = pTableMetaInfo->vgroupIndex;
int32_t numOfVgroups = taosArrayGetSize(pTableMetaInfo->pVgroupTables); int32_t numOfVgroups = (int32_t)taosArrayGetSize(pTableMetaInfo->pVgroupTables);
assert(index >= 0 && index < numOfVgroups); assert(index >= 0 && index < numOfVgroups);
tscDebug("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, numOfVgroups); tscDebug("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, numOfVgroups);
...@@ -623,7 +623,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char ...@@ -623,7 +623,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
tscSetDnodeEpSet(pSql, &pTableIdList->vgInfo); tscSetDnodeEpSet(pSql, &pTableIdList->vgInfo);
pQueryMsg->head.vgId = htonl(pTableIdList->vgInfo.vgId); pQueryMsg->head.vgId = htonl(pTableIdList->vgInfo.vgId);
int32_t numOfTables = taosArrayGetSize(pTableIdList->itemList); int32_t numOfTables = (int32_t)taosArrayGetSize(pTableIdList->itemList);
pQueryMsg->numOfTables = htonl(numOfTables); // set the number of tables pQueryMsg->numOfTables = htonl(numOfTables); // set the number of tables
// serialize each table id info // serialize each table id info
...@@ -675,7 +675,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -675,7 +675,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SQueryTableMsg *pQueryMsg = (SQueryTableMsg *)pCmd->payload; SQueryTableMsg *pQueryMsg = (SQueryTableMsg *)pCmd->payload;
int32_t numOfTags = taosArrayGetSize(pTableMetaInfo->tagColList); int32_t numOfTags = (int32_t)taosArrayGetSize(pTableMetaInfo->tagColList);
if (pQueryInfo->order.order == TSDB_ORDER_ASC) { if (pQueryInfo->order.order == TSDB_ORDER_ASC) {
pQueryMsg->window.skey = htobe64(pQueryInfo->window.skey); pQueryMsg->window.skey = htobe64(pQueryInfo->window.skey);
...@@ -690,7 +690,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -690,7 +690,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg->fillType = htons(pQueryInfo->fillType); pQueryMsg->fillType = htons(pQueryInfo->fillType);
pQueryMsg->limit = htobe64(pQueryInfo->limit.limit); pQueryMsg->limit = htobe64(pQueryInfo->limit.limit);
pQueryMsg->offset = htobe64(pQueryInfo->limit.offset); pQueryMsg->offset = htobe64(pQueryInfo->limit.offset);
pQueryMsg->numOfCols = htons(taosArrayGetSize(pQueryInfo->colList)); pQueryMsg->numOfCols = htons((int16_t)taosArrayGetSize(pQueryInfo->colList));
pQueryMsg->intervalTime = htobe64(pQueryInfo->intervalTime); pQueryMsg->intervalTime = htobe64(pQueryInfo->intervalTime);
pQueryMsg->slidingTime = htobe64(pQueryInfo->slidingTime); pQueryMsg->slidingTime = htobe64(pQueryInfo->slidingTime);
pQueryMsg->slidingTimeUnit = pQueryInfo->slidingTimeUnit; pQueryMsg->slidingTimeUnit = pQueryInfo->slidingTimeUnit;
...@@ -700,7 +700,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -700,7 +700,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg->queryType = htonl(pQueryInfo->type); pQueryMsg->queryType = htonl(pQueryInfo->type);
size_t numOfOutput = tscSqlExprNumOfExprs(pQueryInfo); size_t numOfOutput = tscSqlExprNumOfExprs(pQueryInfo);
pQueryMsg->numOfOutput = htons(numOfOutput); pQueryMsg->numOfOutput = htons((int16_t)numOfOutput);
// set column list ids // set column list ids
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList); size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
...@@ -872,7 +872,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -872,7 +872,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
// compressed ts block // compressed ts block
pQueryMsg->tsOffset = htonl(pMsg - pCmd->payload); pQueryMsg->tsOffset = htonl((int32_t)(pMsg - pCmd->payload));
int32_t tsLen = 0; int32_t tsLen = 0;
int32_t numOfBlocks = 0; int32_t numOfBlocks = 0;
...@@ -905,7 +905,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -905,7 +905,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg->tsOrder = htonl(pQueryInfo->tsBuf->tsOrder); pQueryMsg->tsOrder = htonl(pQueryInfo->tsBuf->tsOrder);
} }
int32_t msgLen = pMsg - pCmd->payload; int32_t msgLen = (int32_t)(pMsg - pCmd->payload);
tscDebug("%p msg built success,len:%d bytes", pSql, msgLen); tscDebug("%p msg built success,len:%d bytes", pSql, msgLen);
pCmd->payloadLen = msgLen; pCmd->payloadLen = msgLen;
...@@ -1005,7 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1005,7 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SUserInfo *pUser = &pInfo->pDCLInfo->user; SUserInfo *pUser = &pInfo->pDCLInfo->user;
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n); strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
pAlterMsg->flag = pUser->type; pAlterMsg->flag = (int8_t)pUser->type;
if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) { if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
pAlterMsg->privilege = (char)pCmd->count; pAlterMsg->privilege = (char)pCmd->count;
...@@ -1280,7 +1280,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1280,7 +1280,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
tscFieldInfoClear(&pQueryInfo->fieldsInfo); tscFieldInfoClear(&pQueryInfo->fieldsInfo);
msgLen = pMsg - (char*)pCreateTableMsg; msgLen = (int32_t)(pMsg - (char*)pCreateTableMsg);
pCreateTableMsg->contLen = htonl(msgLen); pCreateTableMsg->contLen = htonl(msgLen);
pCmd->payloadLen = msgLen; pCmd->payloadLen = msgLen;
pCmd->msgType = TSDB_MSG_TYPE_CM_CREATE_TABLE; pCmd->msgType = TSDB_MSG_TYPE_CM_CREATE_TABLE;
...@@ -1333,7 +1333,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1333,7 +1333,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
memcpy(pMsg, pAlterInfo->tagData.data, pAlterInfo->tagData.dataLen); memcpy(pMsg, pAlterInfo->tagData.data, pAlterInfo->tagData.dataLen);
pMsg += pAlterInfo->tagData.dataLen; pMsg += pAlterInfo->tagData.dataLen;
msgLen = pMsg - (char*)pAlterTableMsg; msgLen = (int32_t)(pMsg - (char*)pAlterTableMsg);
pCmd->payloadLen = msgLen; pCmd->payloadLen = msgLen;
pCmd->msgType = TSDB_MSG_TYPE_CM_ALTER_TABLE; pCmd->msgType = TSDB_MSG_TYPE_CM_ALTER_TABLE;
...@@ -1534,12 +1534,12 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1534,12 +1534,12 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg += len; pMsg += len;
} }
pCmd->payloadLen = pMsg - (char*)pInfoMsg; pCmd->payloadLen = (int32_t)(pMsg - (char*)pInfoMsg);
pCmd->msgType = TSDB_MSG_TYPE_CM_TABLE_META; pCmd->msgType = TSDB_MSG_TYPE_CM_TABLE_META;
taosTFree(tmpData); taosTFree(tmpData);
assert(msgLen + minMsgSize() <= pCmd->allocSize); assert(msgLen + minMsgSize() <= (int32_t)pCmd->allocSize);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1631,7 +1631,7 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1631,7 +1631,7 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
pCmd->msgType = TSDB_MSG_TYPE_CM_STABLE_VGROUP; pCmd->msgType = TSDB_MSG_TYPE_CM_STABLE_VGROUP;
pCmd->payloadLen = (pMsg - pCmd->payload); pCmd->payloadLen = (int32_t)(pMsg - pCmd->payload);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -85,7 +85,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con ...@@ -85,7 +85,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
taosEncryptPass((uint8_t *)pass, strlen(pass), pObj->pass); taosEncryptPass((uint8_t *)pass, strlen(pass), pObj->pass);
if (db) { if (db) {
int32_t len = strlen(db); int32_t len = (int32_t)strlen(db);
/* db name is too long */ /* db name is too long */
if (len >= TSDB_DB_NAME_LEN) { if (len >= TSDB_DB_NAME_LEN) {
terrno = TSDB_CODE_TSC_INVALID_DB_LENGTH; terrno = TSDB_CODE_TSC_INVALID_DB_LENGTH;
...@@ -240,7 +240,7 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) { ...@@ -240,7 +240,7 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) {
return NULL; return NULL;
} }
int32_t sqlLen = strlen(sqlstr); int32_t sqlLen = (int32_t)strlen(sqlstr);
if (sqlLen > tsMaxSQLStringLen) { if (sqlLen > tsMaxSQLStringLen) {
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen); tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
terrno = TSDB_CODE_TSC_INVALID_SQL; terrno = TSDB_CODE_TSC_INVALID_SQL;
...@@ -269,7 +269,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) { ...@@ -269,7 +269,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) {
return NULL; return NULL;
} }
if (sqlLen > tsMaxSQLStringLen) { if (sqlLen > (uint32_t)tsMaxSQLStringLen) {
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen); tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
terrno = TSDB_CODE_TSC_INVALID_SQL; terrno = TSDB_CODE_TSC_INVALID_SQL;
return NULL; return NULL;
...@@ -328,7 +328,7 @@ int taos_affected_rows(TAOS_RES *tres) { ...@@ -328,7 +328,7 @@ int taos_affected_rows(TAOS_RES *tres) {
SSqlObj* pSql = (SSqlObj*) tres; SSqlObj* pSql = (SSqlObj*) tres;
if (pSql == NULL || pSql->signature != pSql) return 0; if (pSql == NULL || pSql->signature != pSql) return 0;
return (pSql->res.numOfRows); return (int)(pSql->res.numOfRows);
} }
TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
...@@ -363,7 +363,7 @@ int taos_retrieve(TAOS_RES *res) { ...@@ -363,7 +363,7 @@ int taos_retrieve(TAOS_RES *res) {
} }
tscProcessSql(pSql); tscProcessSql(pSql);
return pRes->numOfRows; return (int)pRes->numOfRows;
} }
int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) { int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
...@@ -404,7 +404,7 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) { ...@@ -404,7 +404,7 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
*rows = pRes->tsrow; *rows = pRes->tsrow;
return (pQueryInfo->order.order == TSDB_ORDER_DESC) ? pRes->numOfRows : -pRes->numOfRows; return (int)((pQueryInfo->order.order == TSDB_ORDER_DESC) ? pRes->numOfRows : -pRes->numOfRows);
} }
TAOS_ROW taos_fetch_row(TAOS_RES *res) { TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...@@ -749,7 +749,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) { ...@@ -749,7 +749,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
tscDebug("%p Valid SQL: %s pObj:%p", pSql, sql, pObj); tscDebug("%p Valid SQL: %s pObj:%p", pSql, sql, pObj);
int32_t sqlLen = strlen(sql); int32_t sqlLen = (int32_t)strlen(sql);
if (sqlLen > tsMaxSQLStringLen) { if (sqlLen > tsMaxSQLStringLen) {
tscError("%p sql too long", pSql); tscError("%p sql too long", pSql);
pRes->code = TSDB_CODE_TSC_INVALID_SQL; pRes->code = TSDB_CODE_TSC_INVALID_SQL;
...@@ -822,11 +822,11 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t ...@@ -822,11 +822,11 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
} }
memcpy(tblName, str, nextStr - str); memcpy(tblName, str, nextStr - str);
int32_t len = nextStr - str; int32_t len = (int32_t)(nextStr - str);
tblName[len] = '\0'; tblName[len] = '\0';
str = nextStr + 1; str = nextStr + 1;
len = strtrim(tblName); len = (int32_t)strtrim(tblName);
SSQLToken sToken = {.n = len, .type = TK_ID, .z = tblName}; SSQLToken sToken = {.n = len, .type = TK_ID, .z = tblName};
tSQLGetToken(tblName, &sToken.type); tSQLGetToken(tblName, &sToken.type);
...@@ -892,7 +892,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { ...@@ -892,7 +892,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
assert(pSql->fp == NULL); assert(pSql->fp == NULL);
tscDebug("%p tableNameList: %s pObj:%p", pSql, tableNameList, pObj); tscDebug("%p tableNameList: %s pObj:%p", pSql, tableNameList, pObj);
int32_t tblListLen = strlen(tableNameList); int32_t tblListLen = (int32_t)strlen(tableNameList);
if (tblListLen > MAX_TABLE_NAME_LENGTH) { if (tblListLen > MAX_TABLE_NAME_LENGTH) {
tscError("%p tableNameList too long, length:%d, maximum allowed:%d", pSql, tblListLen, MAX_TABLE_NAME_LENGTH); tscError("%p tableNameList too long, length:%d, maximum allowed:%d", pSql, tblListLen, MAX_TABLE_NAME_LENGTH);
pRes->code = TSDB_CODE_TSC_INVALID_SQL; pRes->code = TSDB_CODE_TSC_INVALID_SQL;
......
...@@ -47,14 +47,14 @@ static bool isProjectStream(SQueryInfo* pQueryInfo) { ...@@ -47,14 +47,14 @@ static bool isProjectStream(SQueryInfo* pQueryInfo) {
} }
static int64_t tscGetRetryDelayTime(int64_t slidingTime, int16_t prec) { static int64_t tscGetRetryDelayTime(int64_t slidingTime, int16_t prec) {
float retryRangeFactor = 0.3; float retryRangeFactor = 0.3f;
// change to ms // change to ms
if (prec == TSDB_TIME_PRECISION_MICRO) { if (prec == TSDB_TIME_PRECISION_MICRO) {
slidingTime = slidingTime / 1000; slidingTime = slidingTime / 1000;
} }
int64_t retryDelta = (int64_t)tsStreamCompRetryDelay * retryRangeFactor; int64_t retryDelta = (int64_t)(tsStreamCompRetryDelay * retryRangeFactor);
retryDelta = ((rand() % retryDelta) + tsStreamCompRetryDelay) * 1000L; retryDelta = ((rand() % retryDelta) + tsStreamCompRetryDelay) * 1000L;
if (slidingTime < retryDelta) { if (slidingTime < retryDelta) {
...@@ -299,7 +299,7 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer) ...@@ -299,7 +299,7 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
pSql->cmd.command = TSDB_SQL_SELECT; pSql->cmd.command = TSDB_SQL_SELECT;
// start timer for next computing // start timer for next computing
taosTmrReset(tscProcessStreamTimer, timer, pStream, tscTmr, &pStream->pTimer); taosTmrReset(tscProcessStreamTimer, (int32_t)timer, pStream, tscTmr, &pStream->pTimer);
} }
static int64_t getLaunchTimeDelay(const SSqlStream* pStream) { static int64_t getLaunchTimeDelay(const SSqlStream* pStream) {
...@@ -314,7 +314,7 @@ static int64_t getLaunchTimeDelay(const SSqlStream* pStream) { ...@@ -314,7 +314,7 @@ static int64_t getLaunchTimeDelay(const SSqlStream* pStream) {
int64_t remainTimeWindow = pStream->slidingTime - delayDelta; int64_t remainTimeWindow = pStream->slidingTime - delayDelta;
if (maxDelay > remainTimeWindow) { if (maxDelay > remainTimeWindow) {
maxDelay = (remainTimeWindow / 1.5); maxDelay = (int64_t)(remainTimeWindow / 1.5f);
} }
int64_t currentDelay = (rand() % maxDelay); // a random number int64_t currentDelay = (rand() % maxDelay); // a random number
...@@ -505,7 +505,7 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) { ...@@ -505,7 +505,7 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) {
int64_t starttime = tscGetLaunchTimestamp(pStream); int64_t starttime = tscGetLaunchTimestamp(pStream);
pCmd->command = TSDB_SQL_SELECT; pCmd->command = TSDB_SQL_SELECT;
taosTmrReset(tscProcessStreamTimer, starttime, pStream, tscTmr, &pStream->pTimer); taosTmrReset(tscProcessStreamTimer, (int32_t)starttime, pStream, tscTmr, &pStream->pTimer);
tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql, tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql,
pStream, pTableMetaInfo->name, pStream->interval, pStream->slidingTime, starttime, pSql->sqlstr); pStream, pTableMetaInfo->name, pStream->interval, pStream->slidingTime, starttime, pSql->sqlstr);
......
...@@ -21,6 +21,7 @@ extern "C" { ...@@ -21,6 +21,7 @@ extern "C" {
#endif #endif
#define POW2(x) ((x) * (x)) #define POW2(x) ((x) * (x))
#define ABS(x) ((x) > 0 ? (x) : (-x))
#ifndef TAOS_OS_FUNC_MATH #ifndef TAOS_OS_FUNC_MATH
#define SWAP(a, b, c) \ #define SWAP(a, b, c) \
......
...@@ -90,11 +90,9 @@ extern "C" { ...@@ -90,11 +90,9 @@ extern "C" {
#define taosWriteSocket(fd, buf, len) send((SOCKET)fd, buf, len, 0) #define taosWriteSocket(fd, buf, len) send((SOCKET)fd, buf, len, 0)
#define taosReadSocket(fd, buf, len) recv((SOCKET)fd, buf, len, 0) #define taosReadSocket(fd, buf, len) recv((SOCKET)fd, buf, len, 0)
#define taosCloseSocket(fd) closesocket((SOCKET)fd) #define taosCloseSocket(fd) closesocket((SOCKET)fd)
typedef SOCKET eventfd_t; typedef SOCKET eventfd_t;
#define eventfd(a, b) -1 #define eventfd(a, b) -1
#define TAOS_OS_FUNC_STRING_WCHAR #define TAOS_OS_FUNC_STRING_WCHAR
int twcslen(const wchar_t *wcs); int twcslen(const wchar_t *wcs);
#define TAOS_OS_FUNC_STRING_GETLINE #define TAOS_OS_FUNC_STRING_GETLINE
......
...@@ -155,14 +155,14 @@ int64_t getFilledNumOfRes(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows ...@@ -155,14 +155,14 @@ int64_t getFilledNumOfRes(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows
if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set. if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set.
TSKEY lastKey = tsList[pFillInfo->numOfRows - 1]; TSKEY lastKey = tsList[pFillInfo->numOfRows - 1];
numOfRes = (int64_t)(labs(lastKey - pFillInfo->start) / pFillInfo->slidingTime) + 1; numOfRes = (int64_t)(ABS(lastKey - pFillInfo->start) / pFillInfo->slidingTime) + 1;
assert(numOfRes >= numOfRows); assert(numOfRes >= numOfRows);
} else { // reach the end of data } else { // reach the end of data
if ((ekey1 < pFillInfo->start && FILL_IS_ASC_FILL(pFillInfo)) || if ((ekey1 < pFillInfo->start && FILL_IS_ASC_FILL(pFillInfo)) ||
(ekey1 > pFillInfo->start && !FILL_IS_ASC_FILL(pFillInfo))) { (ekey1 > pFillInfo->start && !FILL_IS_ASC_FILL(pFillInfo))) {
return 0; return 0;
} else { // the numOfRes rows are all filled with specified policy } else { // the numOfRes rows are all filled with specified policy
numOfRes = (labs(ekey1 - pFillInfo->start) / pFillInfo->slidingTime) + 1; numOfRes = (ABS(ekey1 - pFillInfo->start) / pFillInfo->slidingTime) + 1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册