[td-1826]
This commit is contained in:
parent
1620cc5240
commit
f126b8d572
|
@ -127,7 +127,7 @@ typedef struct STableMetaInfo {
|
||||||
typedef struct SSqlExpr {
|
typedef struct SSqlExpr {
|
||||||
char aliasName[TSDB_COL_NAME_LEN]; // as aliasName
|
char aliasName[TSDB_COL_NAME_LEN]; // as aliasName
|
||||||
SColIndex colInfo;
|
SColIndex colInfo;
|
||||||
int64_t uid; // refactor use the pointer
|
uint64_t uid; // refactor use the pointer
|
||||||
int16_t functionId; // function id in aAgg array
|
int16_t functionId; // function id in aAgg array
|
||||||
int16_t resType; // return value type
|
int16_t resType; // return value type
|
||||||
int16_t resBytes; // length of return value
|
int16_t resBytes; // length of return value
|
||||||
|
|
|
@ -1254,9 +1254,10 @@ bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCur
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) {// reset output buffer to the beginning
|
void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) {// reset output buffer to the beginning
|
||||||
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
size_t t = tscSqlExprNumOfExprs(pQueryInfo);
|
||||||
pLocalReducer->pCtx[i].aOutputBuf =
|
for (int32_t i = 0; i < t; ++i) {
|
||||||
pLocalReducer->pResultBuf->data + tscFieldInfoGetOffset(pQueryInfo, i) * pLocalReducer->resColModel->capacity;
|
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i);
|
||||||
|
pLocalReducer->pCtx[i].aOutputBuf = pLocalReducer->pResultBuf->data + pExpr->offset * pLocalReducer->resColModel->capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(pLocalReducer->pResultBuf, 0, pLocalReducer->nResultBufSize + sizeof(tFilePage));
|
memset(pLocalReducer->pResultBuf, 0, pLocalReducer->nResultBufSize + sizeof(tFilePage));
|
||||||
|
@ -1501,8 +1502,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) {
|
||||||
if (pLocalReducer->discard && sameGroup) {
|
if (pLocalReducer->discard && sameGroup) {
|
||||||
pLocalReducer->hasUnprocessedRow = false;
|
pLocalReducer->hasUnprocessedRow = false;
|
||||||
tmpBuffer->num = 0;
|
tmpBuffer->num = 0;
|
||||||
} else {
|
} else { // current row does not belongs to the previous group, so it is not be handled yet.
|
||||||
// current row does not belongs to the previous group, so it is not be handled yet.
|
|
||||||
pLocalReducer->hasUnprocessedRow = true;
|
pLocalReducer->hasUnprocessedRow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5281,11 +5281,14 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
|
||||||
|
|
||||||
if (pParentQueryInfo->groupbyExpr.numOfGroupCols > 0) {
|
if (pParentQueryInfo->groupbyExpr.numOfGroupCols > 0) {
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, subClauseIndex);
|
||||||
|
SSqlExpr* pExpr = NULL;
|
||||||
|
|
||||||
size_t size = taosArrayGetSize(pQueryInfo->exprList);
|
size_t size = taosArrayGetSize(pQueryInfo->exprList);
|
||||||
|
if (size > 0) {
|
||||||
|
pExpr = tscSqlExprGet(pQueryInfo, (int32_t)size - 1);
|
||||||
|
}
|
||||||
|
|
||||||
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, (int32_t)size - 1);
|
if (pExpr == NULL || pExpr->functionId != TSDB_FUNC_TAG) {
|
||||||
|
|
||||||
if (pExpr->functionId != TSDB_FUNC_TAG) {
|
|
||||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pParentQueryInfo, tableIndex);
|
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pParentQueryInfo, tableIndex);
|
||||||
|
|
||||||
int16_t colId = tscGetJoinTagColIdByUid(&pQueryInfo->tagCond, pTableMetaInfo->pTableMeta->id.uid);
|
int16_t colId = tscGetJoinTagColIdByUid(&pQueryInfo->tagCond, pTableMetaInfo->pTableMeta->id.uid);
|
||||||
|
|
|
@ -5168,7 +5168,7 @@ static void doSaveContext(SQInfo *pQInfo) {
|
||||||
SWITCH_ORDER(pQuery->order.order);
|
SWITCH_ORDER(pQuery->order.order);
|
||||||
|
|
||||||
if (pRuntimeEnv->pTSBuf != NULL) {
|
if (pRuntimeEnv->pTSBuf != NULL) {
|
||||||
pRuntimeEnv->pTSBuf->cur.order = pQuery->order.order;
|
SWITCH_ORDER(pRuntimeEnv->pTSBuf->cur.order);
|
||||||
}
|
}
|
||||||
|
|
||||||
STsdbQueryCond cond = {
|
STsdbQueryCond cond = {
|
||||||
|
|
Loading…
Reference in New Issue