fix: parseOneStbRow support for jsontag

This commit is contained in:
Shungang Li 2024-07-11 19:03:33 +08:00
parent ff9ef2797b
commit 51000ffe7f
1 changed files with 5 additions and 1 deletions

View File

@ -12815,6 +12815,7 @@ static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCxt)
int32_t numOfTags = getNumOfTags(pParFileCxt->pStbMeta); int32_t numOfTags = getNumOfTags(pParFileCxt->pStbMeta);
uint8_t precision = getTableInfo(pParFileCxt->pStbMeta).precision; uint8_t precision = getTableInfo(pParFileCxt->pStbMeta).precision;
SSchema* pSchemas = getTableTagSchema(pParFileCxt->pStbMeta); SSchema* pSchemas = getTableTagSchema(pParFileCxt->pStbMeta);
bool isJson = false;
for (int i = 0; i < sz; i++) { for (int i = 0; i < sz; i++) {
const char* pSql = pParFileCxt->pSql; const char* pSql = pParFileCxt->pSql;
@ -12832,6 +12833,7 @@ static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCxt)
// parse tag // parse tag
const SSchema* pTagSchema = &pSchemas[index]; const SSchema* pTagSchema = &pSchemas[index];
isJson = (pTagSchema->type == TSDB_DATA_TYPE_JSON);
code = checkAndTrimValue(&token, pParFileCxt->tmpTokenBuf, pMsgBuf, pTagSchema->type); code = checkAndTrimValue(&token, pParFileCxt->tmpTokenBuf, pMsgBuf, pTagSchema->type);
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) { if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
code = buildInvalidOperationMsg(pMsgBuf, "not expected row value"); code = buildInvalidOperationMsg(pMsgBuf, "not expected row value");
@ -12859,7 +12861,9 @@ static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCxt)
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pParFileCxt->tagNameFilled = true; pParFileCxt->tagNameFilled = true;
code = tTagNew(pParFileCxt->aTagVals, 1, false, &pParFileCxt->pTag); if (!isJson) {
code = tTagNew(pParFileCxt->aTagVals, 1, false, &pParFileCxt->pTag);
}
} }
return code; return code;