提交 8d559b53 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> add tag-> where logic

上级 b3379d2d
...@@ -860,6 +860,7 @@ int32_t filterAddFieldFromNode(SFilterInfo *info, tExprNode *node, SFilterFieldI ...@@ -860,6 +860,7 @@ int32_t filterAddFieldFromNode(SFilterInfo *info, tExprNode *node, SFilterFieldI
if(node->nodeType == TSQL_NODE_EXPR && node->_node.optr == TSDB_RELATION_ARROW){ // json tag -> operation if(node->nodeType == TSQL_NODE_EXPR && node->_node.optr == TSDB_RELATION_ARROW){ // json tag -> operation
type = FLD_TYPE_COLUMN; type = FLD_TYPE_COLUMN;
assert(node->_node.pRight->pVal->nLen < TSDB_COL_NAME_LEN); assert(node->_node.pRight->pVal->nLen < TSDB_COL_NAME_LEN);
memset(node->_node.pLeft->pSchema->name, 0, TSDB_COL_NAME_LEN);
strncpy(node->_node.pLeft->pSchema->name, node->_node.pRight->pVal->pz, node->_node.pRight->pVal->nLen); strncpy(node->_node.pLeft->pSchema->name, node->_node.pRight->pVal->pz, node->_node.pRight->pVal->nLen);
v = node->pSchema; v = node->pSchema;
node->pSchema = NULL; node->pSchema = NULL;
......
...@@ -4109,7 +4109,20 @@ static void queryByJsonTag(STable* pTable, void* filterInfo, SArray* res){ ...@@ -4109,7 +4109,20 @@ static void queryByJsonTag(STable* pTable, void* filterInfo, SArray* res){
SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i]; SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i];
SSchema* sch = fi->desc; SSchema* sch = fi->desc;
if (sch-> colId == TSDB_TBNAME_COLUMN_INDEX) continue; if (sch-> colId == TSDB_TBNAME_COLUMN_INDEX) continue;
SArray** data = (SArray**)taosHashGet(pTable->jsonKeyMap, sch->name, strlen(sch->name)); int32_t outLen = 0;
char* key = NULL;
if(JSON_TYPE_NCHAR){
char tagKey[256] = {0};
if (!taosMbsToUcs4(sch->name, strlen(sch->name), tagKey, 256, &outLen)) {
tsdbError("json key to ucs4 error:%s|%s", strerror(errno), sch->name);
return;
}
key = tagKey;
}else{
key = sch->name;
outLen = strlen(sch->name);
}
SArray** data = (SArray**)taosHashGet(pTable->jsonKeyMap, key, outLen);
if(data == NULL) continue; if(data == NULL) continue;
if(tabList == NULL) { if(tabList == NULL) {
tabList = taosArrayDup(*data); tabList = taosArrayDup(*data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册