提交 203ea1f9 编写于 作者: H Haojun Liao

fix(query): fix error

上级 31c2aa89
...@@ -142,8 +142,11 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table ...@@ -142,8 +142,11 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
*/ */
int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bool* hasMore, SLocalFetch* pLocal); int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bool* hasMore, SLocalFetch* pLocal);
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds); int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pBlock, uint64_t* useconds);
void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
/** /**
* kill the ongoing query asynchronously * kill the ongoing query asynchronously
* @param tinfo qhandle * @param tinfo qhandle
......
...@@ -1322,10 +1322,6 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) { ...@@ -1322,10 +1322,6 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pDst = taosArrayGet(dst->pDataBlock, i); SColumnInfoData* pDst = taosArrayGet(dst->pDataBlock, i);
SColumnInfoData* pSrc = taosArrayGet(src->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(src->pDataBlock, i);
if (pSrc->pData == NULL) {
continue;
}
colDataAssign(pDst, pSrc, src->info.rows, &src->info); colDataAssign(pDst, pSrc, src->info.rows, &src->info);
} }
......
...@@ -739,11 +739,13 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma ...@@ -739,11 +739,13 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
} }
} }
tdBlockDataDestroy(pResList); taosArrayDestroy(pResList);
qCleanExecTaskBlockBuf(taskInfo);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
_err: _err:
tdBlockDataDestroy(pResList); taosArrayDestroy(pResList);
qCleanExecTaskBlockBuf(taskInfo);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
......
...@@ -646,6 +646,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) { ...@@ -646,6 +646,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
SRetrieveTableRsp* pRsp = pDataInfo->pRsp; SRetrieveTableRsp* pRsp = pDataInfo->pRsp;
SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo;
if (pRsp->numOfRows == 0) { if (pRsp->numOfRows == 0) {
qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64 qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64
", totalRows:%" PRIu64 " try next", ", totalRows:%" PRIu64 " try next",
......
...@@ -572,6 +572,18 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo ...@@ -572,6 +572,18 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
return pTaskInfo->code; return pTaskInfo->code;
} }
void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
SArray* pList = pTaskInfo->pResultBlockList;
size_t num = taosArrayGetSize(pList);
for(int32_t i = 0; i < num; ++i) {
SSDataBlock** p = taosArrayGet(pTaskInfo->pResultBlockList, i);
blockDataDestroy(*p);
}
taosArrayClear(pTaskInfo->pResultBlockList);
}
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
int64_t threadId = taosGetSelfPthreadId(); int64_t threadId = taosGetSelfPthreadId();
......
...@@ -274,10 +274,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) { ...@@ -274,10 +274,9 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
// return; // return;
// } // }
int32_t len = 0; int32_t len = 0;
STimeWindow w = TSWINDOW_INITIALIZER;
terrno = TSDB_CODE_SUCCESS; terrno = TSDB_CODE_SUCCESS;
int32_t num = 0; int32_t num = 0;
for (int32_t j = 0; j < pBlock->info.rows; ++j) { for (int32_t j = 0; j < pBlock->info.rows; ++j) {
// Compare with the previous row of this column, and do not set the output buffer again if they are identical. // Compare with the previous row of this column, and do not set the output buffer again if they are identical.
......
...@@ -494,7 +494,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { ...@@ -494,7 +494,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) {
switch(type) { switch(type) {
case TSDB_DATA_TYPE_UTINYINT: case TSDB_DATA_TYPE_UTINYINT:
case TSDB_DATA_TYPE_TINYINT: { case TSDB_DATA_TYPE_TINYINT: {
const int8_t* plist = (const int8_t*) &pCol->pData[start]; const int8_t* plist = (const int8_t*) pCol->pData;
// 1. If the CPU supports AVX, let's employ AVX instructions to speedup this loop // 1. If the CPU supports AVX, let's employ AVX instructions to speedup this loop
if (simdAvailable) { if (simdAvailable) {
......
...@@ -827,7 +827,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { ...@@ -827,7 +827,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
if (i >= end) { if (i >= end) {
ASSERT(numOfElems == 0); ASSERT(numOfElems == 0);
return numOfElems; goto _over;
} }
doExtractVal(pCol, i, end, pCtx, pBuf, isMinFunc); doExtractVal(pCol, i, end, pCtx, pBuf, isMinFunc);
......
...@@ -145,7 +145,7 @@ class TDTestCase: ...@@ -145,7 +145,7 @@ class TDTestCase:
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), False) tdSql.init(conn.cursor(), True)
self.precision = "ms" self.precision = "ms"
self.sma_count = 0 self.sma_count = 0
self.sma_created_index = [] self.sma_created_index = []
......
import taos import taos
import sys import sys
import math
import numpy as np import numpy as np
from util.log import * from util.log import *
from util.sql import * from util.sql import *
...@@ -411,7 +413,7 @@ class TDTestCase: ...@@ -411,7 +413,7 @@ class TDTestCase:
tdSql.checkData(0,2,14042.142857143) tdSql.checkData(0,2,14042.142857143)
tdSql.checkData(0,3,53.571428571) tdSql.checkData(0,3,53.571428571)
tdSql.checkData(0,4,5.828571332045761e+37) tdSql.checkData(0,4,5.828571332045761e+37)
tdSql.checkData(0,5,None) tdSql.checkData(0,5,math.inf)
# check + - * / in functions # check + - * / in functions
...@@ -421,7 +423,7 @@ class TDTestCase: ...@@ -421,7 +423,7 @@ class TDTestCase:
tdSql.checkData(0,2,14042.142857143) tdSql.checkData(0,2,14042.142857143)
tdSql.checkData(0,3,26.785714286) tdSql.checkData(0,3,26.785714286)
tdSql.checkData(0,4,2.9142856660228804e+37) tdSql.checkData(0,4,2.9142856660228804e+37)
tdSql.checkData(0,5,None) tdSql.checkData(0,5,math.inf)
......
...@@ -7,7 +7,7 @@ class TDTestCase: ...@@ -7,7 +7,7 @@ class TDTestCase:
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor(), True)
self.row_nums = 10 self.row_nums = 10
self.tb_nums = 10 self.tb_nums = 10
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册