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

fix group by json tag format [change json type with qid return logic]

上级 1c02a1f2
...@@ -2199,6 +2199,7 @@ int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnLi ...@@ -2199,6 +2199,7 @@ int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnLi
char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN + 1] = {0}; char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN + 1] = {0};
jsonKeyMd5(fieldName, strlen(fieldName), keyMd5); jsonKeyMd5(fieldName, strlen(fieldName), keyMd5);
strncpy(pInfo->fieldJson.name, keyMd5, sizeof(pInfo->fieldJson.name)); strncpy(pInfo->fieldJson.name, keyMd5, sizeof(pInfo->fieldJson.name));
pInfo->fieldJson.type = TSDB_DATA_TYPE_JSON;
} }
pInfo->pExpr = pSqlExpr; pInfo->pExpr = pSqlExpr;
......
...@@ -2655,12 +2655,11 @@ static void updateFieldForJson(SSqlObj *pSql, SQueryTableRsp *pQueryAttr){ ...@@ -2655,12 +2655,11 @@ static void updateFieldForJson(SSqlObj *pSql, SQueryTableRsp *pQueryAttr){
SInternalField *pField = tscFieldInfoGetInternalField(pFieldInfo, i); SInternalField *pField = tscFieldInfoGetInternalField(pFieldInfo, i);
if (pField->field.type == TSDB_DATA_TYPE_JSON) { if (pField->field.type == TSDB_DATA_TYPE_JSON) {
pField->fieldJson.type = TSDB_DATA_TYPE_JSON;
for (int k = 0; k < pQueryAttr->tJsonSchLen; ++k) { for (int k = 0; k < pQueryAttr->tJsonSchLen; ++k) {
if (strncmp(pField->fieldJson.name, pQueryAttr->tagJsonSchema[k].name, TSDB_MAX_JSON_KEY_LEN) == 0 if (strncmp(pField->fieldJson.name, pQueryAttr->tagJsonSchema[k].name, TSDB_MAX_JSON_KEY_LEN) == 0
&& pQueryAttr->tagJsonSchema[k].type != TSDB_DATA_TYPE_JSON) { && pQueryAttr->tagJsonSchema[k].type != TSDB_DATA_TYPE_JSON) {
pField->fieldJson.type = pQueryAttr->tagJsonSchema[k].type; pField->fieldJson.type = pQueryAttr->tagJsonSchema[k].type;
pField->fieldJson.bytes = TYPE_BYTES[pField->field.type]; pField->fieldJson.bytes = TYPE_BYTES[pField->fieldJson.type];
tscDebug("0x%" PRIx64 " change json type %s:%s to %d", pSql->self, pField->field.name, pQueryAttr->tagJsonSchema[k].name, tscDebug("0x%" PRIx64 " change json type %s:%s to %d", pSql->self, pField->field.name, pQueryAttr->tagJsonSchema[k].name,
pField->fieldJson.type); pField->fieldJson.type);
break; break;
......
...@@ -439,7 +439,7 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { ...@@ -439,7 +439,7 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
if (pField->visible) { if (pField->visible) {
f[j] = pField->field; f[j] = pField->field;
if(f[j].type == TSDB_DATA_TYPE_JSON && pField->fieldJson.type != TSDB_DATA_TYPE_NULL){ if(f[j].type == TSDB_DATA_TYPE_JSON){
f[j].type = pField->fieldJson.type; f[j].type = pField->fieldJson.type;
if(!IS_VAR_DATA_TYPE(f[j].type) && f[j].type != TSDB_DATA_TYPE_JSON){ if(!IS_VAR_DATA_TYPE(f[j].type) && f[j].type != TSDB_DATA_TYPE_JSON){
f[j].bytes = pField->fieldJson.bytes; f[j].bytes = pField->fieldJson.bytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册