diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 7d6a5c30da83dc315167fa58ab4da24e815a1992..e062cc61f69e7c2bea2f52b5f15dbcde9437076f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -204,8 +204,9 @@ static int32_t validateParamOfRelationIn(tVariant *pVar, int32_t colType) { if (pVar->nType != TSDB_DATA_TYPE_BINARY) { return -1; } - SBufferReader br = tbufInitReader(pVar->pz, pVar->nLen, false); - return tbufReadUint32(&br) == colType ? 0: -1; + return 0; + //SBufferReader br = tbufInitReader(pVar->pz, pVar->nLen, false); + //return tbufReadUint32(&br) == colType ? 0: -1; } static uint8_t convertOptr(SStrToken *pToken) { @@ -243,6 +244,8 @@ static uint8_t convertOptr(SStrToken *pToken) { return TSDB_RELATION_ISNULL; case TK_NOTNULL: return TSDB_RELATION_NOTNULL; + case TK_IN: + return TSDB_RELATION_IN; default: { return 0; } } } @@ -4507,7 +4510,11 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) { free(tmp); } else { double tmp; - retVal = tVariantDump(vVariant, (char*)&tmp, schemaType, false); + if (p->_node.optr == TSDB_RELATION_IN) { + retVal = validateParamOfRelationIn(vVariant, schemaType); + } else { + retVal = tVariantDump(vVariant, (char*)&tmp, schemaType, false); + } } if (retVal != TSDB_CODE_SUCCESS) { @@ -7998,6 +8005,14 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS } return TSDB_CODE_SUCCESS; + } else if (pSqlExpr->tokenId == TK_SET) { + tVariant *pVal; + if (serializeExprListToVariant(pSqlExpr->pParam, &pVal) == false) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "not support filter expression"); + } + *pExpr = calloc(1, sizeof(tExprNode)); + (*pExpr)->nodeType = TSQL_NODE_VALUE; + (*pExpr)->pVal = pVal; } else { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "not support filter expression"); } diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 0805eff9ffbcccf619092340da3037e097a9e82a..2690c18e5ec3b2a3d542c158f976427e834b84b5 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -479,10 +479,13 @@ void buildFilterSetFromBinary(void **q, const char *buf, int32_t len) { } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { double val = tbufReadDouble(&br); taosHashPut(pObj, (char *)&val, sizeof(val), &dummy, sizeof(dummy)); - } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + } else if (type == TSDB_DATA_TYPE_BINARY) { size_t t = 0; const char *val = tbufReadBinary(&br, &t); + taosHashPut(pObj, (char *)val, t, &dummy, sizeof(dummy)); + } else if (type == TSDB_DATA_TYPE_NCHAR) { + } } *q = (void *)pObj; diff --git a/src/query/src/qFilterfunc.c b/src/query/src/qFilterfunc.c index 7769ec4a574f74e049f971bcbff41978c4c15e97..5e16107f705fd16d9e6fa950fb08c8dba39d3b12 100644 --- a/src/query/src/qFilterfunc.c +++ b/src/query/src/qFilterfunc.c @@ -266,8 +266,10 @@ bool inOperator(SColumnFilterElem *pFilter, const char* minval, const char* maxv double v; GET_TYPED_DATA(v, double, type, minval); return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&v, sizeof(v)); - } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR){ - return NULL != taosHashGet((SHashObj *)pFilter->q, varDataVal(minval), varDataLen(minval)); + } else if (type == TSDB_DATA_TYPE_BINARY) { + return NULL != taosHashGet((SHashObj *)pFilter->q, varDataVal(minval), varDataLen(minval)); + } else if (type == TSDB_DATA_TYPE_NCHAR){ + return NULL != taosHashGet((SHashObj *)pFilter->q, varDataVal(minval), varDataLen(minval)/TSDB_NCHAR_SIZE); } return false;