提交 fcbb6191 编写于 作者: W wpan

fix crash and functionality

上级 08f11d51
...@@ -2067,17 +2067,23 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr ...@@ -2067,17 +2067,23 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr
SInternalField p = {.visible = pfield->visible, .field = pfield->field}; SInternalField p = {.visible = pfield->visible, .field = pfield->field};
bool found = false;
int32_t resColId = pfield->pExpr->base.resColId; int32_t resColId = pfield->pExpr->base.resColId;
for(int32_t j = 0; j < numOfExpr; ++j) { for(int32_t j = 0; j < numOfExpr; ++j) {
SExprInfo* pExpr = taosArrayGetP(pExprList, j); SExprInfo* pExpr = taosArrayGetP(pExprList, j);
if (pExpr->base.resColId == resColId) { if (pExpr->base.resColId == resColId) {
p.pExpr = pExpr; p.pExpr = pExpr;
found = true;
break; break;
} }
} }
// p.pExpr = calloc(1, sizeof(SExprInfo));
// tscExprAssign(p.pExpr, pfield->pExpr); if (!found) {
assert(pfield->pExpr->pExpr != NULL);
p.pExpr = calloc(1, sizeof(SExprInfo));
tscExprAssign(p.pExpr, pfield->pExpr);
}
taosArrayPush(pFieldInfo->internalField, &p); taosArrayPush(pFieldInfo->internalField, &p);
} }
} }
...@@ -2942,6 +2948,7 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) { ...@@ -2942,6 +2948,7 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) {
pQueryInfo->bufLen = pSrc->bufLen; pQueryInfo->bufLen = pSrc->bufLen;
pQueryInfo->orderProjectQuery = pSrc->orderProjectQuery; pQueryInfo->orderProjectQuery = pSrc->orderProjectQuery;
pQueryInfo->arithmeticOnAgg = pSrc->arithmeticOnAgg;
pQueryInfo->buf = malloc(pSrc->bufLen); pQueryInfo->buf = malloc(pSrc->bufLen);
if (pQueryInfo->buf == NULL) { if (pQueryInfo->buf == NULL) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY; code = TSDB_CODE_TSC_OUT_OF_MEMORY;
...@@ -2981,6 +2988,14 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) { ...@@ -2981,6 +2988,14 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) {
goto _error; goto _error;
} }
if (pQueryInfo->arithmeticOnAgg) {
pQueryInfo->exprList1 = taosArrayInit(4, POINTER_BYTES);
if (tscExprCopyAll(pQueryInfo->exprList1, pSrc->exprList1, true) != 0) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto _error;
}
}
tscColumnListCopyAll(pQueryInfo->colList, pSrc->colList); tscColumnListCopyAll(pQueryInfo->colList, pSrc->colList);
tscFieldInfoCopy(&pQueryInfo->fieldsInfo, &pSrc->fieldsInfo, pQueryInfo->exprList); tscFieldInfoCopy(&pQueryInfo->fieldsInfo, &pSrc->fieldsInfo, pQueryInfo->exprList);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册