fix(query): twa function output NULL if input has overlap timestamps

TD-18224
This commit is contained in:
Ganlin Zhao 2022-09-13 16:45:40 +08:00
parent 0d7e1eb4e0
commit 6b2bf42f68
3 changed files with 12 additions and 20 deletions

View File

@ -577,6 +577,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_FUNC_FUNTION_PARA_TYPE TAOS_DEF_ERROR_CODE(0, 0x2802)
#define TSDB_CODE_FUNC_FUNTION_PARA_VALUE TAOS_DEF_ERROR_CODE(0, 0x2803)
#define TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION TAOS_DEF_ERROR_CODE(0, 0x2804)
#define TSDB_CODE_FUNC_DUP_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x012B)
//udf
#define TSDB_CODE_UDF_STOPPING TAOS_DEF_ERROR_CODE(0, 0x2901)

View File

@ -5447,8 +5447,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5467,8 +5466,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5486,8 +5484,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5505,8 +5502,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5524,8 +5520,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5543,8 +5538,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5562,8 +5556,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5581,8 +5574,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5600,8 +5592,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);
@ -5619,8 +5610,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pInfo->p.key == st.key) {
numOfElems = 0;
goto _twa_over;
return TSDB_CODE_FUNC_DUP_TIMESTAMP;
}
INIT_INTP_POINT(st, tsList[i], val[i]);

View File

@ -579,6 +579,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_NUM, "Invalid function par
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_TYPE, "Invalid function para type")
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_VALUE, "Invalid function para value")
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION, "Not buildin function")
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_DUP_TIMESTAMP, "Duplicate timestamps not allowed in function")
//udf
TAOS_DEFINE_ERROR(TSDB_CODE_UDF_STOPPING, "udf is stopping")