From cd773bd12977e2b9517bfbfe53782cb470bb24f4 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 26 Jan 2024 18:30:34 +0800 Subject: [PATCH 1/5] coverage: comment no call function --- source/common/src/tdataformat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 02dfbfebfe..b98c89542a 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -24,6 +24,7 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, uint8_t *pDa static int32_t (*tColDataUpdateValueImpl[8][3])(SColData *pColData, uint8_t *pData, uint32_t nData, bool forward); // SBuffer ================================ +#ifdef BUILD_NO_CALL void tBufferDestroy(SBuffer *pBuffer) { tFree(pBuffer->pBuf); pBuffer->pBuf = NULL; @@ -55,7 +56,7 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData) { return code; } - +#endif // ================================ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson); @@ -1148,6 +1149,7 @@ static int tTagValJsonCmprFn(const void *p1, const void *p2) { return strcmp(((STagVal *)p1)[0].pKey, ((STagVal *)p2)[0].pKey); } +#ifdef TD_DEBUG_PRINT_TAG static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const char *tag, int32_t ln) { switch (type) { case TSDB_DATA_TYPE_VARBINARY: @@ -1239,6 +1241,7 @@ void debugPrintSTag(STag *pTag, const char *tag, int32_t ln) { } printf("\n"); } +#endif static int32_t tPutTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) { int32_t n = 0; @@ -2576,6 +2579,7 @@ _exit: return code; } +#ifdef BUILD_NO_CALL static int32_t tColDataSwapValue(SColData *pColData, int32_t i, int32_t j) { int32_t code = 0; @@ -2658,6 +2662,7 @@ static void tColDataSwap(SColData *pColData, int32_t i, int32_t j) { break; } } +#endif static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SColData *pToColData, int32_t iToRow) { int32_t code = TSDB_CODE_SUCCESS; From c431abda5dcac781fea948c679b267b2867a1ff9 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 27 Jan 2024 10:20:07 +0800 Subject: [PATCH 2/5] fix: add sample function case --- tests/army/community/query/query_basic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 588ac707eb..35ea5d0e59 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -396,6 +396,9 @@ class TDTestCase(TBase): sql = "select first(100-90-1),last(2*5),first(11.1),last(22.2)" tdSql.checkDataMem(sql, [[9, 10, 11.1, 22.2]]) + sql = "select sample(6, 1);" + tdSql.checkFirstValue(sql, 6) + # run def run(self): tdLog.debug(f"start to excute {__file__}") From 9232e9272015591cb4ce585489f44718fecc7743 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 27 Jan 2024 10:25:13 +0800 Subject: [PATCH 3/5] fix: add statecount check --- tests/army/community/query/query_basic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 35ea5d0e59..35d9e15d93 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -375,6 +375,8 @@ class TDTestCase(TBase): sql = f"select stateduration(9.9,'{ops[i]}',11.1,1s);" #tdSql.checkFirstValue(sql, vals[i]) bug need fix tdSql.execute(sql) + sql = "select statecount(9,'EQAAAA',10);" + tdSql.error(sql) # histogram check crash sqls = [ From 9db0248e14e1c867486afeb5bca117ea236da5f8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 27 Jan 2024 10:39:50 +0800 Subject: [PATCH 4/5] fix: add percentile and spread --- tests/army/community/query/query_basic.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 35d9e15d93..7b3b9f2b22 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -398,9 +398,26 @@ class TDTestCase(TBase): sql = "select first(100-90-1),last(2*5),first(11.1),last(22.2)" tdSql.checkDataMem(sql, [[9, 10, 11.1, 22.2]]) + # sample sql = "select sample(6, 1);" tdSql.checkFirstValue(sql, 6) + # spread + sql = "select spread(12);" + tdSql.checkFirstValue(sql, 12) + + # percentile + sql = "select percentile(10.1,100);" + tdSql.checkFirstValue(sql, 10.1) + sql = "select percentile(10, 0);" + tdSql.checkFirstValue(sql, 10) + sql = "select percentile(100, 60, 70, 80);" + tdSql.execute(sql) + + # apercentile + sql = "select apercentile(10.1,100);" + tdSql.checkFirstValue(sql, 10.1) + # run def run(self): tdLog.debug(f"start to excute {__file__}") From 4d4de4bdaab07c40faae5479da20a063ba1bb789 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 27 Jan 2024 22:36:30 +0800 Subject: [PATCH 5/5] fix:spread result --- tests/army/community/query/query_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 7b3b9f2b22..bfe88e483e 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -404,7 +404,7 @@ class TDTestCase(TBase): # spread sql = "select spread(12);" - tdSql.checkFirstValue(sql, 12) + tdSql.checkFirstValue(sql, 0) # percentile sql = "select percentile(10.1,100);"