diff --git a/packaging/release.sh b/packaging/release.sh index bf9c89bf4be16f4d220485994d212bf8468e6f41..ba8603a0b2ca7748cefc6a72970b29739bf8e810 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -385,9 +385,14 @@ if [[ "$dbName" == "kh" ]]; then # src/kit/shell/src/shellEngine.c sed -i "s/TDengine shell/KingHistorian shell/g" ${top_dir}/src/kit/shell/src/shellEngine.c sed -i "s/2020 by TAOS Data, Inc/2021 by Wellintech, Inc/g" ${top_dir}/src/kit/shell/src/shellEngine.c - sed -i "s/\"taos> \"/\"kh> \"/g" ${top_dir}/src/kit/shell/src/shellEngine.c + sed -i "s/taos connect failed/kh connect failed/g" ${top_dir}/src/kit/shell/src/shellEngine.c + sed -i "s/\"taos> \"/\"khclient> \"/g" ${top_dir}/src/kit/shell/src/shellEngine.c sed -i "s/\" -> \"/\" -> \"/g" ${top_dir}/src/kit/shell/src/shellEngine.c sed -i "s/prompt_size = 6/prompt_size = 4/g" ${top_dir}/src/kit/shell/src/shellEngine.c + # src/rpc/src/rpcMain.c + sed -i "s/taos connections/kh connections/g" ${top_dir}/src/rpc/src/rpcMain.c + # src/plugins/monitor/src/monMain.c + sed -i "s/taosd is quiting/khserver is quiting/g" ${top_dir}/src/plugins/monitor/src/monMain.c fi diff --git a/packaging/tools/makeclient_kh.sh b/packaging/tools/makeclient_kh.sh index b991e2a6fae69a72d678cf5ff8751429a9f88fc6..0d7c05249f47a25ce52296253cc763ae2c972e79 100755 --- a/packaging/tools/makeclient_kh.sh +++ b/packaging/tools/makeclient_kh.sh @@ -63,6 +63,7 @@ mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/kinghis sed -i '/dataDir/ {s/taos/kinghistorian/g}' ${install_dir}/cfg/kinghistorian.cfg sed -i '/logDir/ {s/taos/kinghistorian/g}' ${install_dir}/cfg/kinghistorian.cfg sed -i "s/TDengine/KingHistorian/g" ${install_dir}/cfg/kinghistorian.cfg +sed -i "s/TAOS/KingHistorian/g" ${install_dir}/cfg/kinghistorian.cfg mkdir -p ${install_dir}/bin if [ "$osType" != "Darwin" ]; then diff --git a/packaging/tools/makepkg_kh.sh b/packaging/tools/makepkg_kh.sh index 80b7a06041c6c9dca926ecc0f87c8c8a7958c639..16b5b1a50817aadc1d078814f5db9137aeaa4415 100755 --- a/packaging/tools/makepkg_kh.sh +++ b/packaging/tools/makepkg_kh.sh @@ -74,7 +74,6 @@ if [ "$verMode" == "cluster" ]; then cp ${nginx_dir}/png/taos.png ${install_dir}/nginxd/admin/images/taos.png rm -rf ${install_dir}/nginxd/png - # replace the OEM name, add by yangzy@2021-09-22 sed -i -e 's/www.taosdata.com/www.wellintech.com/g' $(grep -r 'www.taosdata.com' ${install_dir}/nginxd | sed -r "s/(.*\.html):\s*(.*)/\1/g") sed -i -e 's/2017/2021/g' $(grep -r '2017' ${install_dir}/nginxd | sed -r "s/(.*\.html):\s*(.*)/\1/g") sed -i -e 's/TAOS Data/Wellintech/g' $(grep -r 'TAOS Data' ${install_dir}/nginxd | sed -r "s/(.*\.html):\s*(.*)/\1/g") @@ -99,6 +98,7 @@ sed -i "s/TDengine/KingHistorian/g" ${install_dir}/cfg/kinghistorian.cfg sed -i "s/support@taosdata.com/support@wellintech.com/g" ${install_dir}/cfg/kinghistorian.cfg sed -i "s/taos client/khclient/g" ${install_dir}/cfg/kinghistorian.cfg sed -i "s/taosd/khserver/g" ${install_dir}/cfg/kinghistorian.cfg +sed -i "s/TAOS/KingHistorian/g" ${install_dir}/cfg/kinghistorian.cfg cd ${install_dir} tar -zcv -f kinghistorian.tar.gz * --remove-files || : diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 730b6255ba110b4f730e1b4757ca060dbe301a89..5986a886ad47fa14abba8328c3c3a2f9b38d75e5 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4606,7 +4606,7 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI } } - pse->colInfo.flag = TSDB_COL_NORMAL; + pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL; pse->resType = pSource->base.resType; pse->resBytes = pSource->base.resBytes; strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name)); diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 68766edb5a936e4ade29acc45a239eb58ee593db..bf54763b80e85d857b94242357169b3d37ae9db3 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -53,11 +53,11 @@ char CONTINUE_PROMPT[] = " -> "; int prompt_size = 7; #elif (_TD_KH_ == true) char CLIENT_VERSION[] = "Welcome to the KingHistorian shell from %s, Client Version:%s\n" - "Copyright (c) 2021 by Hanatech, Inc. All rights reserved.\n\n"; -char PROMPT_HEADER[] = "kh> "; + "Copyright (c) 2021 by Wellintech, Inc. All rights reserved.\n\n"; +char PROMPT_HEADER[] = "khclient> "; -char CONTINUE_PROMPT[] = " -> "; -int prompt_size = 4; +char CONTINUE_PROMPT[] = " -> "; +int prompt_size = 10; #else char CLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" "Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.\n\n"; @@ -118,7 +118,11 @@ TAOS *shellInit(SShellArguments *_args) { } if (con == NULL) { +#ifdef _TD_KH_ + printf("kh connect failed, reason: %s.\n\n", tstrerror(terrno)); +#else printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno)); +#endif fflush(stdout); return con; } diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 13a0835c3960333c6d12aa443025de5fb95d565e..fff17a4194b222f5a61535cd8a0509450c17bcd2 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -53,7 +53,7 @@ static void httpStopThread(HttpThread *pThread) { break; } } while (0); - if (r) { + if (r && taosCheckPthreadValid(pThread->thread)) { pthread_cancel(pThread->thread); } #else @@ -63,15 +63,21 @@ static void httpStopThread(HttpThread *pThread) { httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); pThread->stop = true; - pthread_cancel(pThread->thread); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_cancel(pThread->thread); + } } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); - pthread_cancel(pThread->thread); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_cancel(pThread->thread); + } } #endif // __APPLE__ - pthread_join(pThread->thread, NULL); + if (taosCheckPthreadValid(pThread->thread)) { + pthread_join(pThread->thread, NULL); + } #ifdef __APPLE__ if (sv[0] != -1) { diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c index fea793fa860fd17ff30bcecae1436180bc6b34bf..5677fff71cc56197e9075c286d565d77ce3169c1 100644 --- a/src/plugins/monitor/src/monMain.c +++ b/src/plugins/monitor/src/monMain.c @@ -123,7 +123,11 @@ static void *monThreadFunc(void *param) { if (tsMonitor.quiting) { tsMonitor.state = MON_STATE_NOT_INIT; +#ifdef _TD_KH_ + monInfo("monitor thread will quit, for khserver is quiting"); +#else monInfo("monitor thread will quit, for taosd is quiting"); +#endif break; } else { taosGetDisk(); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 5f69e7b8d886b8a0c9e55b7849ee2eb87f1a2c80..4d38cf149d61e877485448fbd482d303afa69832 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1713,9 +1713,6 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn int32_t num = 0; for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) { char* val = ((char*)pColInfoData->pData) + bytes * j; - if (isNull(val, type)) { - continue; - } // Compare with the previous row of this column, and do not set the output buffer again if they are identical. if (pInfo->prevData == NULL) { diff --git a/tests/pytest/functions/function_count_last_stab.py b/tests/pytest/functions/function_count_last_stab.py index 1d777c6bd314941036f542c7d0e9063e590fa7dd..cd0a9b17c2fd8c98544dca09f6a7008929225ece 100644 --- a/tests/pytest/functions/function_count_last_stab.py +++ b/tests/pytest/functions/function_count_last_stab.py @@ -42,22 +42,22 @@ class TDTestCase: % (self.ts + i, i + 1, 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) tdSql.query("select count(*),last(*) from stest group by col1") - tdSql.checkRows(10) - tdSql.checkData(0, 0, 1) - tdSql.checkData(1, 2, 2) - tdSql.checkData(1, 3, 1) + tdSql.checkRows(11) + tdSql.checkData(1, 0, 1) + tdSql.checkData(2, 2, 2) + tdSql.checkData(2, 3, 1) tdSql.query("select count(*),last(*) from stest group by col2") - tdSql.checkRows(1) - tdSql.checkData(0, 0, 10) - tdSql.checkData(0, 2, 10) - tdSql.checkData(0, 3, 1) + tdSql.checkRows(2) + tdSql.checkData(1, 0, 10) + tdSql.checkData(1, 2, 10) + tdSql.checkData(1, 3, 1) tdSql.query("select count(*),last(ts,stest.*) from stest group by col1") - tdSql.checkRows(10) - tdSql.checkData(0, 0, 1) - tdSql.checkData(0, 2, "2018-09-17 09:00:00") - tdSql.checkData(1, 4, 1) + tdSql.checkRows(11) + tdSql.checkData(1, 0, 1) + tdSql.checkData(1, 2, "2018-09-17 09:00:00") + tdSql.checkData(2, 4, 1) diff --git a/tests/pytest/query/nestedQuery/nestedQuery.py b/tests/pytest/query/nestedQuery/nestedQuery.py index 341a4985e09e64a08a6ebd79acbec23be0853deb..2b6f8a63550ecb35907dca71cf94437cc2364605 100755 --- a/tests/pytest/query/nestedQuery/nestedQuery.py +++ b/tests/pytest/query/nestedQuery/nestedQuery.py @@ -488,7 +488,7 @@ class TDTestCase: tdLog.info(len(sql)) tdSql.query(sql) #tdSql.checkData(0,0,'2020-09-13 20:26:40.000') - tdSql.checkRows(6*self.num) + tdSql.checkRows(6*self.num) #1 outer union not support #dcDB = self.dropandcreateDB(random.randint(1,3)) @@ -2164,6 +2164,68 @@ class TDTestCase: tdLog.info(len(sql)) tdSql.query(sql) + tdSql.query("select 21-4 from table_0;") + for i in range(self.fornum): + sql = "select avg(res1),min(res2),max(res3) from ( select " + sql += "%s res1, " % random.choice(calc_aggregate_all) + sql += "%s res2," % random.choice(calc_aggregate_all) + sql += "%s res3 " % random.choice(calc_aggregate_all) + sql += " from regular_table_1 t1 " + sql += " where %s " % random.choice(q_where) + sql += " %s ) " % random.choice(interval_sliding) + sql += "group by ts " + sql += "%s ;" % random.choice(limit_where) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + + tdSql.query("select 21-5 from table_0;") + for i in range(self.fornum): + sql = "select avg(res1),min(res2),max(res3) from ( select " + sql += "%s res1, " % random.choice(calc_aggregate_all) + sql += "%s res2," % random.choice(calc_aggregate_all) + sql += "%s res3 " % random.choice(calc_aggregate_all) + sql += " from table_1 t1 " + sql += " where %s " % random.choice(q_where) + sql += " %s ) " % random.choice(interval_sliding) + sql += "group by ts " + sql += "%s ;" % random.choice([limit_where[2] , limit_where[3]] ) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + + tdSql.query("select 21-6 from table_0;") + for i in range(self.fornum): + sql = "select avg(res1),min(res2),max(res3) from ( select " + sql += "%s res1, " % random.choice(calc_aggregate_all) + sql += "%s res2," % random.choice(calc_aggregate_all) + sql += "%s res3 " % random.choice(calc_aggregate_all) + sql += " from stable_1 t1 " + sql += " where %s " % random.choice(q_where) + sql += " %s ) " % random.choice(interval_sliding) + sql += "group by ts " + sql += "%s ;" % random.choice(limit_where) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + + tdSql.query("select 21-7 from table_0;") + for i in range(self.fornum): + sql = "select avg(res1),min(res2),max(res3) from ( select " + sql += "%s res1, " % random.choice(calc_aggregate_all) + sql += "%s res2," % random.choice(calc_aggregate_all) + sql += "%s res3 " % random.choice(calc_aggregate_all) + sql += " from stable_1 t1 " + sql += " where %s " % random.choice(q_where) + sql += " %s " % random.choice(interval_sliding) + sql += " %s ) " % random.choice(group_where) + sql += "group by ts " + sql += "%s ;" % random.choice(limit_where) + tdLog.info(sql) + tdLog.info(len(sql)) + tdSql.query(sql) + + # error #1 select * from (select * from (select * form regular_table where <\>\in\and\or order by limit )) tdSql.query("select 1-1 from table_1;") diff --git a/tests/script/general/parser/col_arithmetic_query.sim b/tests/script/general/parser/col_arithmetic_query.sim index 17ae6cfd6b8b5636101e67e8d99f6999e50a06a5..2576b1442a7793ab4bb5d22d52ce950d885cdbd0 100644 --- a/tests/script/general/parser/col_arithmetic_query.sim +++ b/tests/script/general/parser/col_arithmetic_query.sim @@ -553,19 +553,19 @@ endi sql_error select first(c6) - last(c6) *12 / count(*) from $stb group by c3; sql select first(c6) - last(c6) *12 / count(*) from $stb group by c5; -if $rows != 10 then +if $rows != 11 then return -1 endi -if $data00 != 0.000000000 then +if $data00 != -0.002160000 then return -1 endi -if $data10 != 0.997600000 then +if $data10 != 0.000000000 then return -1 endi -if $data90 != 8.978400000 then +if $data90 != 7.980800000 then return -1 endi diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index 4182b867053d5d26cdc95970c545fd0c5f20d09c..ed1e9d47909af13647114d0e45e34b60f66d303e 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -884,5 +884,18 @@ if $data00 != 24 then return -1 endi +sql select sum(a)/sum(b) from meters where ts >= '2021-09-30 15:00:00.000' and ts <= '2021-09-30 15:00:05.000' interval(1s) fill(null) group by area order by area; +if $rows != 12 then + return -1 +endi +if $data00 != @21-09-30 15:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != 0 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT