diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index bcd3e294d12627c9eeb8de0a36961c702382e9dd..7d6a5c30da83dc315167fa58ab4da24e815a1992 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 bd609a670851e956e04557236c61d813c1bf0091..436094fe2deb91613da315a780b486bb0ad7f067 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);