diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 0cc9fb8619..a578eb6826 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -144,12 +144,14 @@ typedef enum _mgmt_table { #define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9 #define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10 -#define TSDB_FILL_NONE 0 -#define TSDB_FILL_NULL 1 -#define TSDB_FILL_SET_VALUE 2 -#define TSDB_FILL_LINEAR 3 -#define TSDB_FILL_PREV 4 -#define TSDB_FILL_NEXT 5 +#define TSDB_FILL_NONE 0 +#define TSDB_FILL_NULL 1 +#define TSDB_FILL_NULL_F 2 +#define TSDB_FILL_SET_VALUE 3 +#define TSDB_FILL_SET_VALUE_F 4 +#define TSDB_FILL_LINEAR 5 +#define TSDB_FILL_PREV 6 +#define TSDB_FILL_NEXT 7 #define TSDB_ALTER_USER_PASSWD 0x1 #define TSDB_ALTER_USER_SUPERUSER 0x2 diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 48b98fcf33..e291051351 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -226,8 +226,10 @@ typedef struct SIntervalWindowNode { typedef enum EFillMode { FILL_MODE_NONE = 1, FILL_MODE_VALUE, + FILL_MODE_VALUE_F, FILL_MODE_PREV, FILL_MODE_NULL, + FILL_MODE_NULL_F, FILL_MODE_LINEAR, FILL_MODE_NEXT } EFillMode; diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index fad4059515..2694894c0b 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -62,6 +62,7 @@ typedef struct SFillInfo { int32_t srcTsSlotId; // timestamp column id in the source data block. int32_t order; // order [TSDB_ORDER_ASC|TSDB_ORDER_DESC] int32_t type; // fill type + bool forceFill; // force fill values int32_t numOfRows; // number of rows in the input data block int32_t index; // active row index int32_t numOfTotal; // number of filled rows in one round diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 757324a773..c472fa4898 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1658,12 +1658,18 @@ int32_t convertFillType(int32_t mode) { case FILL_MODE_NULL: type = TSDB_FILL_NULL; break; + case FILL_MODE_NULL_F: + type = TSDB_FILL_NULL_F; + break; case FILL_MODE_NEXT: type = TSDB_FILL_NEXT; break; case FILL_MODE_VALUE: type = TSDB_FILL_SET_VALUE; break; + case FILL_MODE_VALUE_F: + type = TSDB_FILL_SET_VALUE_F; + break; case FILL_MODE_LINEAR: type = TSDB_FILL_LINEAR; break; diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 187c8f582a..b346c18aaa 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -140,7 +140,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { while (1) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); if (pBlock == NULL) { - if (pInfo->totalInputRows == 0) { + if (pInfo->totalInputRows == 0 && !pInfo->pFillInfo->forceFill) { setOperatorCompleted(pOperator); return NULL; } diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 2d921d43d3..9a67da69e7 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -457,6 +457,9 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t case FILL_MODE_NULL: pFillInfo->type = TSDB_FILL_NULL; break; + case FILL_MODE_NULL_F: + pFillInfo->type = TSDB_FILL_NULL_F; + break; case FILL_MODE_LINEAR: pFillInfo->type = TSDB_FILL_LINEAR; break; @@ -466,6 +469,9 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t case FILL_MODE_VALUE: pFillInfo->type = TSDB_FILL_SET_VALUE; break; + case FILL_MODE_VALUE_F: + pFillInfo->type = TSDB_FILL_SET_VALUE_F; + break; default: { taosMemoryFree(pFillInfo); terrno = TSDB_CODE_INVALID_PARA; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index cd5ae7ad6e..e28486e0b6 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1990,10 +1990,14 @@ char* nodesGetFillModeString(EFillMode mode) { return "none"; case FILL_MODE_VALUE: return "value"; + case FILL_MODE_VALUE_F: + return "value_f"; case FILL_MODE_PREV: return "prev"; case FILL_MODE_NULL: return "null"; + case FILL_MODE_NULL_F: + return "null_f"; case FILL_MODE_LINEAR: return "linear"; case FILL_MODE_NEXT: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 05d49bb027..1b0e9ae18b 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2791,7 +2791,7 @@ static int32_t convertFillValue(STranslateContext* pCxt, SDataType dt, SNodeList } static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeList* pProjectionList) { - if (FILL_MODE_VALUE != pFill->mode) { + if (FILL_MODE_VALUE != pFill->mode && FILL_MODE_VALUE_F != pFill->mode) { return TSDB_CODE_SUCCESS; }