提交 802b6d11 编写于 作者: A Alex Duan

[TS-207]<fix>(query): fixed two error for client merge

上级 41e89bdc
...@@ -93,7 +93,7 @@ int32_t twcslen(const wchar_t *wcs) { ...@@ -93,7 +93,7 @@ int32_t twcslen(const wchar_t *wcs) {
} }
int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes) { 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 f1 = *(int32_t *)((char *)f1_ucs4 + i * 4);
int32_t f2 = *(int32_t *)((char *)f2_ucs4 + i * 4); int32_t f2 = *(int32_t *)((char *)f2_ucs4 + i * 4);
......
...@@ -5600,7 +5600,10 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) { ...@@ -5600,7 +5600,10 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) {
// }else{ // }else{
// GET_RES_INFO(pCtx)->numOfRes = pRes->num; // 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); taosqsort(pRes->res, pRes->num, POINTER_BYTES, NULL, tailComparFn);
...@@ -5608,6 +5611,7 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) { ...@@ -5608,6 +5611,7 @@ static void tail_func_finalizer(SQLFunctionCtx *pCtx) {
void *data = calloc(size, GET_RES_INFO(pCtx)->numOfRes); void *data = calloc(size, GET_RES_INFO(pCtx)->numOfRes);
if(!data){ if(!data){
qError("calloc error in tail_func_finalizer: size:%d, num:%d", (int32_t)size, GET_RES_INFO(pCtx)->numOfRes); qError("calloc error in tail_func_finalizer: size:%d, num:%d", (int32_t)size, GET_RES_INFO(pCtx)->numOfRes);
doFinalizer(pCtx);
return; return;
} }
for(int32_t i = 0; i < GET_RES_INFO(pCtx)->numOfRes; i++){ for(int32_t i = 0; i < GET_RES_INFO(pCtx)->numOfRes; i++){
......
...@@ -17,6 +17,7 @@ from util.log import tdLog ...@@ -17,6 +17,7 @@ from util.log import tdLog
from util.cases import tdCases from util.cases import tdCases
from util.sql import tdSql from util.sql import tdSql
import json import json
import site
class TDTestCase: class TDTestCase:
...@@ -34,7 +35,8 @@ class TDTestCase: ...@@ -34,7 +35,8 @@ class TDTestCase:
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
print("print sitepackage path: ")
print(site.getsitepackages())
print("============== STEP 1 ===== prepare data & validate json string") 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, 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)") tdSql.error("create table if not exists jsons1(ts timestamp, data json) tags(tagint int)")
...@@ -422,8 +424,8 @@ class TDTestCase: ...@@ -422,8 +424,8 @@ class TDTestCase:
tdSql.checkData(0, 1, 4) tdSql.checkData(0, 1, 4)
tdSql.checkData(1, 1, 24) tdSql.checkData(1, 1, 24)
tdSql.checkData(1, 2, None) tdSql.checkData(1, 2, None)
tdSql.checkData(9, 1, 1) tdSql.checkData(8, 1, 1)
tdSql.checkData(9, 2, '"femail"') tdSql.checkData(8, 2, '"femail"')
# test having # test having
tdSql.query("select stddev(dataint) from jsons1 group by jtag->'tag1' having stddev(dataint) > 0") tdSql.query("select stddev(dataint) from jsons1 group by jtag->'tag1' having stddev(dataint) > 0")
......
...@@ -131,7 +131,7 @@ class TDTestCase: ...@@ -131,7 +131,7 @@ class TDTestCase:
tdSql.checkData(2, 0, "2021-10-17 00:31:31") tdSql.checkData(2, 0, "2021-10-17 00:31:31")
tdSql.checkData(2, 1, 253) tdSql.checkData(2, 1, 253)
tdSql.checkData(4, 0, "2022-01-01 08:00:07") 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.query('select tail(dtiny,2,1) from stail group by dnchar')
tdSql.checkRows(5) tdSql.checkRows(5)
......
...@@ -142,11 +142,11 @@ class TDTestCase: ...@@ -142,11 +142,11 @@ class TDTestCase:
tdSql.query('select ts,unique(voltage) from unique group by location') tdSql.query('select ts,unique(voltage) from unique group by location')
tdSql.checkRows(8) tdSql.checkRows(8)
tdSql.checkData(0, 2, 1) tdSql.checkData(0, 2, 1)
tdSql.checkData(0, 3, "Beijing.haidian") tdSql.checkData(5, 3, "Beijing.haidian")
tdSql.checkData(3, 2, 1) tdSql.checkData(0, 2, 1)
tdSql.checkData(3, 3, "Beijing.Chaoyang") tdSql.checkData(0, 3, "Beijing.Chaoyang")
tdSql.checkData(5, 2, 1) tdSql.checkData(2, 2, 1)
tdSql.checkData(5, 3, "Beijing.Tongzhou") tdSql.checkData(2, 3, "Beijing.Tongzhou")
#group by ts #group by ts
tdSql.query('select ts,unique(voltage) from unique group by ts') tdSql.query('select ts,unique(voltage) from unique group by ts')
tdSql.checkRows(9) tdSql.checkRows(9)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册