Merge branch '3.0' into feature/3.0_glzhao
This commit is contained in:
commit
6a73011231
|
@ -25,7 +25,7 @@ int32_t init_env() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 2");
|
||||
TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in create db, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
|
|
|
@ -50,8 +50,14 @@ typedef struct STopBotRes {
|
|||
typedef struct SStddevRes {
|
||||
double result;
|
||||
int64_t count;
|
||||
union {double quadraticDSum; int64_t quadraticISum;};
|
||||
union {double dsum; int64_t isum;};
|
||||
union {
|
||||
double quadraticDSum;
|
||||
int64_t quadraticISum;
|
||||
};
|
||||
union {
|
||||
double dsum;
|
||||
int64_t isum;
|
||||
};
|
||||
} SStddevRes;
|
||||
|
||||
typedef struct SPercentileInfo {
|
||||
|
@ -68,7 +74,10 @@ typedef struct SDiffInfo {
|
|||
bool includeNull;
|
||||
bool ignoreNegative;
|
||||
bool firstOutput;
|
||||
union { int64_t i64; double d64;} prev;
|
||||
union {
|
||||
int64_t i64;
|
||||
double d64;
|
||||
} prev;
|
||||
} SDiffInfo;
|
||||
|
||||
typedef struct SSpreadInfo {
|
||||
|
@ -118,7 +127,6 @@ typedef struct SSpreadInfo {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
bool functionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) {
|
||||
if (pResultInfo->initialized) {
|
||||
return false;
|
||||
|
@ -138,7 +146,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
|
||||
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||
pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0;
|
||||
cleanupResultRowEntry(pResInfo);
|
||||
/*cleanupResultRowEntry(pResInfo);*/
|
||||
|
||||
char* in = GET_ROWCELL_INTERBUF(pResInfo);
|
||||
colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes);
|
||||
|
@ -199,7 +207,8 @@ int32_t countFunction(SqlFunctionCtx *pCtx) {
|
|||
numOfElem += 1;
|
||||
}
|
||||
} else {
|
||||
//when counting on the primary time stamp column and no statistics data is presented, use the size value directly.
|
||||
// when counting on the primary time stamp column and no statistics data is presented, use the size value
|
||||
// directly.
|
||||
numOfElem = pInput->numOfRows;
|
||||
}
|
||||
}
|
||||
|
@ -1198,7 +1207,6 @@ int32_t diffFunction(SqlFunctionCtx *pCtx) {
|
|||
case TSDB_DATA_TYPE_INT: {
|
||||
SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput;
|
||||
for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += step) {
|
||||
|
||||
int32_t pos = startOffset + (isFirstBlock ? (numOfElems - 1) : numOfElems);
|
||||
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
|
||||
if (pDiffInfo->includeNull) {
|
||||
|
@ -1404,8 +1412,8 @@ static STopBotRes *getTopBotOutputInfo(SqlFunctionCtx *pCtx) {
|
|||
return pRes;
|
||||
}
|
||||
|
||||
static void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSDataBlock* pSrcBlock,
|
||||
uint16_t type, uint64_t uid, SResultRowEntryInfo* pEntryInfo);
|
||||
static void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSDataBlock* pSrcBlock, uint16_t type,
|
||||
uint64_t uid, SResultRowEntryInfo* pEntryInfo);
|
||||
|
||||
static void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STopBotResItem* pItem);
|
||||
static void copyTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STopBotResItem* pItem);
|
||||
|
@ -1488,11 +1496,11 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
|
|||
|
||||
// allocate the buffer and keep the data of this row into the new allocated buffer
|
||||
pEntryInfo->numOfRes++;
|
||||
taosheapsort((void *) pItems, sizeof(STopBotResItem), pEntryInfo->numOfRes, (const void *) &type, topBotResComparFn, false);
|
||||
taosheapsort((void*)pItems, sizeof(STopBotResItem), pEntryInfo->numOfRes, (const void*)&type, topBotResComparFn,
|
||||
false);
|
||||
} else { // replace the minimum value in the result
|
||||
if ((IS_SIGNED_NUMERIC_TYPE(type) && val.i > pItems[0].v.i) ||
|
||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) ||
|
||||
(IS_FLOAT_TYPE(type) && val.d > pItems[0].v.d)) {
|
||||
(IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) || (IS_FLOAT_TYPE(type) && val.d > pItems[0].v.d)) {
|
||||
// replace the old data and the coresponding tuple data
|
||||
STopBotResItem* pItem = &pItems[0];
|
||||
pItem->v = val;
|
||||
|
@ -1501,7 +1509,8 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
|
|||
// save the data of this tuple by over writing the old data
|
||||
copyTupleData(pCtx, rowIndex, pSrcBlock, pItem);
|
||||
|
||||
taosheapadjust((void *) pItems, sizeof(STopBotResItem), 0, pEntryInfo->numOfRes - 1, (const void *) &type, topBotResComparFn, NULL, false);
|
||||
taosheapadjust((void*)pItems, sizeof(STopBotResItem), 0, pEntryInfo->numOfRes - 1, (const void*)&type,
|
||||
topBotResComparFn, NULL, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue