feat:add new logic for new tag format
This commit is contained in:
parent
d95ec693c0
commit
f6b700ff45
|
@ -672,8 +672,8 @@ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) {
|
||||||
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
|
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
|
||||||
n += tGetBinary(p + n, &pTagVal->pData, &pTagVal->nData);
|
n += tGetBinary(p + n, &pTagVal->pData, &pTagVal->nData);
|
||||||
} else {
|
} else {
|
||||||
n += tDataTypes[pTagVal->type].bytes;
|
|
||||||
memcpy(&(pTagVal->i64), p + n, tDataTypes[pTagVal->type].bytes);
|
memcpy(&(pTagVal->i64), p + n, tDataTypes[pTagVal->type].bytes);
|
||||||
|
n += tDataTypes[pTagVal->type].bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -922,12 +922,13 @@ static void doReleaseVec(SColumnInfoData* pCol, int32_t type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STagVal *getJsonValue(char *json, STagVal *tagVal) {
|
STagVal getJsonValue(char *json, char *key, bool *isExist) {
|
||||||
bool find = tTagGet(((const STag *)json), tagVal); // json value is null and not exist is different
|
STagVal val = {.pKey = key};
|
||||||
if(!find){
|
bool find = tTagGet(((const STag *)json), &val); // json value is null and not exist is different
|
||||||
return NULL;
|
if(isExist){
|
||||||
|
*isExist = find;
|
||||||
}
|
}
|
||||||
return tagVal;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vectorJsonArrow(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
void vectorJsonArrow(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
||||||
|
@ -939,6 +940,8 @@ void vectorJsonArrow(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
|
||||||
pOut->numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
pOut->numOfRows = TMAX(pLeft->numOfRows, pRight->numOfRows);
|
||||||
|
|
||||||
char *pRightData = colDataGetVarData(pRight->columnData, 0);
|
char *pRightData = colDataGetVarData(pRight->columnData, 0);
|
||||||
|
char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1);
|
||||||
|
memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData));
|
||||||
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
||||||
if (colDataIsNull_var(pLeft->columnData, i)) {
|
if (colDataIsNull_var(pLeft->columnData, i)) {
|
||||||
colDataSetNull_var(pOutputCol, i);
|
colDataSetNull_var(pOutputCol, i);
|
||||||
|
@ -946,14 +949,15 @@ void vectorJsonArrow(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
char *pLeftData = colDataGetVarData(pLeft->columnData, i);
|
char *pLeftData = colDataGetVarData(pLeft->columnData, i);
|
||||||
STagVal val = {.pKey = pRightData};
|
bool isExist = false;
|
||||||
STagVal *value = getJsonValue(pLeftData, &val);
|
STagVal value = getJsonValue(pLeftData, jsonKey, &isExist);
|
||||||
char *data = tTagValToData(value, true);
|
char *data = isExist ? tTagValToData(&value, true) : NULL;
|
||||||
colDataAppend(pOutputCol, i, data, data == NULL);
|
colDataAppend(pOutputCol, i, data, data == NULL);
|
||||||
if(value && IS_VAR_DATA_TYPE(value->type) && data){
|
if(isExist && IS_VAR_DATA_TYPE(value.type) && data){
|
||||||
taosMemoryFree(data);
|
taosMemoryFree(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
taosMemoryFree(jsonKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ void scltMakeOpNode(SNode **pNode, EOperatorType opType, int32_t resType, SNode
|
||||||
SOperatorNode *onode = (SOperatorNode *)node;
|
SOperatorNode *onode = (SOperatorNode *)node;
|
||||||
onode->node.resType.type = resType;
|
onode->node.resType.type = resType;
|
||||||
onode->node.resType.bytes = tDataTypes[resType].bytes;
|
onode->node.resType.bytes = tDataTypes[resType].bytes;
|
||||||
|
|
||||||
onode->opType = opType;
|
onode->opType = opType;
|
||||||
onode->pLeft = pLeft;
|
onode->pLeft = pLeft;
|
||||||
onode->pRight = pRight;
|
onode->pRight = pRight;
|
||||||
|
|
Loading…
Reference in New Issue