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

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

上级 3a65aefc
......@@ -1862,7 +1862,6 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn
assert(right != NULL && right->type == SQL_NODE_VALUE);
tVariantAssign(&(pExpr->base.param[pExpr->base.numOfParams]), &right->value);
pExpr->base.numOfParams++;
pExpr->base.resType = TSDB_DATA_TYPE_BINARY; // tag-> operation transform result type
assert(pExpr->base.numOfParams <= 3);
}
......@@ -2264,8 +2263,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
pToken = &left->columnName;
tSqlExpr* right = pItem->pNode->pRight;
assert(right != NULL && right->type == SQL_NODE_VALUE);
if(right->tokenId != TK_STRING){
if(right != NULL || right->type != SQL_NODE_VALUE || right->tokenId != TK_STRING){
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5);
}
}else {
......
......@@ -5187,20 +5187,19 @@ void findTagValue(void* data, char* key, int32_t keyLen, char* out, int16_t len)
void* result = kvRowColVal(data, pColIdx);
if (k % 2 != 0) { // json key
char tagJsonKey[TSDB_MAX_TAGS_LEN] = {0};
if (JSON_TYPE_BINARY){
if (keyLen != varDataLen(result)) continue;
if (memcmp(varDataVal(result), key, keyLen) != 0) continue;
} else if(JSON_TYPE_NCHAR){
char tagJsonKey[TSDB_MAX_TAGS_LEN] = {0};
int32_t length = taosUcs4ToMbs(varDataVal(result), varDataLen(result), tagJsonKey);
if (length == 0) {
tscError("charset:%s to %s. val:%s convert json key failed.", DEFAULT_UNICODE_ENCODEC, tsCharset,
(char*)result);
continue;
}
if (strncmp(key, tagJsonKey, keyLen) != 0) {
continue;
}
if (keyLen != length) continue;
if (strncmp(key, tagJsonKey, keyLen) != 0) continue;
}
found = true;
} else { // json value
......
......@@ -7185,7 +7185,6 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
dst = pColInfo->pData + count * pExprInfo[j].base.resBytes;
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
data = tsdbGetTableName(item->pTable);
} else {
data = tsdbGetTableTagVal(item->pTable, pExprInfo[j].base.colInfo.colId, type, bytes);
if(type == TSDB_DATA_TYPE_JSON){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册