提交 a9d71e28 编写于 作者: Y yihaoDeng

[TD-4335]<feature> group by multi column

上级 dc24734a
...@@ -481,7 +481,6 @@ static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResult ...@@ -481,7 +481,6 @@ static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResult
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW); longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
} }
memset(pRuntimeEnv->keyBuf, 0, GET_RES_WINDOW_KEY_LEN(bytes));
return pResultRowInfo->pResult[pResultRowInfo->curPos]; return pResultRowInfo->pResult[pResultRowInfo->curPos];
} }
...@@ -1497,11 +1496,12 @@ static void buildGroupbyKeyBuf(const SSDataBlock *pSDataBlock, SGroupbyOperatorI ...@@ -1497,11 +1496,12 @@ static void buildGroupbyKeyBuf(const SSDataBlock *pSDataBlock, SGroupbyOperatorI
} }
if (IS_VAR_DATA_TYPE(pDataInfo->type)) { if (IS_VAR_DATA_TYPE(pDataInfo->type)) {
memcpy(p, varDataVal(val), varDataLen(val)); memcpy(p, varDataVal(val), varDataLen(val));
p += varDataLen(val);
} else { } else {
memcpy(p, val, pDataInfo->bytes); memcpy(p, val, pDataInfo->bytes);
p += pDataInfo->bytes;
} }
*isNullKey = false; *isNullKey = false;
p += pDataInfo->bytes;
} }
} }
static bool isGroupbyKeyEqual(void *a, void *b, void *ext) { static bool isGroupbyKeyEqual(void *a, void *b, void *ext) {
...@@ -1529,8 +1529,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1529,8 +1529,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
qError("QInfo:0x%"PRIx64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv)); qError("QInfo:0x%"PRIx64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv));
return; return;
} }
//realloc pRuntimeEnv->keyBuf
pRuntimeEnv->keyBuf = realloc(pRuntimeEnv->keyBuf, pInfo->totalBytes + sizeof(int64_t) + POINTER_BYTES);
SColumnInfoData* pFirstColData = taosArrayGet(pSDataBlock->pDataBlock, 0); SColumnInfoData* pFirstColData = taosArrayGet(pSDataBlock->pDataBlock, 0);
int64_t* tsList = (pFirstColData->info.type == TSDB_DATA_TYPE_TIMESTAMP)? (int64_t*) pFirstColData->pData:NULL; int64_t* tsList = (pFirstColData->info.type == TSDB_DATA_TYPE_TIMESTAMP)? (int64_t*) pFirstColData->pData:NULL;
...@@ -1588,7 +1589,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1588,7 +1589,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, pSDataBlock->info.rows - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput); doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, pSDataBlock->info.rows - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput);
} }
//tfree(pInfo->prevData); tfree(pInfo->prevData);
} }
static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInfo *pInfo, SSDataBlock *pSDataBlock) { static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInfo *pInfo, SSDataBlock *pSDataBlock) {
......
...@@ -782,13 +782,13 @@ if $data11 != 2 then ...@@ -782,13 +782,13 @@ if $data11 != 2 then
return -1 return -1
endi endi
sql_error select count(*) from m1 group by tbname,k,f1; #sql_error select count(*) from m1 group by tbname,k,f1;
sql_error select count(*) from m1 group by tbname,k,a; #select count(*) from m1 group by tbname,k,a;
sql_error select count(*) from m1 group by k, tbname; #sql_error select count(*) from m1 group by k, tbname;
sql_error select count(*) from m1 group by k,f1; #sql_error select count(*) from m1 group by k,f1;
sql_error select count(*) from tm0 group by tbname; sql_error select count(*) from tm0 group by tbname;
sql_error select count(*) from tm0 group by a; sql_error select count(*) from tm0 group by a;
sql_error select count(*) from tm0 group by k,f1; #select count(*) from tm0 group by k,f1;
sql_error select count(*),f1 from m1 group by tbname,k; sql_error select count(*),f1 from m1 group by tbname,k;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册