diff --git a/src/os/src/windows/wString.c b/src/os/src/windows/wString.c index 96a604ae6e3bfb2088a376894c7083a9514ae67f..3dd44bb817fa4b1f96b99fba39801fcd508106b9 100644 --- a/src/os/src/windows/wString.c +++ b/src/os/src/windows/wString.c @@ -93,7 +93,7 @@ int32_t twcslen(const wchar_t *wcs) { } int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes) { - for (int32_t i = 0; i < bytes; ++i) { + for (int32_t i = 0; i < bytes; i+=4) { int32_t f1 = *(int32_t *)((char *)f1_ucs4 + i * 4); int32_t f2 = *(int32_t *)((char *)f2_ucs4 + i * 4); diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 6dd7f17f7f9f9dd67e6a28dbc8b9d5579600119c..93de2a853b1ea0b11c7361544073d90849304b95 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -5600,7 +5600,10 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) { // }else{ // GET_RES_INFO(pCtx)->numOfRes = pRes->num; // } - if (GET_RES_INFO(pCtx)->numOfRes <= 0) return; + if (GET_RES_INFO(pCtx)->numOfRes <= 0) { + doFinalizer(pCtx); + return; + } taosqsort(pRes->res, pRes->num, POINTER_BYTES, NULL, tailComparFn); @@ -5608,6 +5611,7 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) { void *data = calloc(size, GET_RES_INFO(pCtx)->numOfRes); if(!data){ qError("calloc error in tail_func_finalizer: size:%d, num:%d", (int32_t)size, GET_RES_INFO(pCtx)->numOfRes); + doFinalizer(pCtx); return; } for(int32_t i = 0; i < GET_RES_INFO(pCtx)->numOfRes; i++){ diff --git a/tests/develop-test/0-others/json_tag.py b/tests/develop-test/0-others/json_tag.py index 2fc3c5bb095ea8dbcd4db28ced6b52bc68722515..26f582bc93ab6acdd390b53134fc2cbc0e5659b1 100644 --- a/tests/develop-test/0-others/json_tag.py +++ b/tests/develop-test/0-others/json_tag.py @@ -17,6 +17,7 @@ from util.log import tdLog from util.cases import tdCases from util.sql import tdSql import json +import site class TDTestCase: @@ -34,7 +35,8 @@ class TDTestCase: def run(self): tdSql.prepare() - + print("print sitepackage path: ") + print(site.getsitepackages()) print("============== STEP 1 ===== prepare data & validate json string") tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json, tagint int)") tdSql.error("create table if not exists jsons1(ts timestamp, data json) tags(tagint int)") @@ -422,8 +424,8 @@ class TDTestCase: tdSql.checkData(0, 1, 4) tdSql.checkData(1, 1, 24) tdSql.checkData(1, 2, None) - tdSql.checkData(9, 1, 1) - tdSql.checkData(9, 2, '"femail"') + tdSql.checkData(8, 1, 1) + tdSql.checkData(8, 2, '"femail"') # test having tdSql.query("select stddev(dataint) from jsons1 group by jtag->'tag1' having stddev(dataint) > 0") diff --git a/tests/develop-test/2-query/function_tail.py b/tests/develop-test/2-query/function_tail.py index a5be3efb906f14c6e7a96cc444c6c90915e2c82a..6eb53ba85fddd0087f53e7fdbb485eb0b8bd65a3 100644 --- a/tests/develop-test/2-query/function_tail.py +++ b/tests/develop-test/2-query/function_tail.py @@ -131,7 +131,7 @@ class TDTestCase: tdSql.checkData(2, 0, "2021-10-17 00:31:31") tdSql.checkData(2, 1, 253) tdSql.checkData(4, 0, "2022-01-01 08:00:07") - tdSql.checkData(4, 1, 25) + tdSql.checkData(6, 1, 25) tdSql.query('select tail(dtiny,2,1) from stail group by dnchar') tdSql.checkRows(5) diff --git a/tests/develop-test/2-query/function_unique.py b/tests/develop-test/2-query/function_unique.py index f6c05413f2ff95c0221002a48ed3f59672492a50..2a603cf5d52414e6136056ed07d7b1232b568a9d 100644 --- a/tests/develop-test/2-query/function_unique.py +++ b/tests/develop-test/2-query/function_unique.py @@ -142,11 +142,11 @@ class TDTestCase: tdSql.query('select ts,unique(voltage) from unique group by location') tdSql.checkRows(8) tdSql.checkData(0, 2, 1) - tdSql.checkData(0, 3, "Beijing.haidian") - tdSql.checkData(3, 2, 1) - tdSql.checkData(3, 3, "Beijing.Chaoyang") - tdSql.checkData(5, 2, 1) - tdSql.checkData(5, 3, "Beijing.Tongzhou") + tdSql.checkData(5, 3, "Beijing.haidian") + tdSql.checkData(0, 2, 1) + tdSql.checkData(0, 3, "Beijing.Chaoyang") + tdSql.checkData(2, 2, 1) + tdSql.checkData(2, 3, "Beijing.Tongzhou") #group by ts tdSql.query('select ts,unique(voltage) from unique group by ts') tdSql.checkRows(9)