From fc2688d5438103eaffc5fe78897eafa218240b4c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 4 Jun 2021 07:43:59 +0800 Subject: [PATCH] [TD-4426] merge in --- src/client/src/tscSQLParser.c | 15 ++++++--------- src/tsdb/src/tsdbRead.c | 3 ++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index bcd3e294d1..7d6a5c30da 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -160,22 +160,20 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst) { tSqlExprItem* item = (tSqlExprItem *)taosArrayGet(pList, 0); int32_t size = pList->size; int32_t type = item->pNode->token.type; - if (type < 0) { - tbufCloseWriter(&bw); - return ret; - } - toTSDBType(item->pNode->token.type); - tbufWriteUint32(&bw, item->pNode->token.type); + toTSDBType(type); + tbufWriteUint32(&bw, type); tbufWriteInt32(&bw, size); for (int32_t i = 0; i < size; i++) { tSqlExpr* pSub = ((tSqlExprItem*)(taosArrayGet(pList, i)))->pNode; - // validate type in exprList + // type in exprList is same or not + toTSDBType(pSub->token.type); if (type != pSub->token.type) { break; } + tVariant var; tVariantCreate(&var, &pSub->token); if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT @@ -3292,8 +3290,7 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tVariantDestroy(pVal); free(pVal); - } - else if (colType == TSDB_DATA_TYPE_BINARY) { + } else if (colType == TSDB_DATA_TYPE_BINARY) { pColumnFilter->pz = (int64_t)calloc(1, bufLen * TSDB_NCHAR_SIZE); pColumnFilter->len = pRight->value.nLen; retVal = tVariantDump(&pRight->value, (char*)pColumnFilter->pz, colType, false); diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index bd609a6708..436094fe2d 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3163,7 +3163,8 @@ void filterPrepare(void* expr, void* param) { pObj = taosHashInit(256, taosGetDefaultHashFunction(pInfo->sch.type), true, false); SArray *arr = (SArray *)(pCond->arr); for (size_t i = 0; i < taosArrayGetSize(arr); i++) { - taosHashPut(pObj, (char *)taosArrayGet(arr, i), arr->elemSize, &dummy, sizeof(dummy)); + char* p = taosArrayGetP(arr, i); + taosHashPut(pObj, varDataVal(p),varDataLen(p), &dummy, sizeof(dummy)); } } else { buildFilterSetFromBinary((void **)&pObj, pCond->pz, pCond->nLen); -- GitLab