fix:[TD-32454] Use SMA when using min/max on numeric column.
This commit is contained in:
parent
b7d7a23eea
commit
f5872e6cec
|
@ -190,7 +190,6 @@ typedef struct SFunctionNode {
|
|||
bool hasOriginalFunc;
|
||||
int32_t originalFuncId;
|
||||
ETrimType trimType;
|
||||
bool hasSMA;
|
||||
bool dual; // whether select stmt without from stmt, true for without.
|
||||
} SFunctionNode;
|
||||
|
||||
|
|
|
@ -327,7 +327,6 @@ static int32_t translateMinMax(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
|
|||
} else if (IS_NULL_TYPE(paraType)) {
|
||||
paraType = TSDB_DATA_TYPE_BIGINT;
|
||||
}
|
||||
pFunc->hasSMA = !IS_VAR_DATA_TYPE(paraType);
|
||||
int32_t bytes = IS_STR_DATA_TYPE(paraType) ? dataType->bytes : tDataTypes[paraType].bytes;
|
||||
pFunc->node.resType = (SDataType){.bytes = bytes, .type = paraType};
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -294,9 +294,6 @@ static bool scanPathOptIsSpecifiedFuncType(const SFunctionNode* pFunc, bool (*ty
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool isMinMaxFunction(int32_t funcType) {
|
||||
return funcType == FUNCTION_TYPE_MIN || funcType == FUNCTION_TYPE_MAX;
|
||||
}
|
||||
static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSdrFuncs, SNodeList** pDsoFuncs) {
|
||||
SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent);
|
||||
SNodeList* pTmpSdrFuncs = NULL;
|
||||
|
@ -306,8 +303,7 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd
|
|||
FOREACH(pNode, pAllFuncs) {
|
||||
SFunctionNode* pFunc = (SFunctionNode*)pNode;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
if ((!isMinMaxFunction(pFunc->funcType) && scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) ||
|
||||
(isMinMaxFunction(pFunc->funcType) && pFunc->hasSMA)) {
|
||||
if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) {
|
||||
SNode* pNew = NULL;
|
||||
code = nodesCloneNode(pNode, &pNew);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
|
Loading…
Reference in New Issue