提交 0924b6f7 编写于 作者: Y yihaoDeng

[TD-4426]<feature> merge in

上级 fc2688d5
...@@ -204,8 +204,9 @@ static int32_t validateParamOfRelationIn(tVariant *pVar, int32_t colType) { ...@@ -204,8 +204,9 @@ static int32_t validateParamOfRelationIn(tVariant *pVar, int32_t colType) {
if (pVar->nType != TSDB_DATA_TYPE_BINARY) { if (pVar->nType != TSDB_DATA_TYPE_BINARY) {
return -1; return -1;
} }
SBufferReader br = tbufInitReader(pVar->pz, pVar->nLen, false); return 0;
return tbufReadUint32(&br) == colType ? 0: -1; //SBufferReader br = tbufInitReader(pVar->pz, pVar->nLen, false);
//return tbufReadUint32(&br) == colType ? 0: -1;
} }
static uint8_t convertOptr(SStrToken *pToken) { static uint8_t convertOptr(SStrToken *pToken) {
...@@ -243,6 +244,8 @@ static uint8_t convertOptr(SStrToken *pToken) { ...@@ -243,6 +244,8 @@ static uint8_t convertOptr(SStrToken *pToken) {
return TSDB_RELATION_ISNULL; return TSDB_RELATION_ISNULL;
case TK_NOTNULL: case TK_NOTNULL:
return TSDB_RELATION_NOTNULL; return TSDB_RELATION_NOTNULL;
case TK_IN:
return TSDB_RELATION_IN;
default: { return 0; } default: { return 0; }
} }
} }
...@@ -4507,8 +4510,12 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) { ...@@ -4507,8 +4510,12 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) {
free(tmp); free(tmp);
} else { } else {
double tmp; double tmp;
if (p->_node.optr == TSDB_RELATION_IN) {
retVal = validateParamOfRelationIn(vVariant, schemaType);
} else {
retVal = tVariantDump(vVariant, (char*)&tmp, schemaType, false); retVal = tVariantDump(vVariant, (char*)&tmp, schemaType, false);
} }
}
if (retVal != TSDB_CODE_SUCCESS) { if (retVal != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
...@@ -7998,6 +8005,14 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS ...@@ -7998,6 +8005,14 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
} }
return TSDB_CODE_SUCCESS; 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 { } else {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "not support filter expression"); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "not support filter expression");
} }
......
...@@ -479,10 +479,13 @@ void buildFilterSetFromBinary(void **q, const char *buf, int32_t len) { ...@@ -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) { } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) {
double val = tbufReadDouble(&br); double val = tbufReadDouble(&br);
taosHashPut(pObj, (char *)&val, sizeof(val), &dummy, sizeof(dummy)); 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; size_t t = 0;
const char *val = tbufReadBinary(&br, &t); const char *val = tbufReadBinary(&br, &t);
taosHashPut(pObj, (char *)val, t, &dummy, sizeof(dummy)); taosHashPut(pObj, (char *)val, t, &dummy, sizeof(dummy));
} else if (type == TSDB_DATA_TYPE_NCHAR) {
} }
} }
*q = (void *)pObj; *q = (void *)pObj;
......
...@@ -266,8 +266,10 @@ bool inOperator(SColumnFilterElem *pFilter, const char* minval, const char* maxv ...@@ -266,8 +266,10 @@ bool inOperator(SColumnFilterElem *pFilter, const char* minval, const char* maxv
double v; double v;
GET_TYPED_DATA(v, double, type, minval); GET_TYPED_DATA(v, double, type, minval);
return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&v, sizeof(v)); return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&v, sizeof(v));
} else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR){ } else if (type == TSDB_DATA_TYPE_BINARY) {
return NULL != taosHashGet((SHashObj *)pFilter->q, varDataVal(minval), varDataLen(minval)); 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; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册