提交 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
char keyMd5[TSDB_MAX_JSON_KEY_MD5_LEN + 1] = {0};
jsonKeyMd5(fieldName, strlen(fieldName), keyMd5);
strncpy(pInfo->fieldJson.name, keyMd5, sizeof(pInfo->fieldJson.name));
pInfo->fieldJson.type = TSDB_DATA_TYPE_JSON;
}
pInfo->pExpr = pSqlExpr;
......
......@@ -2655,12 +2655,11 @@ static void updateFieldForJson(SSqlObj *pSql, SQueryTableRsp *pQueryAttr){
SInternalField *pField = tscFieldInfoGetInternalField(pFieldInfo, i);
if (pField->field.type == TSDB_DATA_TYPE_JSON) {
pField->fieldJson.type = TSDB_DATA_TYPE_JSON;
for (int k = 0; k < pQueryAttr->tJsonSchLen; ++k) {
if (strncmp(pField->fieldJson.name, pQueryAttr->tagJsonSchema[k].name, TSDB_MAX_JSON_KEY_LEN) == 0
&& pQueryAttr->tagJsonSchema[k].type != TSDB_DATA_TYPE_JSON) {
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,
pField->fieldJson.type);
break;
......
......@@ -439,7 +439,7 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
if (pField->visible) {
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;
if(!IS_VAR_DATA_TYPE(f[j].type) && f[j].type != TSDB_DATA_TYPE_JSON){
f[j].bytes = pField->fieldJson.bytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册