Merge branch '3.0' of https://github.com/taosdata/TDengine into feature/3.0_mhli
This commit is contained in:
commit
fba5850b1a
|
@ -22,6 +22,7 @@ mac/
|
|||
.mypy_cache
|
||||
*.tmp
|
||||
*.swp
|
||||
*.swo
|
||||
*.orig
|
||||
src/connector/nodejs/node_modules/
|
||||
src/connector/nodejs/out/
|
||||
|
|
|
@ -13,9 +13,15 @@ IF (TD_LINUX)
|
|||
#TARGET_LINK_LIBRARIES(epoll taos_static trpc tutil pthread lua)
|
||||
|
||||
add_executable(tmq "")
|
||||
add_executable(tmq_taosx "")
|
||||
add_executable(stream_demo "")
|
||||
add_executable(demoapi "")
|
||||
|
||||
target_sources(tmq_taosx
|
||||
PRIVATE
|
||||
"tmq_taosx.c"
|
||||
)
|
||||
|
||||
target_sources(tmq
|
||||
PRIVATE
|
||||
"tmq.c"
|
||||
|
@ -35,6 +41,10 @@ IF (TD_LINUX)
|
|||
taos_static
|
||||
)
|
||||
|
||||
target_link_libraries(tmq_taosx
|
||||
taos_static
|
||||
)
|
||||
|
||||
target_link_libraries(stream_demo
|
||||
taos_static
|
||||
)
|
||||
|
@ -47,6 +57,10 @@ IF (TD_LINUX)
|
|||
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
target_include_directories(tmq_taosx
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/os"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
|
||||
target_include_directories(stream_demo
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
|
@ -59,6 +73,7 @@ IF (TD_LINUX)
|
|||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(tmq PROPERTIES OUTPUT_NAME tmq)
|
||||
SET_TARGET_PROPERTIES(tmq_taosx PROPERTIES OUTPUT_NAME tmq_taosx)
|
||||
SET_TARGET_PROPERTIES(stream_demo PROPERTIES OUTPUT_NAME stream_demo)
|
||||
SET_TARGET_PROPERTIES(demoapi PROPERTIES OUTPUT_NAME demoapi)
|
||||
ENDIF ()
|
||||
|
|
|
@ -302,7 +302,7 @@ int32_t create_topic() {
|
|||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
/*pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");*/
|
||||
// pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");
|
||||
pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
|
||||
|
|
|
@ -0,0 +1,459 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "taos.h"
|
||||
|
||||
static int running = 1;
|
||||
|
||||
static TAOS* use_db(){
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
if (pConn == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "use db_taosx");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in use db_taosx, reason:%s\n", taos_errstr(pRes));
|
||||
return NULL;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
return pConn;
|
||||
}
|
||||
|
||||
static void msg_process(TAOS_RES* msg) {
|
||||
/*memset(buf, 0, 1024);*/
|
||||
printf("-----------topic-------------: %s\n", tmq_get_topic_name(msg));
|
||||
printf("db: %s\n", tmq_get_db_name(msg));
|
||||
printf("vg: %d\n", tmq_get_vgroup_id(msg));
|
||||
TAOS *pConn = use_db();
|
||||
if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) {
|
||||
char* result = tmq_get_json_meta(msg);
|
||||
if (result) {
|
||||
printf("meta result: %s\n", result);
|
||||
}
|
||||
tmq_free_json_meta(result);
|
||||
|
||||
|
||||
tmq_raw_data raw = {0};
|
||||
tmq_get_raw_meta(msg, &raw);
|
||||
int32_t ret = taos_write_raw_meta(pConn, raw);
|
||||
printf("write raw meta: %s\n", tmq_err2str(ret));
|
||||
}
|
||||
|
||||
if(tmq_get_res_type(msg) == TMQ_RES_DATA){
|
||||
int32_t ret =taos_write_raw_data(pConn, msg);
|
||||
printf("write raw data: %s\n", tmq_err2str(ret));
|
||||
}
|
||||
taos_close(pConn);
|
||||
}
|
||||
|
||||
int32_t init_env() {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
if (pConn == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "drop database if exists db_taosx");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create database if not exists db_taosx vgroups 4");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in create db_taosx, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "drop database if exists abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in drop db, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create database if not exists abc1 vgroups 3");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in create db, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in use db, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn,
|
||||
"create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 "
|
||||
"nchar(8), t4 bool)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000, \"ttt\", true)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "insert into ct0 values(now, 1, 2, 'a')");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table if not exists ct1 using st1(t1) tags(2000)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create child table ct1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table if not exists ct2 using st1(t1) tags(NULL)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create child table ct2, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "insert into ct1 values(now, 3, 4, 'b')");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table if not exists ct3 using st1(t1) tags(3000)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create child table ct3, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "insert into ct3 values(now, 5, 6, 'c') ct1 values(now+1s, 2, 3, 'sds') (now+2s, 4, 5, 'ddd') ct0 values(now+1s, 4, 3, 'hwj') ct1 values(now+5s, 23, 32, 's21ds')");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table st1 add column c4 bigint");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table st1 modify column c3 binary(64)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "insert into ct3 values(now+7s, 53, 63, 'cffffffffffffffffffffffffffff', 8989898899999) (now+9s, 51, 62, 'c333', 940)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table st1 add tag t2 binary(64)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table ct3 set tag t1=5000");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to slter child table ct3, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
// pRes = taos_query(pConn, "drop table ct3 ct1");
|
||||
// if (taos_errno(pRes) != 0) {
|
||||
// printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes));
|
||||
// return -1;
|
||||
// }
|
||||
// taos_free_result(pRes);
|
||||
//
|
||||
// pRes = taos_query(pConn, "drop table st1");
|
||||
// if (taos_errno(pRes) != 0) {
|
||||
// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
// return -1;
|
||||
// }
|
||||
// taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table n1 add column c3 bigint");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table n1 modify column c2 nchar(8)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table n1 rename column c3 cc3");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table n1 comment 'hello'");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "alter table n1 drop column c1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "insert into n1 values(now, 'eeee', 8989898899999) (now+9s, 'c333', 940)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to insert into n1, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
// pRes = taos_query(pConn, "drop table n1");
|
||||
// if (taos_errno(pRes) != 0) {
|
||||
// printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes));
|
||||
// return -1;
|
||||
// }
|
||||
// taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table jt1 using jt tags('{\"k1\":1, \"k2\":\"hello\"}')");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table jt2 using jt tags('')");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create super table jt2, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
// pRes = taos_query(pConn,
|
||||
// "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 "
|
||||
// "nchar(8), t4 bool)");
|
||||
// if (taos_errno(pRes) != 0) {
|
||||
// printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
// return -1;
|
||||
// }
|
||||
// taos_free_result(pRes);
|
||||
//
|
||||
// pRes = taos_query(pConn, "drop table st1");
|
||||
// if (taos_errno(pRes) != 0) {
|
||||
// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes));
|
||||
// return -1;
|
||||
// }
|
||||
// taos_free_result(pRes);
|
||||
|
||||
taos_close(pConn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t create_topic() {
|
||||
printf("create topic\n");
|
||||
TAOS_RES* pRes;
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
if (pConn == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in use db, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
taos_close(pConn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
|
||||
printf("commit %d tmq %p param %p\n", code, tmq, param);
|
||||
}
|
||||
|
||||
tmq_t* build_consumer() {
|
||||
#if 0
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
assert(pConn != NULL);
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("error in use db, reason:%s\n", taos_errstr(pRes));
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
#endif
|
||||
|
||||
tmq_conf_t* conf = tmq_conf_new();
|
||||
tmq_conf_set(conf, "group.id", "tg2");
|
||||
tmq_conf_set(conf, "client.id", "my app 1");
|
||||
tmq_conf_set(conf, "td.connect.user", "root");
|
||||
tmq_conf_set(conf, "td.connect.pass", "taosdata");
|
||||
tmq_conf_set(conf, "msg.with.table.name", "true");
|
||||
tmq_conf_set(conf, "enable.auto.commit", "true");
|
||||
|
||||
/*tmq_conf_set(conf, "experimental.snapshot.enable", "true");*/
|
||||
|
||||
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
||||
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
||||
assert(tmq);
|
||||
tmq_conf_destroy(conf);
|
||||
return tmq;
|
||||
}
|
||||
|
||||
tmq_list_t* build_topic_list() {
|
||||
tmq_list_t* topic_list = tmq_list_new();
|
||||
tmq_list_append(topic_list, "topic_ctb_column");
|
||||
/*tmq_list_append(topic_list, "tmq_test_db_multi_insert_topic");*/
|
||||
return topic_list;
|
||||
}
|
||||
|
||||
void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
|
||||
int32_t code;
|
||||
|
||||
if ((code = tmq_subscribe(tmq, topics))) {
|
||||
fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code));
|
||||
printf("subscribe err\n");
|
||||
return;
|
||||
}
|
||||
int32_t cnt = 0;
|
||||
while (running) {
|
||||
TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, -1);
|
||||
if (tmqmessage) {
|
||||
cnt++;
|
||||
msg_process(tmqmessage);
|
||||
/*if (cnt >= 2) break;*/
|
||||
/*printf("get data\n");*/
|
||||
taos_free_result(tmqmessage);
|
||||
/*} else {*/
|
||||
/*break;*/
|
||||
/*tmq_commit_sync(tmq, NULL);*/
|
||||
}
|
||||
}
|
||||
|
||||
code = tmq_consumer_close(tmq);
|
||||
if (code)
|
||||
fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code));
|
||||
else
|
||||
fprintf(stderr, "%% Consumer closed\n");
|
||||
}
|
||||
|
||||
void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
|
||||
static const int MIN_COMMIT_COUNT = 1;
|
||||
|
||||
int msg_count = 0;
|
||||
int32_t code;
|
||||
|
||||
if ((code = tmq_subscribe(tmq, topics))) {
|
||||
fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code));
|
||||
return;
|
||||
}
|
||||
|
||||
tmq_list_t* subList = NULL;
|
||||
tmq_subscription(tmq, &subList);
|
||||
char** subTopics = tmq_list_to_c_array(subList);
|
||||
int32_t sz = tmq_list_get_size(subList);
|
||||
printf("subscribed topics: ");
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
printf("%s, ", subTopics[i]);
|
||||
}
|
||||
printf("\n");
|
||||
tmq_list_destroy(subList);
|
||||
|
||||
while (running) {
|
||||
TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1000);
|
||||
if (tmqmessage) {
|
||||
msg_process(tmqmessage);
|
||||
taos_free_result(tmqmessage);
|
||||
|
||||
/*tmq_commit_sync(tmq, NULL);*/
|
||||
/*if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0);*/
|
||||
}
|
||||
}
|
||||
|
||||
code = tmq_consumer_close(tmq);
|
||||
if (code)
|
||||
fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code));
|
||||
else
|
||||
fprintf(stderr, "%% Consumer closed\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("env init\n");
|
||||
if (init_env() < 0) {
|
||||
return -1;
|
||||
}
|
||||
create_topic();
|
||||
|
||||
tmq_t* tmq = build_consumer();
|
||||
tmq_list_t* topic_list = build_topic_list();
|
||||
basic_consume_loop(tmq, topic_list);
|
||||
/*sync_consume_loop(tmq, topic_list);*/
|
||||
}
|
|
@ -270,6 +270,7 @@ typedef enum tmq_res_t tmq_res_t;
|
|||
DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
|
||||
DLL_EXPORT int32_t tmq_get_raw_meta(TAOS_RES *res, tmq_raw_data *raw_meta);
|
||||
DLL_EXPORT int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data raw_meta);
|
||||
DLL_EXPORT int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *res);
|
||||
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed by tmq_free_json_meta
|
||||
DLL_EXPORT void tmq_free_json_meta(char* jsonMeta);
|
||||
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||
|
|
|
@ -153,11 +153,10 @@ typedef struct SQueryTableDataCond {
|
|||
int32_t order; // desc|asc order to iterate the data block
|
||||
int32_t numOfCols;
|
||||
SColumnInfo* colList;
|
||||
int32_t type; // data block load type:
|
||||
// int32_t numOfTWindows;
|
||||
STimeWindow twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
int32_t type; // data block load type:
|
||||
STimeWindow twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
} SQueryTableDataCond;
|
||||
|
||||
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock);
|
||||
|
|
|
@ -184,8 +184,8 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
|
|||
int32_t getJsonValueLen(const char* data);
|
||||
|
||||
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull);
|
||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, uint32_t* capacity,
|
||||
const SColumnInfoData* pSource, uint32_t numOfRow2);
|
||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
||||
const SColumnInfoData* pSource, int32_t numOfRow2);
|
||||
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
|
||||
const SDataBlockInfo* pBlockInfo);
|
||||
int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex);
|
||||
|
|
|
@ -21,6 +21,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "taoserror.h"
|
||||
|
||||
typedef enum {
|
||||
TSDB_GRANT_ALL,
|
||||
|
|
|
@ -1977,6 +1977,7 @@ typedef struct SVCreateTbReq {
|
|||
union {
|
||||
struct {
|
||||
char* name; // super table name
|
||||
uint8_t tagNum;
|
||||
tb_uid_t suid;
|
||||
SArray* tagName;
|
||||
uint8_t* pTag;
|
||||
|
|
|
@ -65,7 +65,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
|
|||
* @return
|
||||
*/
|
||||
qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols,
|
||||
SSchemaWrapper** pSchemaWrapper);
|
||||
SSchemaWrapper** pSchema);
|
||||
|
||||
/**
|
||||
* Set the input data block for the stream scan.
|
||||
|
@ -196,6 +196,8 @@ int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem);
|
|||
|
||||
int32_t qStreamPrepareRecover(qTaskInfo_t tinfo, int64_t startVer, int64_t endVer);
|
||||
|
||||
STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -135,6 +135,7 @@ typedef struct {
|
|||
int64_t curVersion;
|
||||
int64_t capacity;
|
||||
int8_t curInvalid;
|
||||
int8_t curStopped;
|
||||
TdThreadMutex mutex;
|
||||
SWalFilterCond cond;
|
||||
SWalCkHead *pHead;
|
||||
|
|
|
@ -39,56 +39,57 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_SUCCESS 0
|
||||
#define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error
|
||||
|
||||
//common & util
|
||||
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0003)
|
||||
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0004)
|
||||
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0005)
|
||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0010)
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0011)
|
||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0012)
|
||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0013)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0014)
|
||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0015)
|
||||
#define TSDB_CODE_INVALID_MSG_TYPE TAOS_DEF_ERROR_CODE(0, 0x0016)
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0017)
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0018)
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0019)
|
||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x001A)
|
||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x001B)
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x001C)
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x001D)
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x001E)
|
||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x001F)
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0020)
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0021)
|
||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0022)
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0023)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0024)
|
||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0025)
|
||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0026)
|
||||
#define TSDB_CODE_DUP_KEY TAOS_DEF_ERROR_CODE(0, 0x0027)
|
||||
#define TSDB_CODE_NEED_RETRY TAOS_DEF_ERROR_CODE(0, 0x0028)
|
||||
#define TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE TAOS_DEF_ERROR_CODE(0, 0x0029)
|
||||
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0030)
|
||||
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0031)
|
||||
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0032)
|
||||
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0033)
|
||||
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0034)
|
||||
|
||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0040)
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0041)
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0042)
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0043)
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0044)
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0045)
|
||||
|
||||
// rpc
|
||||
#define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||
#define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||
#define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||
#define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0103)
|
||||
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||
#define TSDB_CODE_RPC_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0003)
|
||||
#define TSDB_CODE_RPC_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0004)
|
||||
#define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x000B)
|
||||
#define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0015)
|
||||
#define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017)
|
||||
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018)
|
||||
|
||||
//common & util
|
||||
#define TSDB_CODE_TIME_UNSYNCED TAOS_DEF_ERROR_CODE(0, 0x0013)
|
||||
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0014)
|
||||
|
||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||
|
||||
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0116)
|
||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0117)
|
||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0118)
|
||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0119)
|
||||
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x011A)
|
||||
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x011B)
|
||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x011C)
|
||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x011D)
|
||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x011E)
|
||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x011F)
|
||||
|
||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0120)
|
||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0121)
|
||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0122)
|
||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0123)
|
||||
#define TSDB_CODE_DUP_KEY TAOS_DEF_ERROR_CODE(0, 0x0124)
|
||||
#define TSDB_CODE_NEED_RETRY TAOS_DEF_ERROR_CODE(0, 0x0125)
|
||||
#define TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE TAOS_DEF_ERROR_CODE(0, 0x0126)
|
||||
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0127)
|
||||
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0128)
|
||||
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0129)
|
||||
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
|
||||
|
||||
//client
|
||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||
|
@ -126,152 +127,145 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TSC_DUP_NAMES TAOS_DEF_ERROR_CODE(0, 0x0220)
|
||||
#define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221)
|
||||
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222)
|
||||
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223)
|
||||
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0224)
|
||||
#define TSDB_CODE_TSC_STMT_API_ERROR TAOS_DEF_ERROR_CODE(0, 0X0225)
|
||||
#define TSDB_CODE_TSC_STMT_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0X0226)
|
||||
#define TSDB_CODE_TSC_STMT_CLAUSE_ERROR TAOS_DEF_ERROR_CODE(0, 0X0227)
|
||||
#define TSDB_CODE_TSC_QUERY_KILLED TAOS_DEF_ERROR_CODE(0, 0X0228)
|
||||
#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0X0229)
|
||||
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022a)
|
||||
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0224)
|
||||
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0229)
|
||||
#define TSDB_CODE_TSC_STMT_API_ERROR TAOS_DEF_ERROR_CODE(0, 0X022A)
|
||||
#define TSDB_CODE_TSC_STMT_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0X022B)
|
||||
#define TSDB_CODE_TSC_STMT_CLAUSE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022C)
|
||||
#define TSDB_CODE_TSC_QUERY_KILLED TAOS_DEF_ERROR_CODE(0, 0X022D)
|
||||
#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0X022E)
|
||||
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
|
||||
|
||||
// mnode-common
|
||||
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0300)
|
||||
#define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0301)
|
||||
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0302)
|
||||
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0303)
|
||||
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0304)
|
||||
|
||||
// mnode-show
|
||||
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x0310)
|
||||
|
||||
// mnode-profile
|
||||
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x0320)
|
||||
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x0321)
|
||||
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x0322)
|
||||
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0323)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0324)
|
||||
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0325)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0326)
|
||||
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0327)
|
||||
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0303)
|
||||
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0304)
|
||||
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0305)
|
||||
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x030B)
|
||||
#define TSDB_CODE_MND_INVALID_QUERY_ID TAOS_DEF_ERROR_CODE(0, 0x030C)
|
||||
#define TSDB_CODE_MND_INVALID_STREAM_ID TAOS_DEF_ERROR_CODE(0, 0x030D)
|
||||
#define TSDB_CODE_MND_INVALID_CONN_ID TAOS_DEF_ERROR_CODE(0, 0x030E)
|
||||
#define TSDB_CODE_MND_MNODE_IS_RUNNING TAOS_DEF_ERROR_CODE(0, 0x0310)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC TAOS_DEF_ERROR_CODE(0, 0x0311)
|
||||
#define TSDB_CODE_MND_FAILED_TO_START_SYNC TAOS_DEF_ERROR_CODE(0, 0x0312)
|
||||
#define TSDB_CODE_MND_FAILED_TO_CREATE_DIR TAOS_DEF_ERROR_CODE(0, 0x0313)
|
||||
#define TSDB_CODE_MND_FAILED_TO_INIT_STEP TAOS_DEF_ERROR_CODE(0, 0x0314)
|
||||
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0315)
|
||||
|
||||
// mnode-sdb
|
||||
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0330)
|
||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0331)
|
||||
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0332)
|
||||
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x0333)
|
||||
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0334)
|
||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0335)
|
||||
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0336)
|
||||
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0337)
|
||||
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0338)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0339)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x033A)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x033B)
|
||||
#define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x033C)
|
||||
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
|
||||
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321)
|
||||
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
|
||||
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
|
||||
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
|
||||
#define TSDB_CODE_SDB_INVALID_ACTION_TYPE TAOS_DEF_ERROR_CODE(0, 0x0326)
|
||||
#define TSDB_CODE_SDB_INVALID_STATUS_TYPE TAOS_DEF_ERROR_CODE(0, 0x0327)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_VER TAOS_DEF_ERROR_CODE(0, 0x0328)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_LEN TAOS_DEF_ERROR_CODE(0, 0x0329)
|
||||
#define TSDB_CODE_SDB_INVALID_DATA_CONTENT TAOS_DEF_ERROR_CODE(0, 0x032A)
|
||||
#define TSDB_CODE_SDB_INVALID_WAl_VER TAOS_DEF_ERROR_CODE(0, 0x032B)
|
||||
#define TSDB_CODE_SDB_OBJ_CREATING TAOS_DEF_ERROR_CODE(0, 0x032C)
|
||||
#define TSDB_CODE_SDB_OBJ_DROPPING TAOS_DEF_ERROR_CODE(0, 0x032D)
|
||||
|
||||
// mnode-dnode
|
||||
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340)
|
||||
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341)
|
||||
#define TSDB_CODE_MND_TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x0342)
|
||||
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0343)
|
||||
#define TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0344)
|
||||
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0345)
|
||||
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0346)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0347)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0348)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0349)
|
||||
|
||||
// mnode-node
|
||||
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350)
|
||||
#define TSDB_CODE_MND_MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0351)
|
||||
#define TSDB_CODE_MND_QNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0352)
|
||||
#define TSDB_CODE_MND_QNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0353)
|
||||
#define TSDB_CODE_MND_SNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0354)
|
||||
#define TSDB_CODE_MND_SNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0355)
|
||||
#define TSDB_CODE_MND_BNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0356)
|
||||
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0357)
|
||||
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x0358)
|
||||
#define TSDB_CODE_MND_TOO_MANY_MNODES TAOS_DEF_ERROR_CODE(0, 0x0359)
|
||||
#define TSDB_CODE_MND_CANT_DROP_LEADER TAOS_DEF_ERROR_CODE(0, 0x035A)
|
||||
// mnode-dnode-part1
|
||||
#define TSDB_CODE_MND_DNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0330)
|
||||
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0331)
|
||||
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0332)
|
||||
#define TSDB_CODE_MND_CANT_DROP_LEADER TAOS_DEF_ERROR_CODE(0, 0x0333)
|
||||
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0334)
|
||||
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0335)
|
||||
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0338)
|
||||
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0339)
|
||||
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x033B)
|
||||
|
||||
// mnode-acct
|
||||
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||
#define TSDB_CODE_MND_ACCT_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0361)
|
||||
#define TSDB_CODE_MND_TOO_MANY_ACCTS TAOS_DEF_ERROR_CODE(0, 0x0362)
|
||||
#define TSDB_CODE_MND_INVALID_ACCT_OPTION TAOS_DEF_ERROR_CODE(0, 0x0363)
|
||||
#define TSDB_CODE_MND_ACCT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0364)
|
||||
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340)
|
||||
#define TSDB_CODE_MND_INVALID_ACCT_OPTION TAOS_DEF_ERROR_CODE(0, 0x0342)
|
||||
#define TSDB_CODE_MND_ACCT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0343)
|
||||
#define TSDB_CODE_MND_ACCT_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0344)
|
||||
#define TSDB_CODE_MND_TOO_MANY_ACCTS TAOS_DEF_ERROR_CODE(0, 0x0345)
|
||||
|
||||
// mnode-user
|
||||
#define TSDB_CODE_MND_USER_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0370)
|
||||
#define TSDB_CODE_MND_USER_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0371)
|
||||
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0372)
|
||||
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0373)
|
||||
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0374)
|
||||
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0375)
|
||||
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0376)
|
||||
#define TSDB_CODE_MND_USER_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350)
|
||||
#define TSDB_CODE_MND_USER_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0351)
|
||||
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0352)
|
||||
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0353)
|
||||
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0354)
|
||||
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355)
|
||||
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356)
|
||||
|
||||
// mnode-db
|
||||
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0380)
|
||||
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
|
||||
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0382)
|
||||
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0383)
|
||||
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0384)
|
||||
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0385)
|
||||
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0386)
|
||||
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x0387)
|
||||
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
|
||||
|
||||
// mnode-vgroup
|
||||
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0390)
|
||||
#define TSDB_CODE_MND_VGROUP_NOT_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0391)
|
||||
#define TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0392)
|
||||
#define TSDB_CODE_MND_VGROUP_UN_CHANGED TAOS_DEF_ERROR_CODE(0, 0x0393)
|
||||
#define TSDB_CODE_MND_HAS_OFFLINE_DNODE TAOS_DEF_ERROR_CODE(0, 0x0394)
|
||||
#define TSDB_CODE_MND_INVALID_REPLICA TAOS_DEF_ERROR_CODE(0, 0x0395)
|
||||
|
||||
// mnode-stable
|
||||
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0)
|
||||
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A1)
|
||||
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03A2)
|
||||
#define TSDB_CODE_MND_TOO_MANY_STBS TAOS_DEF_ERROR_CODE(0, 0x03A3)
|
||||
#define TSDB_CODE_MND_INVALID_STB TAOS_DEF_ERROR_CODE(0, 0x03A4)
|
||||
#define TSDB_CODE_MND_INVALID_STB_OPTION TAOS_DEF_ERROR_CODE(0, 0x03A5)
|
||||
#define TSDB_CODE_MND_INVALID_STB_ALTER_OPTION TAOS_DEF_ERROR_CODE(0, 0x03A6)
|
||||
#define TSDB_CODE_MND_STB_OPTION_UNCHNAGED TAOS_DEF_ERROR_CODE(0, 0x03A7)
|
||||
#define TSDB_CODE_MND_INVALID_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x03A8)
|
||||
#define TSDB_CODE_MND_TOO_MANY_TAGS TAOS_DEF_ERROR_CODE(0, 0x03A9)
|
||||
#define TSDB_CODE_MND_TAG_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AA)
|
||||
#define TSDB_CODE_MND_TAG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AB)
|
||||
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x03AC)
|
||||
#define TSDB_CODE_MND_COLUMN_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AD)
|
||||
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AE)
|
||||
#define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03AF)
|
||||
#define TSDB_CODE_MND_SINGLE_STB_MODE_DB TAOS_DEF_ERROR_CODE(0, 0x03B0)
|
||||
#define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03B1)
|
||||
#define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03B2)
|
||||
|
||||
// mnode-infoSchema
|
||||
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x03BA)
|
||||
// mnode-stable-part1
|
||||
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||
#define TSDB_CODE_MND_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0362)
|
||||
#define TSDB_CODE_MND_TOO_MANY_TAGS TAOS_DEF_ERROR_CODE(0, 0x0364)
|
||||
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x0365)
|
||||
#define TSDB_CODE_MND_TAG_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0369)
|
||||
#define TSDB_CODE_MND_TAG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036A)
|
||||
#define TSDB_CODE_MND_COLUMN_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x036B)
|
||||
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x036C)
|
||||
#define TSDB_CODE_MND_INVALID_STB_OPTION TAOS_DEF_ERROR_CODE(0, 0x036E)
|
||||
#define TSDB_CODE_MND_INVALID_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x036F)
|
||||
|
||||
// mnode-func
|
||||
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03C0)
|
||||
#define TSDB_CODE_MND_FUNC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03C1)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC TAOS_DEF_ERROR_CODE(0, 0x03C2)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_NAME TAOS_DEF_ERROR_CODE(0, 0x03C3)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_COMMENT TAOS_DEF_ERROR_CODE(0, 0x03C4)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_CODE TAOS_DEF_ERROR_CODE(0, 0x03C5)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x03C6)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_RETRIEVE TAOS_DEF_ERROR_CODE(0, 0x03C7)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_NAME TAOS_DEF_ERROR_CODE(0, 0x0370)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_CODE TAOS_DEF_ERROR_CODE(0, 0x0372)
|
||||
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0373)
|
||||
#define TSDB_CODE_MND_FUNC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0374)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x0375)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_COMMENT TAOS_DEF_ERROR_CODE(0, 0x0378)
|
||||
#define TSDB_CODE_MND_INVALID_FUNC_RETRIEVE TAOS_DEF_ERROR_CODE(0, 0x0379)
|
||||
|
||||
// mnode-db
|
||||
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0380)
|
||||
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
|
||||
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
|
||||
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
|
||||
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385)
|
||||
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
|
||||
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389)
|
||||
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A)
|
||||
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
|
||||
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A)
|
||||
|
||||
// mnode-node
|
||||
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0)
|
||||
#define TSDB_CODE_MND_MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A1)
|
||||
#define TSDB_CODE_MND_QNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A2)
|
||||
#define TSDB_CODE_MND_QNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A3)
|
||||
#define TSDB_CODE_MND_SNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A4)
|
||||
#define TSDB_CODE_MND_SNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A5)
|
||||
#define TSDB_CODE_MND_BNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A6)
|
||||
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A7)
|
||||
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x03A8)
|
||||
#define TSDB_CODE_MND_TOO_MANY_MNODES TAOS_DEF_ERROR_CODE(0, 0x03A9)
|
||||
|
||||
// mnode-dnode-part2
|
||||
#define TSDB_CODE_MND_TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x03B0)
|
||||
#define TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x03B1)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x03B2)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x03B3)
|
||||
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x03B4)
|
||||
#define TSDB_CODE_MND_VGROUP_UN_CHANGED TAOS_DEF_ERROR_CODE(0, 0x03B5)
|
||||
#define TSDB_CODE_MND_HAS_OFFLINE_DNODE TAOS_DEF_ERROR_CODE(0, 0x03B6)
|
||||
#define TSDB_CODE_MND_INVALID_REPLICA TAOS_DEF_ERROR_CODE(0, 0x03B7)
|
||||
|
||||
// mnode-stable-part2
|
||||
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03C0)
|
||||
#define TSDB_CODE_MND_TOO_MANY_STBS TAOS_DEF_ERROR_CODE(0, 0x03C1)
|
||||
#define TSDB_CODE_MND_INVALID_STB_ALTER_OPTION TAOS_DEF_ERROR_CODE(0, 0x03C2)
|
||||
#define TSDB_CODE_MND_STB_OPTION_UNCHNAGED TAOS_DEF_ERROR_CODE(0, 0x03C3)
|
||||
#define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03C4)
|
||||
#define TSDB_CODE_MND_SINGLE_STB_MODE_DB TAOS_DEF_ERROR_CODE(0, 0x03C5)
|
||||
#define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03C6)
|
||||
#define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03C7)
|
||||
|
||||
// mnode-trans
|
||||
#define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0)
|
||||
#define TSDB_CODE_MND_TRANS_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D1)
|
||||
#define TSDB_CODE_MND_TRANS_INVALID_STAGE TAOS_DEF_ERROR_CODE(0, 0x03D2)
|
||||
#define TSDB_CODE_MND_TRANS_CONFLICT TAOS_DEF_ERROR_CODE(0, 0x03D3)
|
||||
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03D4)
|
||||
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D5)
|
||||
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D6)
|
||||
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D4)
|
||||
#define TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL TAOS_DEF_ERROR_CODE(0, 0x03D5)
|
||||
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03DF)
|
||||
|
||||
// mnode-mq
|
||||
#define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E0)
|
||||
|
@ -299,10 +293,9 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
||||
|
||||
// dnode
|
||||
#define TSDB_CODE_NODE_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0400)
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0401)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0402)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0403)
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0408)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0409)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
|
||||
|
||||
// vnode
|
||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
||||
|
@ -315,8 +308,6 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR TAOS_DEF_ERROR_CODE(0, 0x0507)
|
||||
#define TSDB_CODE_VND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0508)
|
||||
#define TSDB_CODE_VND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0509)
|
||||
#define TSDB_CODE_VND_INVALID_CFG_FILE TAOS_DEF_ERROR_CODE(0, 0x050A)
|
||||
#define TSDB_CODE_VND_INVALID_TERM_FILE TAOS_DEF_ERROR_CODE(0, 0x050B)
|
||||
#define TSDB_CODE_VND_IS_FLOWCTRL TAOS_DEF_ERROR_CODE(0, 0x050C)
|
||||
#define TSDB_CODE_VND_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x050D)
|
||||
#define TSDB_CODE_VND_IS_UPDATING TAOS_DEF_ERROR_CODE(0, 0x050E)
|
||||
|
@ -325,44 +316,46 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
|
||||
#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513)
|
||||
#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514)
|
||||
#define TSDB_CODE_VND_TB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0515)
|
||||
#define TSDB_CODE_VND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0516)
|
||||
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0517)
|
||||
#define TSDB_CODE_VND_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0518)
|
||||
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0519)
|
||||
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x051a)
|
||||
#define TSDB_CODE_VND_TABLE_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x051b)
|
||||
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x051c)
|
||||
#define TSDB_CODE_VND_TB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0520)
|
||||
#define TSDB_CODE_VND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0521)
|
||||
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
|
||||
#define TSDB_CODE_VND_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0523)
|
||||
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
|
||||
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
|
||||
#define TSDB_CODE_VND_TABLE_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
|
||||
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
|
||||
#define TSDB_CODE_VND_INVALID_CFG_FILE TAOS_DEF_ERROR_CODE(0, 0x0528)
|
||||
#define TSDB_CODE_VND_INVALID_TERM_FILE TAOS_DEF_ERROR_CODE(0, 0x0529)
|
||||
|
||||
// tsdb
|
||||
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
|
||||
#define TSDB_CODE_TDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0601)
|
||||
#define TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0602)
|
||||
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
|
||||
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0606)
|
||||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
||||
#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0609)
|
||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x060A)
|
||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x060B)
|
||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x060C)
|
||||
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060D)
|
||||
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060E)
|
||||
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060F)
|
||||
#define TSDB_CODE_TDB_INVALID_ACTION TAOS_DEF_ERROR_CODE(0, 0x0610)
|
||||
#define TSDB_CODE_TDB_INVALID_CREATE_TB_MSG TAOS_DEF_ERROR_CODE(0, 0x0611)
|
||||
#define TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM TAOS_DEF_ERROR_CODE(0, 0x0612)
|
||||
#define TSDB_CODE_TDB_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0613)
|
||||
#define TSDB_CODE_TDB_TABLE_RECONFIGURE TAOS_DEF_ERROR_CODE(0, 0x0614)
|
||||
#define TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO TAOS_DEF_ERROR_CODE(0, 0x0615)
|
||||
#define TSDB_CODE_TDB_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0616)
|
||||
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0617)
|
||||
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||
#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061B)
|
||||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||
#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0606)
|
||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
||||
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060A)
|
||||
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060B)
|
||||
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060C)
|
||||
#define TSDB_CODE_TDB_INVALID_ACTION TAOS_DEF_ERROR_CODE(0, 0x060D)
|
||||
#define TSDB_CODE_TDB_INVALID_CREATE_TB_MSG TAOS_DEF_ERROR_CODE(0, 0x060E)
|
||||
#define TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM TAOS_DEF_ERROR_CODE(0, 0x060F)
|
||||
#define TSDB_CODE_TDB_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0610)
|
||||
#define TSDB_CODE_TDB_TABLE_RECONFIGURE TAOS_DEF_ERROR_CODE(0, 0x0611)
|
||||
#define TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO TAOS_DEF_ERROR_CODE(0, 0x0612)
|
||||
#define TSDB_CODE_TDB_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0613)
|
||||
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0614)
|
||||
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615)
|
||||
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616)
|
||||
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||
#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x061B)
|
||||
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
|
||||
|
||||
// query
|
||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||
|
@ -378,25 +371,25 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW TAOS_DEF_ERROR_CODE(0, 0x070A)
|
||||
#define TSDB_CODE_QRY_NOT_ENOUGH_BUFFER TAOS_DEF_ERROR_CODE(0, 0x070B)
|
||||
#define TSDB_CODE_QRY_INCONSISTAN TAOS_DEF_ERROR_CODE(0, 0x070C)
|
||||
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070D)
|
||||
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070E)
|
||||
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070D)
|
||||
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070E)
|
||||
#define TSDB_CODE_QRY_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x070F)
|
||||
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0710)
|
||||
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0711)
|
||||
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0712)
|
||||
#define TSDB_CODE_QRY_TASK_CTX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0713)
|
||||
#define TSDB_CODE_QRY_TASK_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x0714)
|
||||
#define TSDB_CODE_QRY_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x0715)
|
||||
#define TSDB_CODE_QRY_TASK_CANCELLING TAOS_DEF_ERROR_CODE(0, 0x0716)
|
||||
#define TSDB_CODE_QRY_TASK_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0717)
|
||||
#define TSDB_CODE_QRY_DUPLICATTED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0718)
|
||||
#define TSDB_CODE_QRY_TASK_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x0719)
|
||||
#define TSDB_CODE_QRY_JOB_FREED TAOS_DEF_ERROR_CODE(0, 0x071A)
|
||||
#define TSDB_CODE_QRY_TASK_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x071B)
|
||||
#define TSDB_CODE_QRY_JSON_IN_ERROR TAOS_DEF_ERROR_CODE(0, 0x071C)
|
||||
#define TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR TAOS_DEF_ERROR_CODE(0, 0x071D)
|
||||
#define TSDB_CODE_QRY_JSON_IN_GROUP_ERROR TAOS_DEF_ERROR_CODE(0, 0x071E)
|
||||
#define TSDB_CODE_QRY_JOB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x071F)
|
||||
#define TSDB_CODE_QRY_SCH_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0720)
|
||||
#define TSDB_CODE_QRY_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0721)
|
||||
#define TSDB_CODE_QRY_TASK_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0722)
|
||||
#define TSDB_CODE_QRY_TASK_CTX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0723)
|
||||
#define TSDB_CODE_QRY_TASK_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x0724)
|
||||
#define TSDB_CODE_QRY_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x0725)
|
||||
#define TSDB_CODE_QRY_TASK_CANCELLING TAOS_DEF_ERROR_CODE(0, 0x0726)
|
||||
#define TSDB_CODE_QRY_TASK_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0727)
|
||||
#define TSDB_CODE_QRY_DUPLICATTED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0728)
|
||||
#define TSDB_CODE_QRY_TASK_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x0729)
|
||||
#define TSDB_CODE_QRY_JOB_FREED TAOS_DEF_ERROR_CODE(0, 0x072A)
|
||||
#define TSDB_CODE_QRY_TASK_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x072B)
|
||||
#define TSDB_CODE_QRY_JSON_IN_ERROR TAOS_DEF_ERROR_CODE(0, 0x072C)
|
||||
#define TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR TAOS_DEF_ERROR_CODE(0, 0x072D)
|
||||
#define TSDB_CODE_QRY_JSON_IN_GROUP_ERROR TAOS_DEF_ERROR_CODE(0, 0x072E)
|
||||
#define TSDB_CODE_QRY_JOB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x072F)
|
||||
|
||||
// grant
|
||||
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800)
|
||||
|
@ -413,17 +406,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_GRANT_CPU_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080B)
|
||||
|
||||
// sync
|
||||
#define TSDB_CODE_SYN_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0900)
|
||||
#define TSDB_CODE_SYN_NOT_ENABLED TAOS_DEF_ERROR_CODE(0, 0x0901)
|
||||
#define TSDB_CODE_SYN_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0902)
|
||||
#define TSDB_CODE_SYN_CONFIRM_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0903)
|
||||
#define TSDB_CODE_SYN_TOO_MANY_FWDINFO TAOS_DEF_ERROR_CODE(0, 0x0904)
|
||||
#define TSDB_CODE_SYN_MISMATCHED_PROTOCOL TAOS_DEF_ERROR_CODE(0, 0x0905)
|
||||
#define TSDB_CODE_SYN_MISMATCHED_CLUSTERID TAOS_DEF_ERROR_CODE(0, 0x0906)
|
||||
#define TSDB_CODE_SYN_MISMATCHED_SIGNATURE TAOS_DEF_ERROR_CODE(0, 0x0907)
|
||||
#define TSDB_CODE_SYN_INVALID_CHECKSUM TAOS_DEF_ERROR_CODE(0, 0x0908)
|
||||
#define TSDB_CODE_SYN_INVALID_MSGLEN TAOS_DEF_ERROR_CODE(0, 0x0909)
|
||||
#define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A)
|
||||
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0903)
|
||||
#define TSDB_CODE_SYN_IS_LEADER TAOS_DEF_ERROR_CODE(0, 0x090B)
|
||||
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x090C)
|
||||
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x090D)
|
||||
|
@ -433,7 +416,6 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
|
||||
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
|
||||
#define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913)
|
||||
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0914)
|
||||
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
|
||||
|
||||
// tq
|
||||
|
@ -461,7 +443,6 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
|
||||
|
||||
// tfs
|
||||
#define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x2200)
|
||||
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
|
||||
#define TSDB_CODE_FS_TOO_MANY_MOUNT TAOS_DEF_ERROR_CODE(0, 0x2202)
|
||||
#define TSDB_CODE_FS_DUP_PRIMARY TAOS_DEF_ERROR_CODE(0, 0x2203)
|
||||
|
@ -470,9 +451,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_FS_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x2206)
|
||||
#define TSDB_CODE_FS_INVLD_LEVEL TAOS_DEF_ERROR_CODE(0, 0x2207)
|
||||
#define TSDB_CODE_FS_NO_VALID_DISK TAOS_DEF_ERROR_CODE(0, 0x2208)
|
||||
|
||||
// monitor
|
||||
#define TSDB_CODE_MON_CONNECTION_INVALID TAOS_DEF_ERROR_CODE(0, 0x2300)
|
||||
#define TSDB_CODE_FS_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x220F)
|
||||
|
||||
// catalog
|
||||
#define TSDB_CODE_CTG_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2400)
|
||||
|
@ -485,12 +464,12 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_CTG_EXIT TAOS_DEF_ERROR_CODE(0, 0x2407)
|
||||
|
||||
//scheduler&qworker
|
||||
#define TSDB_CODE_QW_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x2550)
|
||||
#define TSDB_CODE_SCH_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x2501)
|
||||
#define TSDB_CODE_SCH_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2502)
|
||||
#define TSDB_CODE_SCH_IGNORE_ERROR TAOS_DEF_ERROR_CODE(0, 0x2503)
|
||||
#define TSDB_CODE_SCH_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x2504)
|
||||
#define TSDB_CODE_SCH_JOB_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x2505)
|
||||
#define TSDB_CODE_QW_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x2550)
|
||||
|
||||
//parser
|
||||
#define TSDB_CODE_PAR_SYNTAX_ERROR TAOS_DEF_ERROR_CODE(0, 0x2600)
|
||||
|
@ -563,9 +542,9 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_PAR_INVALID_DROP_COL TAOS_DEF_ERROR_CODE(0, 0x2651)
|
||||
#define TSDB_CODE_PAR_INVALID_COL_JSON TAOS_DEF_ERROR_CODE(0, 0x2652)
|
||||
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
|
||||
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2654)
|
||||
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
|
||||
#define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656)
|
||||
|
||||
#define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657)
|
||||
#define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658)
|
||||
#define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659)
|
||||
|
@ -576,6 +555,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F)
|
||||
#define TSDB_CODE_PAR_INVALID_SMA_INDEX TAOS_DEF_ERROR_CODE(0, 0x2660)
|
||||
#define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661)
|
||||
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
|
||||
|
||||
//planner
|
||||
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
|
||||
|
@ -601,6 +581,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_UDF_INVALID_BUFSIZE TAOS_DEF_ERROR_CODE(0, 0x2909)
|
||||
#define TSDB_CODE_UDF_INVALID_OUTPUT_TYPE TAOS_DEF_ERROR_CODE(0, 0x290A)
|
||||
|
||||
// sml
|
||||
#define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000)
|
||||
#define TSDB_CODE_SML_INVALID_PRECISION_TYPE TAOS_DEF_ERROR_CODE(0, 0x3001)
|
||||
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
|
||||
|
@ -617,7 +598,6 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_TSMA_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x3106)
|
||||
#define TSDB_CODE_TSMA_NO_INDEX_IN_CACHE TAOS_DEF_ERROR_CODE(0, 0x3107)
|
||||
|
||||
|
||||
//rsma
|
||||
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
||||
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
||||
|
@ -628,7 +608,6 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
|
||||
#define TSDB_CODE_INDEX_INVALID_FILE TAOS_DEF_ERROR_CODE(0, 0x3201)
|
||||
|
||||
|
||||
//tmq
|
||||
#define TSDB_CODE_TMQ_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x4000)
|
||||
|
||||
|
|
|
@ -244,6 +244,7 @@ void *createRequest(uint64_t connId, int32_t type) {
|
|||
|
||||
STscObj *pTscObj = acquireTscObj(connId);
|
||||
if (pTscObj == NULL) {
|
||||
taosMemoryFree(pRequest);
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -834,7 +834,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
|
|||
tstrerror(code), pRequest->requestId);
|
||||
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code)) {
|
||||
if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code) && pRequest->sqlstr != NULL) {
|
||||
tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64,
|
||||
pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId);
|
||||
pRequest->prevCode = code;
|
||||
|
@ -1750,7 +1750,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
|
|||
char* pStart = p;
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
colLength[i] = htonl(colLength[i]);
|
||||
ASSERT(colLength[i] < dataLen);
|
||||
if (colLength[i] >= dataLen) {
|
||||
tscError("invalid colLength %d, dataLen %d", colLength[i], dataLen);
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) {
|
||||
pResultInfo->pCol[i].offset = (int32_t*)pStart;
|
||||
|
|
|
@ -499,7 +499,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
|
||||
code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta);
|
||||
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_INVALID_STB) {
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) {
|
||||
SSchemaAction schemaAction;
|
||||
schemaAction.action = SCHEMA_ACTION_CREATE_STABLE;
|
||||
memset(&schemaAction.createSTable, 0, sizeof(SCreateSTableActionInfo));
|
||||
|
@ -1489,7 +1489,7 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr
|
|||
}
|
||||
info->id = smlGenId();
|
||||
|
||||
info->pQuery = (SQuery *)taosMemoryCalloc(1, sizeof(SQuery));
|
||||
info->pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY);
|
||||
if (NULL == info->pQuery) {
|
||||
uError("SML:0x%" PRIx64 " create info->pQuery error", info->id);
|
||||
goto cleanup;
|
||||
|
|
|
@ -2128,7 +2128,7 @@ _err:
|
|||
return string;
|
||||
}
|
||||
|
||||
static char* buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray* tagName, int64_t id) {
|
||||
static char* buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray* tagName, int64_t id, uint8_t tagNum) {
|
||||
char* string = NULL;
|
||||
SArray* pTagVals = NULL;
|
||||
cJSON* json = cJSON_CreateObject();
|
||||
|
@ -2148,6 +2148,8 @@ static char* buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray*
|
|||
cJSON_AddItemToObject(json, "tableType", tableType);
|
||||
cJSON* using = cJSON_CreateString(sname);
|
||||
cJSON_AddItemToObject(json, "using", using);
|
||||
cJSON* tagNumJson = cJSON_CreateNumber(tagNum);
|
||||
cJSON_AddItemToObject(json, "tagNum", tagNumJson);
|
||||
// cJSON* version = cJSON_CreateNumber(1);
|
||||
// cJSON_AddItemToObject(json, "version", version);
|
||||
|
||||
|
@ -2236,7 +2238,7 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
|
|||
pCreateReq = req.pReqs + iReq;
|
||||
if (pCreateReq->type == TSDB_CHILD_TABLE) {
|
||||
string = buildCreateCTableJson((STag*)pCreateReq->ctb.pTag, pCreateReq->ctb.name, pCreateReq->name,
|
||||
pCreateReq->ctb.tagName, pCreateReq->uid);
|
||||
pCreateReq->ctb.tagName, pCreateReq->uid, pCreateReq->ctb.tagNum);
|
||||
} else if (pCreateReq->type == TSDB_NORMAL_TABLE) {
|
||||
string =
|
||||
buildCreateTableJson(&pCreateReq->ntb.schemaRow, NULL, pCreateReq->name, pCreateReq->uid, TSDB_NORMAL_TABLE);
|
||||
|
@ -2952,9 +2954,243 @@ int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data raw_meta){
|
|||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
void tmq_free_raw_meta(tmq_raw_data* rawMeta) {
|
||||
//
|
||||
taosMemoryFreeClear(rawMeta);
|
||||
typedef struct{
|
||||
SVgroupInfo vg;
|
||||
void *data;
|
||||
}VgData;
|
||||
|
||||
static void destroyVgHash(void* data) {
|
||||
VgData* vgData = (VgData*)data;
|
||||
taosMemoryFreeClear(vgData->data);
|
||||
}
|
||||
|
||||
int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){
|
||||
if (!TD_RES_TMQ(msg)) {
|
||||
uError("WriteRaw:msg is not tmq : %d", *(int8_t*)msg);
|
||||
return TSDB_CODE_TMQ_INVALID_MSG;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SHashObj *pVgHash = NULL;
|
||||
SQuery *pQuery = NULL;
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
|
||||
if(!pRequest){
|
||||
uError("WriteRaw:createRequest error request is null");
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (!pRequest->pDb) {
|
||||
uError("WriteRaw:not use db");
|
||||
code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
|
||||
goto end;
|
||||
}
|
||||
|
||||
pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
||||
taosHashSetFreeFp(pVgHash, destroyVgHash);
|
||||
struct SCatalog *pCatalog = NULL;
|
||||
code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||
if(code != TSDB_CODE_SUCCESS){
|
||||
uError("WriteRaw: get gatlog error");
|
||||
goto end;
|
||||
}
|
||||
|
||||
SRequestConnInfo conn = {0};
|
||||
conn.pTrans = pRequest->pTscObj->pAppInfo->pTransporter;
|
||||
conn.requestId = pRequest->requestId;
|
||||
conn.requestObjRefId = pRequest->self;
|
||||
conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp);
|
||||
SMqRspObj *rspObj = ((SMqRspObj*)msg);
|
||||
printf("raw data block num:%d\n", rspObj->rsp.blockNum);
|
||||
while (++rspObj->resIter < rspObj->rsp.blockNum) {
|
||||
SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj->rsp.blockData, rspObj->resIter);
|
||||
if (!rspObj->rsp.withSchema) {
|
||||
uError("WriteRaw:no schema, iter:%d", rspObj->resIter);
|
||||
goto end;
|
||||
}
|
||||
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj->rsp.blockSchema, rspObj->resIter);
|
||||
setResSchemaInfo(&rspObj->resInfo, pSW->pSchema, pSW->nCols);
|
||||
|
||||
code = setQueryResultFromRsp(&rspObj->resInfo, pRetrieve, false, false);
|
||||
if(code != TSDB_CODE_SUCCESS){
|
||||
uError("WriteRaw: setQueryResultFromRsp error");
|
||||
goto end;
|
||||
}
|
||||
|
||||
uint16_t fLen = 0;
|
||||
int32_t rowSize = 0;
|
||||
int16_t nVar = 0;
|
||||
for (int i = 0; i < pSW->nCols; i++) {
|
||||
SSchema *schema = pSW->pSchema + i;
|
||||
fLen += TYPE_BYTES[schema->type];
|
||||
rowSize += schema->bytes;
|
||||
if(IS_VAR_DATA_TYPE(schema->type)){
|
||||
nVar ++;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t rows = rspObj->resInfo.numOfRows;
|
||||
int32_t extendedRowSize = rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + nVar * sizeof(VarDataOffsetT) +
|
||||
(int32_t)TD_BITMAP_BYTES(pSW->nCols - 1);
|
||||
int32_t schemaLen = 0;
|
||||
int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize;
|
||||
|
||||
const char* tbName = tmq_get_table_name(msg);
|
||||
if(!tbName){
|
||||
uError("WriteRaw: tbname is null");
|
||||
code = TSDB_CODE_TMQ_INVALID_MSG;
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("raw data tbname:%s\n", tbName);
|
||||
SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}};
|
||||
strcpy(pName.dbname, pRequest->pDb);
|
||||
strcpy(pName.tname, tbName);
|
||||
|
||||
VgData vgData = {0};
|
||||
code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &(vgData.vg));
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("WriteRaw:catalogGetTableHashVgroup failed. table name: %s", tbName);
|
||||
goto end;
|
||||
}
|
||||
|
||||
SSubmitReq* subReq = NULL;
|
||||
SSubmitBlk* blk = NULL;
|
||||
void *hData = taosHashGet(pVgHash, &vgData.vg.vgId, sizeof(vgData.vg.vgId));
|
||||
if(hData){
|
||||
vgData = *(VgData*)hData;
|
||||
|
||||
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
|
||||
void *tmp = taosMemoryRealloc(vgData.data, totalLen);
|
||||
if (tmp == NULL) {
|
||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
vgData.data = tmp;
|
||||
((VgData*)hData)->data = tmp;
|
||||
subReq = (SSubmitReq*)(vgData.data);
|
||||
blk = POINTER_SHIFT(vgData.data, subReq->length);
|
||||
}else{
|
||||
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
|
||||
void *tmp = taosMemoryCalloc(1, totalLen);
|
||||
if (tmp == NULL) {
|
||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
vgData.data = tmp;
|
||||
taosHashPut(pVgHash, (const char *)&vgData.vg.vgId, sizeof(vgData.vg.vgId), (char *)&vgData, sizeof(vgData));
|
||||
subReq = (SSubmitReq*)(vgData.data);
|
||||
subReq->length = sizeof(SSubmitReq);
|
||||
subReq->numOfBlocks = 0;
|
||||
|
||||
blk = POINTER_SHIFT(vgData.data, sizeof(SSubmitReq));
|
||||
}
|
||||
|
||||
STableMeta* pTableMeta = NULL;
|
||||
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("WriteRaw:catalogGetTableMeta failed. table name: %s", tbName);
|
||||
goto end;
|
||||
}
|
||||
uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid);
|
||||
uint64_t uid = pTableMeta->uid;
|
||||
taosMemoryFreeClear(pTableMeta);
|
||||
|
||||
void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
|
||||
STSRow* rowData = POINTER_SHIFT(blkSchema, schemaLen);
|
||||
|
||||
SRowBuilder rb = {0};
|
||||
tdSRowInit(&rb, pSW->version);
|
||||
tdSRowSetTpInfo(&rb, pSW->nCols, fLen);
|
||||
int32_t dataLen = 0;
|
||||
|
||||
for (int32_t j = 0; j < rows; j++) {
|
||||
tdSRowResetBuf(&rb, rowData);
|
||||
|
||||
doSetOneRowPtr(&rspObj->resInfo);
|
||||
rspObj->resInfo.current += 1;
|
||||
|
||||
int32_t offset = 0;
|
||||
for (int32_t k = 0; k < pSW->nCols; k++) {
|
||||
const SSchema* pColumn = &pSW->pSchema[k];
|
||||
char *data = rspObj->resInfo.row[k];
|
||||
if (!data) {
|
||||
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, offset, k);
|
||||
} else {
|
||||
if(IS_VAR_DATA_TYPE(pColumn->type)){
|
||||
data -= VARSTR_HEADER_SIZE;
|
||||
}
|
||||
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, offset, k);
|
||||
}
|
||||
offset += TYPE_BYTES[pColumn->type];
|
||||
}
|
||||
int32_t rowLen = TD_ROW_LEN(rowData);
|
||||
rowData = POINTER_SHIFT(rowData, rowLen);
|
||||
dataLen += rowLen;
|
||||
}
|
||||
|
||||
blk->uid = htobe64(uid);
|
||||
blk->suid = htobe64(suid);
|
||||
blk->padding = htonl(blk->padding);
|
||||
blk->sversion = htonl(pSW->version);
|
||||
blk->schemaLen = htonl(schemaLen);
|
||||
blk->numOfRows = htons(rows);
|
||||
blk->dataLen = htonl(dataLen);
|
||||
subReq->length += sizeof(SSubmitBlk) + schemaLen + dataLen;
|
||||
subReq->numOfBlocks++;
|
||||
}
|
||||
|
||||
pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY);
|
||||
if (NULL == pQuery) {
|
||||
uError("create SQuery error");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE;
|
||||
pQuery->haveResultSet = false;
|
||||
pQuery->msgType = TDMT_VND_SUBMIT;
|
||||
pQuery->pRoot = (SNode *)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
|
||||
if (NULL == pQuery->pRoot) {
|
||||
uError("create pQuery->pRoot error");
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
SVnodeModifOpStmt *nodeStmt = (SVnodeModifOpStmt *)(pQuery->pRoot);
|
||||
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
|
||||
|
||||
int32_t numOfVg = taosHashGetSize(pVgHash);
|
||||
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
|
||||
|
||||
VgData *vData = (VgData *)taosHashIterate(pVgHash, NULL);
|
||||
while (vData) {
|
||||
SVgDataBlocks *dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == dst) {
|
||||
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
dst->vg = vData->vg;
|
||||
SSubmitReq* subReq = (SSubmitReq*)(vData->data);
|
||||
dst->numOfTables = subReq->numOfBlocks;
|
||||
dst->size = subReq->length;
|
||||
dst->pData = (char*)subReq;
|
||||
vData->data = NULL; // no need free
|
||||
subReq->header.vgId = htonl(dst->vg.vgId);
|
||||
subReq->version = htonl(1);
|
||||
subReq->header.contLen = htonl(subReq->length);
|
||||
subReq->length = htonl(subReq->length);
|
||||
subReq->numOfBlocks = htonl(subReq->numOfBlocks);
|
||||
taosArrayPush(nodeStmt->pDataBlocks, &dst);
|
||||
vData = (VgData *)taosHashIterate(pVgHash, vData);
|
||||
}
|
||||
|
||||
launchQueryImpl(pRequest, pQuery, true, NULL);
|
||||
code = pRequest->code;
|
||||
end:
|
||||
qDestroyQuery(pQuery);
|
||||
destroyRequest(pRequest);
|
||||
taosHashCleanup(pVgHash);
|
||||
return code;
|
||||
}
|
||||
|
||||
void tmq_commit_async(tmq_t* tmq, const TAOS_RES* msg, tmq_commit_cb* cb, void* param) {
|
||||
|
|
|
@ -8,7 +8,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
|||
ADD_EXECUTABLE(clientTest clientTests.cpp)
|
||||
TARGET_LINK_LIBRARIES(
|
||||
clientTest
|
||||
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom
|
||||
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom executor
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(tmqTest tmqTest.cpp)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
|
||||
#include "taos.h"
|
||||
#include "executor.h"
|
||||
|
||||
namespace {
|
||||
void showDB(TAOS* pConn) {
|
||||
|
@ -823,6 +824,17 @@ TEST(testCase, async_api_test) {
|
|||
|
||||
|
||||
TEST(testCase, update_test) {
|
||||
|
||||
SInterval interval = {0};
|
||||
interval.offset = 8000;
|
||||
interval.interval = 10000;
|
||||
interval.sliding = 4000;
|
||||
interval.intervalUnit = 's';
|
||||
interval.offsetUnit = 's';
|
||||
interval.slidingUnit = 's';
|
||||
// STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1630000000000);
|
||||
STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1629999999999);
|
||||
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ static const SSysDbTableSchema userTagsSchema[] = {
|
|||
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "stable_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "tag_name", .bytes = TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "tag_type", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
|
||||
{.name = "tag_type", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
{.name = "tag_value", .bytes = TSDB_MAX_TAGS_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
|
||||
};
|
||||
|
||||
|
|
|
@ -214,8 +214,8 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
|
|||
}
|
||||
}
|
||||
|
||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, uint32_t* capacity,
|
||||
const SColumnInfoData* pSource, uint32_t numOfRow2) {
|
||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
||||
const SColumnInfoData* pSource, int32_t numOfRow2) {
|
||||
ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type);
|
||||
if (numOfRow2 == 0) {
|
||||
return numOfRow1;
|
||||
|
@ -263,7 +263,8 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, ui
|
|||
pColumnInfoData->varmeta.length = len + oldLen;
|
||||
} else {
|
||||
if (finalNumOfRows > *capacity || (numOfRow1 == 0 && pColumnInfoData->info.bytes != 0)) {
|
||||
ASSERT(finalNumOfRows * pColumnInfoData->info.bytes);
|
||||
// all data may be null, when the pColumnInfoData->info.type == 0, bytes == 0;
|
||||
// ASSERT(finalNumOfRows * pColumnInfoData->info.bytes);
|
||||
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_VND_OUT_OF_MEMORY;
|
||||
|
|
|
@ -213,10 +213,6 @@ static int32_t taosSetTfsCfg(SConfig *pCfg) {
|
|||
memcpy(&tsDiskCfg[index], pCfg, sizeof(SDiskCfg));
|
||||
if (pCfg->level == 0 && pCfg->primary == 1) {
|
||||
tstrncpy(tsDataDir, pCfg->dir, PATH_MAX);
|
||||
if (taosMulMkDir(tsDataDir) != 0) {
|
||||
uError("failed to create dataDir:%s since %s", tsDataDir, terrstr());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (taosMulMkDir(pCfg->dir) != 0) {
|
||||
uError("failed to create tfsDir:%s since %s", tsDataDir, terrstr());
|
||||
|
@ -227,12 +223,13 @@ static int32_t taosSetTfsCfg(SConfig *pCfg) {
|
|||
|
||||
if (tsDataDir[0] == 0) {
|
||||
if (pItem->str != NULL) {
|
||||
taosAddDataDir(0, pItem->str, 0, 1);
|
||||
taosAddDataDir(tsDiskCfgNum, pItem->str, 0, 1);
|
||||
tstrncpy(tsDataDir, pItem->str, PATH_MAX);
|
||||
if (taosMulMkDir(tsDataDir) != 0) {
|
||||
uError("failed to create dataDir:%s since %s", tsDataDir, terrstr());
|
||||
uError("failed to create tfsDir:%s since %s", tsDataDir, terrstr());
|
||||
return -1;
|
||||
}
|
||||
tsDiskCfgNum++;
|
||||
} else {
|
||||
uError("datadir not set");
|
||||
return -1;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "tgrant.h"
|
||||
|
||||
#ifndef _GRANT
|
||||
|
||||
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
|
||||
|
||||
#endif
|
|
@ -4981,6 +4981,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
|
|||
|
||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||
if (tEncodeCStr(pCoder, pReq->ctb.name) < 0) return -1;
|
||||
if (tEncodeU8(pCoder, pReq->ctb.tagNum) < 0) return -1;
|
||||
if (tEncodeI64(pCoder, pReq->ctb.suid) < 0) return -1;
|
||||
if (tEncodeTag(pCoder, (const STag *)pReq->ctb.pTag) < 0) return -1;
|
||||
int32_t len = taosArrayGetSize(pReq->ctb.tagName);
|
||||
|
@ -5017,6 +5018,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
|
|||
|
||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||
if (tDecodeCStr(pCoder, &pReq->ctb.name) < 0) return -1;
|
||||
if (tDecodeU8(pCoder, &pReq->ctb.tagNum) < 0) return -1;
|
||||
if (tDecodeI64(pCoder, &pReq->ctb.suid) < 0) return -1;
|
||||
if (tDecodeTag(pCoder, (STag **)&pReq->ctb.pTag) < 0) return -1;
|
||||
int32_t len = 0;
|
||||
|
|
|
@ -815,20 +815,17 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
|
|||
|
||||
if (pInterval->offset > 0) {
|
||||
start = taosTimeAdd(start, pInterval->offset, pInterval->offsetUnit, precision);
|
||||
if (start > t) {
|
||||
start = taosTimeAdd(start, -pInterval->interval, pInterval->intervalUnit, precision);
|
||||
} else {
|
||||
// try to move current window to the left-hande-side, due to the offset effect.
|
||||
int64_t end = taosTimeAdd(start, pInterval->interval, pInterval->intervalUnit, precision) - 1;
|
||||
|
||||
int64_t newEnd = end;
|
||||
while(newEnd >= t) {
|
||||
end = newEnd;
|
||||
newEnd = taosTimeAdd(newEnd, -pInterval->sliding, pInterval->slidingUnit, precision);
|
||||
}
|
||||
// try to move current window to the left-hande-side, due to the offset effect.
|
||||
int64_t end = taosTimeAdd(start, pInterval->interval, pInterval->intervalUnit, precision) - 1;
|
||||
|
||||
start = taosTimeAdd(end, -pInterval->interval, pInterval->intervalUnit, precision) + 1;
|
||||
int64_t newEnd = end;
|
||||
while (newEnd >= t) {
|
||||
end = newEnd;
|
||||
newEnd = taosTimeAdd(newEnd, -pInterval->sliding, pInterval->slidingUnit, precision);
|
||||
}
|
||||
|
||||
start = taosTimeAdd(end, -pInterval->interval, pInterval->intervalUnit, precision) + 1;
|
||||
}
|
||||
|
||||
return start;
|
||||
|
|
|
@ -190,6 +190,10 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
|||
int32_t code = -1;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
if ((terrno = grantCheck(TSDB_GRANT_USER)) < 0) {
|
||||
return code;
|
||||
}
|
||||
|
||||
SFuncObj func = {0};
|
||||
memcpy(func.name, pCreate->name, TSDB_FUNC_NAME_LEN);
|
||||
func.createdTime = taosGetTimestampMs();
|
||||
|
|
|
@ -128,7 +128,6 @@ int32_t mndInitGrant(SMnode *pMnode) {
|
|||
|
||||
void mndCleanupGrant() {}
|
||||
void grantParseParameter() { mError("can't parsed parameter k"); }
|
||||
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
|
||||
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {}
|
||||
void grantAdd(EGrantType grant, uint64_t value) {}
|
||||
void grantRestore(EGrantType grant, uint64_t value) {}
|
||||
|
|
|
@ -66,7 +66,7 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
|
|||
|
||||
int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) {
|
||||
if (NULL == pMnode->infosMeta) {
|
||||
terrno = TSDB_CODE_MND_NOT_READY;
|
||||
terrno = TSDB_CODE_APP_NOT_READY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
|
|||
|
||||
int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
||||
if (NULL == pMnode->infosMeta) {
|
||||
terrno = TSDB_CODE_MND_NOT_READY;
|
||||
terrno = TSDB_CODE_APP_NOT_READY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
|
|||
|
||||
int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp) {
|
||||
if (NULL == pMnode->perfsMeta) {
|
||||
terrno = TSDB_CODE_MND_NOT_READY;
|
||||
terrno = TSDB_CODE_APP_NOT_READY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char
|
|||
|
||||
int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp) {
|
||||
if (NULL == pMnode->perfsMeta) {
|
||||
terrno = TSDB_CODE_MND_NOT_READY;
|
||||
terrno = TSDB_CODE_APP_NOT_READY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ static int32_t mndSaveQueryList(SConnObj *pConn, SQueryHbReqBasic *pBasic) {
|
|||
pConn->numOfQueries = pBasic->queryDesc ? taosArrayGetSize(pBasic->queryDesc) : 0;
|
||||
pBasic->queryDesc = NULL;
|
||||
|
||||
mDebug("queries updated in conn %d, num:%d", pConn->id, pConn->numOfQueries);
|
||||
mDebug("queries updated in conn %u, num:%d", pConn->id, pConn->numOfQueries);
|
||||
|
||||
taosWUnLockLatch(&pConn->queryLock);
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "wal.h"
|
||||
|
||||
#include "tcommon.h"
|
||||
#include "tgrant.h"
|
||||
#include "tfs.h"
|
||||
#include "tgrant.h"
|
||||
#include "tmsg.h"
|
||||
#include "trow.h"
|
||||
|
||||
|
@ -89,6 +89,7 @@ void metaReaderClear(SMetaReader *pReader);
|
|||
int32_t metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid);
|
||||
int32_t metaReadNext(SMetaReader *pReader);
|
||||
const void *metaGetTableTagVal(SMetaEntry *pEntry, int16_t type, STagVal *tagVal);
|
||||
int metaGetTableNameByUid(void* meta, uint64_t uid, char* tbName);
|
||||
|
||||
typedef struct SMetaFltParam {
|
||||
tb_uid_t suid;
|
||||
|
@ -100,7 +101,7 @@ typedef struct SMetaFltParam {
|
|||
|
||||
} SMetaFltParam;
|
||||
|
||||
int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *results);
|
||||
int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *results);
|
||||
|
||||
#if 1 // refact APIs below (TODO)
|
||||
typedef SVCreateTbReq STbCfg;
|
||||
|
@ -117,11 +118,10 @@ int32_t metaTbCursorNext(SMTbCursor *pTbCur);
|
|||
// typedef struct STsdb STsdb;
|
||||
typedef struct STsdbReader STsdbReader;
|
||||
|
||||
#define BLOCK_LOAD_OFFSET_ORDER 1
|
||||
#define BLOCK_LOAD_TABLESEQ_ORDER 2
|
||||
#define BLOCK_LOAD_EXTERN_ORDER 3
|
||||
#define TIMEWINDOW_RANGE_CONTAINED 1
|
||||
#define TIMEWINDOW_RANGE_EXTERNAL 2
|
||||
|
||||
#define LASTROW_RETRIEVE_TYPE_ALL 0x1
|
||||
#define LASTROW_RETRIEVE_TYPE_ALL 0x1
|
||||
#define LASTROW_RETRIEVE_TYPE_SINGLE 0x2
|
||||
|
||||
int32_t tsdbSetTableId(STsdbReader *pReader, int64_t uid);
|
||||
|
@ -237,8 +237,8 @@ typedef struct {
|
|||
uint64_t groupId;
|
||||
} STableKeyInfo;
|
||||
|
||||
#define TABLE_ROLLUP_ON ((int8_t)0x1)
|
||||
#define TABLE_IS_ROLLUP(FLG) (((FLG) & (TABLE_ROLLUP_ON)) != 0)
|
||||
#define TABLE_ROLLUP_ON ((int8_t)0x1)
|
||||
#define TABLE_IS_ROLLUP(FLG) (((FLG) & (TABLE_ROLLUP_ON)) != 0)
|
||||
#define TABLE_SET_ROLLUP(FLG) ((FLG) |= TABLE_ROLLUP_ON)
|
||||
struct SMetaEntry {
|
||||
int64_t version;
|
||||
|
|
|
@ -98,6 +98,17 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name) {
|
|||
return uid;
|
||||
}
|
||||
|
||||
int metaGetTableNameByUid(void* meta, uint64_t uid, char* tbName) {
|
||||
SMetaReader mr = {0};
|
||||
metaReaderInit(&mr, (SMeta*)meta, 0);
|
||||
metaGetTableEntryByUid(&mr, uid);
|
||||
|
||||
STR_TO_VARSTR(tbName, mr.me.name);
|
||||
metaReaderClear(&mr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int metaReadNext(SMetaReader *pReader) {
|
||||
SMeta *pMeta = pReader->pMeta;
|
||||
|
||||
|
@ -754,12 +765,14 @@ typedef struct {
|
|||
int32_t vLen;
|
||||
} SIdxCursor;
|
||||
|
||||
int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
SIdxCursor *pCursor = NULL;
|
||||
char *buf = NULL;
|
||||
int32_t maxSize = 0;
|
||||
int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
int32_t ret = 0;
|
||||
char *buf = NULL;
|
||||
|
||||
int32_t ret = 0, valid = 0;
|
||||
STagIdxKey *pKey = NULL;
|
||||
int32_t nKey = 0;
|
||||
|
||||
SIdxCursor *pCursor = NULL;
|
||||
pCursor = (SIdxCursor *)taosMemoryCalloc(1, sizeof(SIdxCursor));
|
||||
pCursor->pMeta = pMeta;
|
||||
pCursor->suid = param->suid;
|
||||
|
@ -771,9 +784,8 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
|||
if (ret < 0) {
|
||||
goto END;
|
||||
}
|
||||
STagIdxKey *pKey = NULL;
|
||||
int32_t nKey = 0;
|
||||
|
||||
int32_t maxSize = 0;
|
||||
int32_t nTagData = 0;
|
||||
void *tagData = NULL;
|
||||
|
||||
|
@ -811,10 +823,12 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
|||
goto END;
|
||||
}
|
||||
|
||||
void *entryKey = NULL, *entryVal = NULL;
|
||||
int32_t nEntryKey, nEntryVal;
|
||||
bool first = true;
|
||||
int32_t valid = 0;
|
||||
while (1) {
|
||||
void *entryKey = NULL, *entryVal = NULL;
|
||||
int32_t nEntryKey, nEntryVal;
|
||||
|
||||
valid = tdbTbcGet(pCursor->pCur, (const void **)&entryKey, &nEntryKey, (const void **)&entryVal, &nEntryVal);
|
||||
if (valid < 0) {
|
||||
break;
|
||||
|
@ -853,10 +867,12 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
END:
|
||||
if (pCursor->pMeta) metaULock(pCursor->pMeta);
|
||||
if (pCursor->pCur) tdbTbcClose(pCursor->pCur);
|
||||
taosMemoryFree(buf);
|
||||
taosMemoryFree(pKey);
|
||||
|
||||
taosMemoryFree(pCursor);
|
||||
|
||||
|
|
|
@ -358,6 +358,14 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
|
|||
goto _err;
|
||||
}
|
||||
|
||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||
tb_uid_t suid = metaGetTableEntryUidByName(pMeta, pReq->ctb.name);
|
||||
if (suid != pReq->ctb.suid) {
|
||||
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// validate req
|
||||
metaReaderInit(&mr, pMeta, 0);
|
||||
if (metaGetTableEntryByName(&mr, pReq->name) == 0) {
|
||||
|
@ -371,13 +379,6 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
|
|||
}
|
||||
metaReaderClear(&mr);
|
||||
|
||||
if (pReq->type == TSDB_CHILD_TABLE) {
|
||||
tb_uid_t suid = metaGetTableEntryUidByName(pMeta, pReq->ctb.name);
|
||||
if (suid == 0) {
|
||||
terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// build SMetaEntry
|
||||
me.version = version;
|
||||
me.type = pReq->type;
|
||||
|
@ -442,7 +443,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
|||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
if (taosArrayGetSize(tbUids) == 0){
|
||||
if (taosArrayGetSize(tbUids) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -811,6 +812,9 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
for (int32_t i = 0; i < pTagSchema->nCols; i++) {
|
||||
SSchema *pCol = &pTagSchema->pSchema[i];
|
||||
if (iCol == i) {
|
||||
if (pAlterTbReq->isNull) {
|
||||
continue;
|
||||
}
|
||||
STagVal val = {0};
|
||||
val.type = pCol->type;
|
||||
val.cid = pCol->colId;
|
||||
|
|
|
@ -138,6 +138,14 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con
|
|||
ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0);
|
||||
}
|
||||
|
||||
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
|
||||
if (pRsp->blockNum > 0) {
|
||||
ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);
|
||||
} else {
|
||||
ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t len;
|
||||
int32_t code;
|
||||
tEncodeSize(tEncodeSMqDataRsp, pRsp, len, code);
|
||||
|
|
|
@ -65,12 +65,14 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVa
|
|||
qTaskInfo_t task = pExec->execCol.task;
|
||||
|
||||
if (qStreamPrepareScan(task, pOffset) < 0) {
|
||||
tqDebug("prepare scan failed, return");
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return 0;
|
||||
} else {
|
||||
tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
|
||||
if (qStreamPrepareScan(task, pOffset) < 0) {
|
||||
tqDebug("prepare scan failed, return");
|
||||
pRsp->rspOffset = *pOffset;
|
||||
return 0;
|
||||
}
|
||||
|
@ -126,9 +128,16 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVa
|
|||
|
||||
ASSERT(pRsp->rspOffset.type != 0);
|
||||
|
||||
#if 0
|
||||
if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
|
||||
ASSERT(pRsp->rspOffset.version + 1 >= pRsp->reqOffset.version);
|
||||
if (pRsp->blockNum > 0) {
|
||||
ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);
|
||||
} else {
|
||||
ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tqDebug("task exec exited");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,16 +43,12 @@ static int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int tqExecKeyCompare(const void* pKey1, int32_t kLen1, const void* pKey2, int32_t kLen2) {
|
||||
return strcmp(pKey1, pKey2);
|
||||
}
|
||||
|
||||
int32_t tqMetaOpen(STQ* pTq) {
|
||||
if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaStore) < 0) {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if (tdbTbOpen("handles", -1, -1, tqExecKeyCompare, pTq->pMetaStore, &pTq->pExecStore) < 0) {
|
||||
if (tdbTbOpen("handles", -1, -1, 0, pTq->pMetaStore, &pTq->pExecStore) < 0) {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
|
@ -67,10 +63,10 @@ int32_t tqMetaOpen(STQ* pTq) {
|
|||
ASSERT(0);
|
||||
}
|
||||
|
||||
void* pKey;
|
||||
int kLen;
|
||||
void* pVal;
|
||||
int vLen;
|
||||
void* pKey = NULL;
|
||||
int kLen = 0;
|
||||
void* pVal = NULL;
|
||||
int vLen = 0;
|
||||
|
||||
tdbTbcMoveToFirst(pCur);
|
||||
SDecoder decoder;
|
||||
|
@ -101,7 +97,7 @@ int32_t tqMetaOpen(STQ* pTq) {
|
|||
handle.execHandle.execDb.pFilterOutTbUid =
|
||||
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
}
|
||||
tqDebug("tq restore %s consumer %ld", handle.subKey, handle.consumerId);
|
||||
tqDebug("tq restore %s consumer %ld vgId:%d", handle.subKey, handle.consumerId, TD_VID(pTq->pVnode));
|
||||
taosHashPut(pTq->handles, pKey, kLen, &handle, sizeof(STqHandle));
|
||||
}
|
||||
|
||||
|
@ -126,6 +122,9 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
|
|||
tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code);
|
||||
ASSERT(code == 0);
|
||||
|
||||
tqDebug("tq save %s(%d) consumer %ld vgId:%d", pHandle->subKey, strlen(pHandle->subKey), pHandle->consumerId,
|
||||
TD_VID(pTq->pVnode));
|
||||
|
||||
void* buf = taosMemoryCalloc(1, vlen);
|
||||
if (buf == NULL) {
|
||||
ASSERT(0);
|
||||
|
|
|
@ -132,10 +132,12 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
|
|||
while (1) {
|
||||
if (!fromProcessedMsg) {
|
||||
if (walNextValidMsg(pReader->pWalReader) < 0) {
|
||||
pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curInvalid;
|
||||
pReader->ver =
|
||||
pReader->pWalReader->curVersion - (pReader->pWalReader->curInvalid | pReader->pWalReader->curStopped);
|
||||
ret->offset.type = TMQ_OFFSET__LOG;
|
||||
ret->offset.version = pReader->ver;
|
||||
ret->fetchType = FETCH_TYPE__NONE;
|
||||
tqDebug("return offset %ld, no more valid", ret->offset.version);
|
||||
ASSERT(ret->offset.version >= 0);
|
||||
return -1;
|
||||
}
|
||||
|
@ -167,6 +169,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
|
|||
ret->offset.version = pReader->ver;
|
||||
ASSERT(pReader->ver >= 0);
|
||||
ret->fetchType = FETCH_TYPE__NONE;
|
||||
tqDebug("return offset %ld, processed finish", ret->offset.version);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -477,6 +477,11 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
|
|||
for (int32_t iReq = 0; iReq < req.nReqs; iReq++) {
|
||||
pCreateReq = req.pReqs + iReq;
|
||||
|
||||
if ((terrno = grantCheck(TSDB_GRANT_TIMESERIES)) < 0) {
|
||||
rcode = -1;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
// validate hash
|
||||
sprintf(tbName, "%s.%s", pVnode->config.dbname, pCreateReq->name);
|
||||
if (vnodeValidateTableHash(pVnode, tbName) < 0) {
|
||||
|
@ -821,6 +826,13 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
|
|||
goto _exit;
|
||||
}
|
||||
|
||||
if ((terrno = grantCheck(TSDB_GRANT_TIMESERIES)) < 0) {
|
||||
pRsp->code = terrno;
|
||||
tDecoderClear(&decoder);
|
||||
taosArrayDestroy(createTbReq.ctb.tagName);
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
|
||||
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
||||
submitBlkRsp.code = terrno;
|
||||
|
|
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
//newline area
|
||||
#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s"
|
||||
#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s"
|
||||
#define EXPLAIN_TBL_MERGE_SCAN_FORMAT "Table Merge Scan on %s"
|
||||
#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s"
|
||||
#define EXPLAIN_DISTBLK_SCAN_FORMAT "Block Dist Scan on %s"
|
||||
#define EXPLAIN_LASTROW_SCAN_FORMAT "Last Row Scan on %s"
|
||||
|
|
|
@ -433,7 +433,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
|||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN:
|
||||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: {
|
||||
STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode;
|
||||
EXPLAIN_ROW_NEW(level, EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname);
|
||||
EXPLAIN_ROW_NEW(level,
|
||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == pNode->type ? EXPLAIN_TBL_MERGE_SCAN_FORMAT : EXPLAIN_TBL_SCAN_FORMAT,
|
||||
pTblScanNode->scan.tableName.tname);
|
||||
EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT);
|
||||
if (pResNode->pExecInfo) {
|
||||
QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen));
|
||||
|
|
|
@ -82,8 +82,6 @@ size_t getResultRowSize(struct SqlFunctionCtx* pCtx, int32_t numOfOutput);
|
|||
void initResultRowInfo(SResultRowInfo* pResultRowInfo);
|
||||
void cleanupResultRowInfo(SResultRowInfo* pResultRowInfo);
|
||||
|
||||
void closeAllResultRows(SResultRowInfo* pResultRowInfo);
|
||||
|
||||
void initResultRow(SResultRow* pResultRow);
|
||||
void closeResultRow(SResultRow* pResultRow);
|
||||
bool isResultRowClosed(SResultRow* pResultRow);
|
||||
|
@ -96,6 +94,11 @@ static FORCE_INLINE SResultRow* getResultRowByPos(SDiskbasedBuf* pBuf, SResultRo
|
|||
return pRow;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void setResultBufPageDirty(SDiskbasedBuf* pBuf, SResultRowPosition* pos) {
|
||||
void* pPage = getBufPage(pBuf, pos->pageId);
|
||||
setBufPageDirty(pPage, true);
|
||||
}
|
||||
|
||||
void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int32_t order);
|
||||
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo);
|
||||
|
||||
|
@ -108,6 +111,9 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode);
|
|||
|
||||
EDealRes doTranslateTagExpr(SNode** pNode, void* pContext);
|
||||
int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond, STableListInfo* pListInfo);
|
||||
int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId);
|
||||
size_t getTableTagsBufLen(const SNodeList* pGroups);
|
||||
|
||||
SArray* createSortInfo(SNodeList* pNodeList);
|
||||
SArray* extractPartitionColInfo(SNodeList* pNodeList);
|
||||
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols,
|
||||
|
@ -129,6 +135,6 @@ int32_t convertFillType(int32_t mode);
|
|||
|
||||
int32_t resultrowComparAsc(const void* p1, const void* p2);
|
||||
|
||||
int32_t isTableOk(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, bool* pQualified);
|
||||
int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, bool* pQualified);
|
||||
|
||||
#endif // TDENGINE_QUERYUTIL_H
|
||||
|
|
|
@ -108,7 +108,6 @@ typedef struct STaskCostInfo {
|
|||
SFileBlockLoadRecorder* pRecoder;
|
||||
uint64_t elapsedTime;
|
||||
|
||||
uint64_t firstStageMergeTime;
|
||||
uint64_t winInfoSize;
|
||||
uint64_t tableInfoSize;
|
||||
uint64_t hashSize;
|
||||
|
@ -422,6 +421,7 @@ typedef struct SStreamScanInfo {
|
|||
// status for tmq
|
||||
// SSchemaWrapper schema;
|
||||
STqOffset offset;
|
||||
SNodeList* pGroupTags;
|
||||
SNode* pTagCond;
|
||||
SNode* pTagIndexCond;
|
||||
} SStreamScanInfo;
|
||||
|
@ -544,9 +544,11 @@ typedef struct SProjectOperatorInfo {
|
|||
SOptrBasicInfo binfo;
|
||||
SAggSupporter aggSup;
|
||||
SNode* pFilterNode; // filter info, which is push down by optimizer
|
||||
SSDataBlock* existDataBlock;
|
||||
SArray* pPseudoColInfo;
|
||||
SLimitInfo limitInfo;
|
||||
bool mergeDataBlocks;
|
||||
SSDataBlock* pFinalRes;
|
||||
SNode* pCondition;
|
||||
} SProjectOperatorInfo;
|
||||
|
||||
typedef struct SIndefOperatorInfo {
|
||||
|
@ -803,7 +805,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t *order, int32_t* scan
|
|||
int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz);
|
||||
|
||||
void doSetOperatorCompleted(SOperatorInfo* pOperator);
|
||||
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock);
|
||||
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo);
|
||||
int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr,
|
||||
SSDataBlock* pBlock, const char* idStr);
|
||||
|
||||
|
@ -867,7 +869,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SReadHandle* re
|
|||
SExecTaskInfo* pTaskInfo);
|
||||
|
||||
SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond,
|
||||
STimeWindowAggSupp* pTwAggSup, SExecTaskInfo* pTaskInfo);
|
||||
SExecTaskInfo* pTaskInfo);
|
||||
|
||||
SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFillNode, SExecTaskInfo* pTaskInfo);
|
||||
|
||||
|
@ -877,8 +879,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInf
|
|||
|
||||
SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo);
|
||||
|
||||
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, /*SExprInfo* pExprInfo, int32_t numOfCols,
|
||||
SSDataBlock* pResultBlock, const SNodeListNode* pValNode, */SExecTaskInfo* pTaskInfo);
|
||||
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo);
|
||||
|
||||
SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SJoinPhysiNode* pJoinNode,
|
||||
SExecTaskInfo* pTaskInfo);
|
||||
|
|
|
@ -43,10 +43,6 @@ void cleanupResultRowInfo(SResultRowInfo* pResultRowInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
void closeAllResultRows(SResultRowInfo* pResultRowInfo) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
bool isResultRowClosed(SResultRow* pRow) { return (pRow->closed == true); }
|
||||
|
||||
void closeResultRow(SResultRow* pResultRow) { pResultRow->closed = true; }
|
||||
|
@ -160,11 +156,13 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
|
|||
|
||||
SArray* createSortInfo(SNodeList* pNodeList) {
|
||||
size_t numOfCols = 0;
|
||||
|
||||
if (pNodeList != NULL) {
|
||||
numOfCols = LIST_LENGTH(pNodeList);
|
||||
} else {
|
||||
numOfCols = 0;
|
||||
}
|
||||
|
||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SBlockOrderInfo));
|
||||
if (pList == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -196,10 +194,6 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) {
|
|||
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i);
|
||||
/*if (!pDescNode->output) { // todo disable it temporarily*/
|
||||
/*continue;*/
|
||||
/*}*/
|
||||
|
||||
SColumnInfoData idata =
|
||||
createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId);
|
||||
idata.info.scale = pDescNode->dataType.scale;
|
||||
|
@ -265,7 +259,7 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
|||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
int32_t isTableOk(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, bool* pQualified) {
|
||||
int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, bool* pQualified) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SMetaReader mr = {0};
|
||||
|
||||
|
@ -356,7 +350,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
|
|||
STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i);
|
||||
|
||||
bool qualified = true;
|
||||
code = isTableOk(info, pTagCond, metaHandle, &qualified);
|
||||
code = isQualifiedTable(info, pTagCond, metaHandle, &qualified);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
@ -379,6 +373,82 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
|
|||
return code;
|
||||
}
|
||||
|
||||
size_t getTableTagsBufLen(const SNodeList* pGroups) {
|
||||
size_t keyLen = 0;
|
||||
|
||||
SNode* node;
|
||||
FOREACH(node, pGroups) {
|
||||
SExprNode* pExpr = (SExprNode*)node;
|
||||
keyLen += pExpr->resType.bytes;
|
||||
}
|
||||
|
||||
keyLen += sizeof(int8_t) * LIST_LENGTH(pGroups);
|
||||
return keyLen;
|
||||
}
|
||||
|
||||
int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId) {
|
||||
SMetaReader mr = {0};
|
||||
metaReaderInit(&mr, pMeta, 0);
|
||||
metaGetTableEntryByUid(&mr, uid);
|
||||
|
||||
SNodeList* groupNew = nodesCloneList(pGroupNode);
|
||||
|
||||
nodesRewriteExprsPostOrder(groupNew, doTranslateTagExpr, &mr);
|
||||
char* isNull = (char*)keyBuf;
|
||||
char* pStart = (char*)keyBuf + sizeof(int8_t)*LIST_LENGTH(pGroupNode);
|
||||
|
||||
SNode* pNode;
|
||||
int32_t index = 0;
|
||||
FOREACH(pNode, groupNew) {
|
||||
SNode* pNew = NULL;
|
||||
int32_t code = scalarCalculateConstants(pNode, &pNew);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
REPLACE_NODE(pNew);
|
||||
} else {
|
||||
taosMemoryFree(keyBuf);
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
return code;
|
||||
}
|
||||
|
||||
ASSERT(nodeType(pNew) == QUERY_NODE_VALUE);
|
||||
SValueNode* pValue = (SValueNode*)pNew;
|
||||
|
||||
if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL || pValue->isNull) {
|
||||
isNull[index++] = 1;
|
||||
continue;
|
||||
} else {
|
||||
isNull[index++] = 0;
|
||||
char* data = nodesGetValueFromNode(pValue);
|
||||
if (pValue->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
||||
if (tTagIsJson(data)) {
|
||||
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
|
||||
taosMemoryFree(keyBuf);
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
return terrno;
|
||||
}
|
||||
int32_t len = getJsonValueLen(data);
|
||||
memcpy(pStart, data, len);
|
||||
pStart += len;
|
||||
} else if (IS_VAR_DATA_TYPE(pValue->node.resType.type)) {
|
||||
memcpy(pStart, data, varDataTLen(data));
|
||||
pStart += varDataTLen(data);
|
||||
} else {
|
||||
memcpy(pStart, data, pValue->node.resType.bytes);
|
||||
pStart += pValue->node.resType.bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t len = (int32_t)(pStart - (char*)keyBuf);
|
||||
*pGroupId = calcGroupId(keyBuf, len);
|
||||
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
||||
if (!pNodeList) {
|
||||
return NULL;
|
||||
|
@ -625,9 +695,6 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BUF_PAGE_DEBUG
|
||||
qDebug("page_setSelect num:%d", num);
|
||||
#endif
|
||||
if (p != NULL) {
|
||||
p->subsidiaries.pCtx = pValCtx;
|
||||
p->subsidiaries.num = num;
|
||||
|
@ -776,7 +843,7 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
|
|||
// TODO: get it from stable scan node
|
||||
pCond->twindows = pTableScanNode->scanRange;
|
||||
pCond->suid = pTableScanNode->scan.suid;
|
||||
pCond->type = BLOCK_LOAD_OFFSET_ORDER;
|
||||
pCond->type = TIMEWINDOW_RANGE_CONTAINED;
|
||||
pCond->startVersion = -1;
|
||||
pCond->endVersion = -1;
|
||||
// pCond->type = pTableScanNode->scanFlag;
|
||||
|
@ -871,6 +938,7 @@ STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInter
|
|||
}
|
||||
|
||||
// get the correct time window according to the handled timestamp
|
||||
// todo refactor
|
||||
STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int64_t ts, SInterval* pInterval,
|
||||
int32_t order) {
|
||||
STimeWindow w = {0};
|
||||
|
|
|
@ -14,10 +14,21 @@
|
|||
*/
|
||||
|
||||
#include "executor.h"
|
||||
#include "tref.h"
|
||||
#include "executorimpl.h"
|
||||
#include "planner.h"
|
||||
#include "tdatablock.h"
|
||||
#include "vnode.h"
|
||||
#include "tudf.h"
|
||||
|
||||
static TdThreadOnce initPoolOnce = PTHREAD_ONCE_INIT;
|
||||
int32_t exchangeObjRefPool = -1;
|
||||
|
||||
static void initRefPool() { exchangeObjRefPool = taosOpenRef(1024, doDestroyExchangeOperatorInfo); }
|
||||
static void cleanupRefPool() {
|
||||
int32_t ref = atomic_val_compare_exchange_32(&exchangeObjRefPool, exchangeObjRefPool, 0);
|
||||
taosCloseRef(ref);
|
||||
}
|
||||
|
||||
static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, bool assignUid,
|
||||
char* id) {
|
||||
|
@ -120,8 +131,7 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
|
|||
return code;
|
||||
}
|
||||
|
||||
qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols,
|
||||
SSchemaWrapper** pSchemaWrapper) {
|
||||
qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols, SSchemaWrapper** pSchema) {
|
||||
if (msg == NULL) {
|
||||
// TODO create raw scan
|
||||
return NULL;
|
||||
|
@ -155,7 +165,7 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
|
|||
}
|
||||
}
|
||||
|
||||
*pSchemaWrapper = tCloneSSchemaWrapper(((SExecTaskInfo*)pTaskInfo)->schemaInfo.qsw);
|
||||
*pSchema = tCloneSSchemaWrapper(((SExecTaskInfo*)pTaskInfo)->schemaInfo.qsw);
|
||||
return pTaskInfo;
|
||||
}
|
||||
|
||||
|
@ -185,8 +195,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers) {
|
|||
return pTaskInfo;
|
||||
}
|
||||
|
||||
static SArray* filterQualifiedChildTables(const SStreamScanInfo* pScanInfo, const SArray* tableIdList,
|
||||
const char* idstr) {
|
||||
static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const SArray* tableIdList, const char* idstr) {
|
||||
SArray* qa = taosArrayInit(4, sizeof(tb_uid_t));
|
||||
|
||||
// let's discard the tables those are not created according to the queried super table.
|
||||
|
@ -209,7 +218,7 @@ static SArray* filterQualifiedChildTables(const SStreamScanInfo* pScanInfo, cons
|
|||
if (pScanInfo->pTagCond != NULL) {
|
||||
bool qualified = false;
|
||||
STableKeyInfo info = {.groupId = 0, .uid = mr.me.uid};
|
||||
code = isTableOk(&info, pScanInfo->pTagCond, pScanInfo->readHandle.meta, &qualified);
|
||||
code = isQualifiedTable(&info, pScanInfo->pTagCond, pScanInfo->readHandle.meta, &qualified);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("failed to filter new table, uid:0x%" PRIx64 ", %s", info.uid, idstr);
|
||||
continue;
|
||||
|
@ -240,7 +249,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
|
|||
int32_t code = 0;
|
||||
SStreamScanInfo* pScanInfo = pInfo->info;
|
||||
if (isAdd) { // add new table id
|
||||
SArray* qa = filterQualifiedChildTables(pScanInfo, tableIdList, GET_TASKID(pTaskInfo));
|
||||
SArray* qa = filterUnqualifiedTables(pScanInfo, tableIdList, GET_TASKID(pTaskInfo));
|
||||
|
||||
qDebug(" %d qualified child tables added into stream scanner", (int32_t)taosArrayGetSize(qa));
|
||||
code = tqReaderAddTbUidList(pScanInfo->tqReader, qa);
|
||||
|
@ -248,17 +257,35 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
|
|||
return code;
|
||||
}
|
||||
|
||||
// add to qTaskInfo
|
||||
// todo refactor STableList
|
||||
for (int32_t i = 0; i < taosArrayGetSize(qa); ++i) {
|
||||
uint64_t* uid = taosArrayGet(qa, i);
|
||||
|
||||
qDebug("table %ld added to task info", *uid);
|
||||
size_t bufLen = (pScanInfo->pGroupTags != NULL)? getTableTagsBufLen(pScanInfo->pGroupTags):0;
|
||||
char* keyBuf = NULL;
|
||||
if (bufLen > 0) {
|
||||
keyBuf = taosMemoryMalloc(bufLen);
|
||||
if (keyBuf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
for(int32_t i = 0; i < taosArrayGetSize(qa); ++i) {
|
||||
uint64_t* uid = taosArrayGet(qa, i);
|
||||
STableKeyInfo keyInfo = {.uid = *uid, .groupId = 0};
|
||||
|
||||
if (bufLen > 0) {
|
||||
code = getGroupIdFromTagsVal(pScanInfo->readHandle.meta, keyInfo.uid, pScanInfo->pGroupTags, keyBuf,
|
||||
&keyInfo.groupId);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
taosArrayPush(pTaskInfo->tableqinfoList.pTableList, &keyInfo);
|
||||
}
|
||||
|
||||
if (keyBuf != NULL) {
|
||||
taosMemoryFree(keyBuf);
|
||||
}
|
||||
|
||||
taosArrayDestroy(qa);
|
||||
} else { // remove the table id in current list
|
||||
qDebug(" %d remove child tables from the stream scanner", (int32_t)taosArrayGetSize(tableIdList));
|
||||
|
@ -292,3 +319,396 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan,
|
||||
qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, const char* sql, EOPTR_EXEC_MODEL model) {
|
||||
assert(pSubplan != NULL);
|
||||
SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo;
|
||||
|
||||
taosThreadOnce(&initPoolOnce, initRefPool);
|
||||
atexit(cleanupRefPool);
|
||||
|
||||
int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId, sql, model);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
SDataSinkMgtCfg cfg = {.maxDataBlockNum = 1000, .maxDataBlockNumPerQuery = 100};
|
||||
code = dsDataSinkMgtInit(&cfg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
void* pSinkParam = NULL;
|
||||
code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTaskInfo, readHandle);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
code = dsCreateDataSinker(pSubplan->pDataSink, handle, pSinkParam);
|
||||
}
|
||||
|
||||
_error:
|
||||
// if failed to add ref for all tables in this query, abort current query
|
||||
return code;
|
||||
}
|
||||
|
||||
#ifdef TEST_IMPL
|
||||
// wait moment
|
||||
int waitMoment(SQInfo* pQInfo) {
|
||||
if (pQInfo->sql) {
|
||||
int ms = 0;
|
||||
char* pcnt = strstr(pQInfo->sql, " count(*)");
|
||||
if (pcnt) return 0;
|
||||
|
||||
char* pos = strstr(pQInfo->sql, " t_");
|
||||
if (pos) {
|
||||
pos += 3;
|
||||
ms = atoi(pos);
|
||||
while (*pos >= '0' && *pos <= '9') {
|
||||
pos++;
|
||||
}
|
||||
char unit_char = *pos;
|
||||
if (unit_char == 'h') {
|
||||
ms *= 3600 * 1000;
|
||||
} else if (unit_char == 'm') {
|
||||
ms *= 60 * 1000;
|
||||
} else if (unit_char == 's') {
|
||||
ms *= 1000;
|
||||
}
|
||||
}
|
||||
if (ms == 0) return 0;
|
||||
printf("test wait sleep %dms. sql=%s ...\n", ms, pQInfo->sql);
|
||||
|
||||
if (ms < 1000) {
|
||||
taosMsleep(ms);
|
||||
} else {
|
||||
int used_ms = 0;
|
||||
while (used_ms < ms) {
|
||||
taosMsleep(1000);
|
||||
used_ms += 1000;
|
||||
if (isTaskKilled(pQInfo)) {
|
||||
printf("test check query is canceled, sleep break.%s\n", pQInfo->sql);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
int64_t threadId = taosGetSelfPthreadId();
|
||||
|
||||
*pRes = NULL;
|
||||
int64_t curOwner = 0;
|
||||
if ((curOwner = atomic_val_compare_exchange_64(&pTaskInfo->owner, 0, threadId)) != 0) {
|
||||
qError("%s-%p execTask is now executed by thread:%p", GET_TASKID(pTaskInfo), pTaskInfo, (void*)curOwner);
|
||||
pTaskInfo->code = TSDB_CODE_QRY_IN_EXEC;
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
if (pTaskInfo->cost.start == 0) {
|
||||
pTaskInfo->cost.start = taosGetTimestampMs();
|
||||
}
|
||||
|
||||
if (isTaskKilled(pTaskInfo)) {
|
||||
qDebug("%s already killed, abort", GET_TASKID(pTaskInfo));
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// error occurs, record the error code and return to client
|
||||
int32_t ret = setjmp(pTaskInfo->env);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
pTaskInfo->code = ret;
|
||||
cleanUpUdfs();
|
||||
qDebug("%s task abort due to error/cancel occurs, code:%s", GET_TASKID(pTaskInfo), tstrerror(pTaskInfo->code));
|
||||
atomic_store_64(&pTaskInfo->owner, 0);
|
||||
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
qDebug("%s execTask is launched", GET_TASKID(pTaskInfo));
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
*pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
||||
uint64_t el = (taosGetTimestampUs() - st);
|
||||
|
||||
pTaskInfo->cost.elapsedTime += el;
|
||||
if (NULL == *pRes) {
|
||||
*useconds = pTaskInfo->cost.elapsedTime;
|
||||
}
|
||||
|
||||
cleanUpUdfs();
|
||||
|
||||
int32_t current = (*pRes != NULL) ? (*pRes)->info.rows : 0;
|
||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||
|
||||
qDebug("%s task suspended, %d rows returned, total:%" PRId64 " rows, in sinkNode:%d, elapsed:%.2f ms",
|
||||
GET_TASKID(pTaskInfo), current, total, 0, el / 1000.0);
|
||||
|
||||
atomic_store_64(&pTaskInfo->owner, 0);
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
int32_t qKillTask(qTaskInfo_t qinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo;
|
||||
if (pTaskInfo == NULL) {
|
||||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
qAsyncKillTask(qinfo);
|
||||
|
||||
// Wait for the query executing thread being stopped/
|
||||
// Once the query is stopped, the owner of qHandle will be cleared immediately.
|
||||
while (pTaskInfo->owner != 0) {
|
||||
taosMsleep(100);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t qAsyncKillTask(qTaskInfo_t qinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo;
|
||||
|
||||
if (pTaskInfo == NULL) {
|
||||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
qDebug("%s execTask async killed", GET_TASKID(pTaskInfo));
|
||||
setTaskKilled(pTaskInfo);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void qDestroyTask(qTaskInfo_t qTaskHandle) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qTaskHandle;
|
||||
if (pTaskInfo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("%s execTask completed, numOfRows:%" PRId64, GET_TASKID(pTaskInfo), pTaskInfo->pRoot->resultInfo.totalRows);
|
||||
|
||||
queryCostStatis(pTaskInfo); // print the query cost summary
|
||||
doDestroyTask(pTaskInfo);
|
||||
}
|
||||
|
||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t* resNum, SExplainExecInfo** pRes) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
int32_t capacity = 0;
|
||||
|
||||
return getOperatorExplainExecInfo(pTaskInfo->pRoot, pRes, &capacity, resNum);
|
||||
}
|
||||
|
||||
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
|
||||
SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*)tinfo;
|
||||
if (pTaskInfo->pRoot == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t nOptrWithVal = 0;
|
||||
int32_t code = encodeOperator(pTaskInfo->pRoot, pOutput, len, &nOptrWithVal);
|
||||
if ((code == TSDB_CODE_SUCCESS) && (nOptrWithVal = 0)) {
|
||||
taosMemoryFreeClear(*pOutput);
|
||||
*len = 0;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len) {
|
||||
SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*)tinfo;
|
||||
|
||||
if (pTaskInfo == NULL || pInput == NULL || len == 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
return decodeOperator(pTaskInfo->pRoot, pInput, len);
|
||||
}
|
||||
|
||||
int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
|
||||
while (1) {
|
||||
uint8_t type = pOperator->operatorType;
|
||||
if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||
*scanner = pOperator->info;
|
||||
return 0;
|
||||
} else {
|
||||
ASSERT(pOperator->numOfDownstream == 1);
|
||||
pOperator = pOperator->pDownstream[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
|
||||
taosWriteQitem(pTaskInfo->streamInfo.inputQueue->queue, pItem);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t qStreamPrepareRecover(qTaskInfo_t tinfo, int64_t startVer, int64_t endVer) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
|
||||
pTaskInfo->streamInfo.recoverStartVer = startVer;
|
||||
pTaskInfo->streamInfo.recoverEndVer = endVer;
|
||||
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* qExtractReaderFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return (void*)pInfo->tqReader;
|
||||
}
|
||||
|
||||
const SSchemaWrapper* qExtractSchemaFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return pInfo->tqReader->pSchemaWrapper;
|
||||
}
|
||||
|
||||
const STqOffset* qExtractStatusFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return &pInfo->offset;
|
||||
}
|
||||
|
||||
void* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
return pTaskInfo->streamInfo.metaBlk;
|
||||
}
|
||||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, const STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
pTaskInfo->streamInfo.prepareStatus = *pOffset;
|
||||
if (!tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) {
|
||||
while (1) {
|
||||
uint8_t type = pOperator->operatorType;
|
||||
pOperator->status = OP_OPENED;
|
||||
if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||
SStreamScanInfo* pInfo = pOperator->info;
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
||||
tsdbReaderClose(pTSInfo->dataReader);
|
||||
pTSInfo->dataReader = NULL;
|
||||
#if 0
|
||||
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
|
||||
pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
|
||||
qError("prepare scan ver %ld actual ver %ld, last %ld", pOffset->version,
|
||||
pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version);
|
||||
ASSERT(0);
|
||||
}
|
||||
#endif
|
||||
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1);
|
||||
} else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
/*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/
|
||||
int64_t uid = pOffset->uid;
|
||||
int64_t ts = pOffset->ts;
|
||||
|
||||
if (uid == 0) {
|
||||
if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0);
|
||||
uid = pTableInfo->uid;
|
||||
ts = INT64_MIN;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (pTaskInfo->streamInfo.lastStatus.type != TMQ_OFFSET__SNAPSHOT_DATA ||*/
|
||||
/*pTaskInfo->streamInfo.lastStatus.uid != uid || pTaskInfo->streamInfo.lastStatus.ts != ts) {*/
|
||||
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
|
||||
int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList);
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
qDebug("switch to next table %ld (cursor %d), %ld rows returned", uid, pTableScanInfo->currentTable,
|
||||
pInfo->pTableScanOp->resultInfo.totalRows);
|
||||
pInfo->pTableScanOp->resultInfo.totalRows = 0;
|
||||
#endif
|
||||
|
||||
bool found = false;
|
||||
for (int32_t i = 0; i < tableSz; i++) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, i);
|
||||
if (pTableInfo->uid == uid) {
|
||||
found = true;
|
||||
pTableScanInfo->currentTable = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO after dropping table, table may be not found
|
||||
ASSERT(found);
|
||||
|
||||
if (pTableScanInfo->dataReader == NULL) {
|
||||
if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond,
|
||||
pTaskInfo->tableqinfoList.pTableList, &pTableScanInfo->dataReader, NULL) < 0 ||
|
||||
pTableScanInfo->dataReader == NULL) {
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
tsdbSetTableId(pTableScanInfo->dataReader, uid);
|
||||
int64_t oldSkey = pTableScanInfo->cond.twindows.skey;
|
||||
pTableScanInfo->cond.twindows.skey = ts + 1;
|
||||
tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond);
|
||||
pTableScanInfo->cond.twindows.skey = oldSkey;
|
||||
pTableScanInfo->scanTimes = 0;
|
||||
|
||||
qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts,
|
||||
pTableScanInfo->currentTable, tableSz);
|
||||
/*}*/
|
||||
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
ASSERT(pOperator->numOfDownstream == 1);
|
||||
pOperator = pOperator->pDownstream[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int32_t qStreamPrepareTsdbScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
|
||||
if (uid == 0) {
|
||||
if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0);
|
||||
uid = pTableInfo->uid;
|
||||
ts = INT64_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
return doPrepareScan(pTaskInfo->pRoot, uid, ts);
|
||||
}
|
||||
|
||||
int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
|
||||
return doGetScanStatus(pTaskInfo->pRoot, uid, ts);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,424 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dataSinkMgt.h"
|
||||
#include "os.h"
|
||||
#include "tmsg.h"
|
||||
#include "tref.h"
|
||||
#include "tudf.h"
|
||||
|
||||
#include "executor.h"
|
||||
#include "executorimpl.h"
|
||||
#include "query.h"
|
||||
|
||||
static TdThreadOnce initPoolOnce = PTHREAD_ONCE_INIT;
|
||||
int32_t exchangeObjRefPool = -1;
|
||||
|
||||
static void initRefPool() { exchangeObjRefPool = taosOpenRef(1024, doDestroyExchangeOperatorInfo); }
|
||||
static void cleanupRefPool() {
|
||||
int32_t ref = atomic_val_compare_exchange_32(&exchangeObjRefPool, exchangeObjRefPool, 0);
|
||||
taosCloseRef(ref);
|
||||
}
|
||||
|
||||
int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan,
|
||||
qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, const char* sql, EOPTR_EXEC_MODEL model) {
|
||||
assert(pSubplan != NULL);
|
||||
SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo;
|
||||
|
||||
taosThreadOnce(&initPoolOnce, initRefPool);
|
||||
atexit(cleanupRefPool);
|
||||
|
||||
int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId, sql, model);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
SDataSinkMgtCfg cfg = {.maxDataBlockNum = 1000, .maxDataBlockNumPerQuery = 100};
|
||||
code = dsDataSinkMgtInit(&cfg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
if (handle) {
|
||||
void* pSinkParam = NULL;
|
||||
code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTaskInfo, readHandle);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
code = dsCreateDataSinker(pSubplan->pDataSink, handle, pSinkParam);
|
||||
}
|
||||
|
||||
_error:
|
||||
// if failed to add ref for all tables in this query, abort current query
|
||||
return code;
|
||||
}
|
||||
|
||||
#ifdef TEST_IMPL
|
||||
// wait moment
|
||||
int waitMoment(SQInfo* pQInfo) {
|
||||
if (pQInfo->sql) {
|
||||
int ms = 0;
|
||||
char* pcnt = strstr(pQInfo->sql, " count(*)");
|
||||
if (pcnt) return 0;
|
||||
|
||||
char* pos = strstr(pQInfo->sql, " t_");
|
||||
if (pos) {
|
||||
pos += 3;
|
||||
ms = atoi(pos);
|
||||
while (*pos >= '0' && *pos <= '9') {
|
||||
pos++;
|
||||
}
|
||||
char unit_char = *pos;
|
||||
if (unit_char == 'h') {
|
||||
ms *= 3600 * 1000;
|
||||
} else if (unit_char == 'm') {
|
||||
ms *= 60 * 1000;
|
||||
} else if (unit_char == 's') {
|
||||
ms *= 1000;
|
||||
}
|
||||
}
|
||||
if (ms == 0) return 0;
|
||||
printf("test wait sleep %dms. sql=%s ...\n", ms, pQInfo->sql);
|
||||
|
||||
if (ms < 1000) {
|
||||
taosMsleep(ms);
|
||||
} else {
|
||||
int used_ms = 0;
|
||||
while (used_ms < ms) {
|
||||
taosMsleep(1000);
|
||||
used_ms += 1000;
|
||||
if (isTaskKilled(pQInfo)) {
|
||||
printf("test check query is canceled, sleep break.%s\n", pQInfo->sql);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
int64_t threadId = taosGetSelfPthreadId();
|
||||
|
||||
*pRes = NULL;
|
||||
int64_t curOwner = 0;
|
||||
if ((curOwner = atomic_val_compare_exchange_64(&pTaskInfo->owner, 0, threadId)) != 0) {
|
||||
qError("%s-%p execTask is now executed by thread:%p", GET_TASKID(pTaskInfo), pTaskInfo, (void*)curOwner);
|
||||
pTaskInfo->code = TSDB_CODE_QRY_IN_EXEC;
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
if (pTaskInfo->cost.start == 0) {
|
||||
pTaskInfo->cost.start = taosGetTimestampMs();
|
||||
}
|
||||
|
||||
if (isTaskKilled(pTaskInfo)) {
|
||||
qDebug("%s already killed, abort", GET_TASKID(pTaskInfo));
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// error occurs, record the error code and return to client
|
||||
int32_t ret = setjmp(pTaskInfo->env);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
pTaskInfo->code = ret;
|
||||
cleanUpUdfs();
|
||||
qDebug("%s task abort due to error/cancel occurs, code:%s", GET_TASKID(pTaskInfo), tstrerror(pTaskInfo->code));
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
qDebug("%s execTask is launched", GET_TASKID(pTaskInfo));
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
*pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
|
||||
uint64_t el = (taosGetTimestampUs() - st);
|
||||
|
||||
pTaskInfo->cost.elapsedTime += el;
|
||||
if (NULL == *pRes) {
|
||||
*useconds = pTaskInfo->cost.elapsedTime;
|
||||
}
|
||||
|
||||
cleanUpUdfs();
|
||||
|
||||
int32_t current = (*pRes != NULL) ? (*pRes)->info.rows : 0;
|
||||
uint64_t total = pTaskInfo->pRoot->resultInfo.totalRows;
|
||||
|
||||
qDebug("%s task suspended, %d rows returned, total:%" PRId64 " rows, in sinkNode:%d, elapsed:%.2f ms",
|
||||
GET_TASKID(pTaskInfo), current, total, 0, el / 1000.0);
|
||||
|
||||
atomic_store_64(&pTaskInfo->owner, 0);
|
||||
return pTaskInfo->code;
|
||||
}
|
||||
|
||||
int32_t qKillTask(qTaskInfo_t qinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo;
|
||||
|
||||
if (pTaskInfo == NULL) {
|
||||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
qDebug("%s execTask killed", GET_TASKID(pTaskInfo));
|
||||
setTaskKilled(pTaskInfo);
|
||||
|
||||
// Wait for the query executing thread being stopped/
|
||||
// Once the query is stopped, the owner of qHandle will be cleared immediately.
|
||||
while (pTaskInfo->owner != 0) {
|
||||
taosMsleep(100);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t qAsyncKillTask(qTaskInfo_t qinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo;
|
||||
|
||||
if (pTaskInfo == NULL) {
|
||||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
qDebug("%s execTask async killed", GET_TASKID(pTaskInfo));
|
||||
setTaskKilled(pTaskInfo);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void qDestroyTask(qTaskInfo_t qTaskHandle) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qTaskHandle;
|
||||
if (pTaskInfo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("%s execTask completed, numOfRows:%" PRId64, GET_TASKID(pTaskInfo), pTaskInfo->pRoot->resultInfo.totalRows);
|
||||
|
||||
queryCostStatis(pTaskInfo); // print the query cost summary
|
||||
doDestroyTask(pTaskInfo);
|
||||
}
|
||||
|
||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t* resNum, SExplainExecInfo** pRes) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
int32_t capacity = 0;
|
||||
|
||||
return getOperatorExplainExecInfo(pTaskInfo->pRoot, pRes, &capacity, resNum);
|
||||
}
|
||||
|
||||
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
|
||||
SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*)tinfo;
|
||||
if (pTaskInfo->pRoot == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t nOptrWithVal = 0;
|
||||
int32_t code = encodeOperator(pTaskInfo->pRoot, pOutput, len, &nOptrWithVal);
|
||||
if ((code == TSDB_CODE_SUCCESS) && (nOptrWithVal = 0)) {
|
||||
taosMemoryFreeClear(*pOutput);
|
||||
*len = 0;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len) {
|
||||
SExecTaskInfo* pTaskInfo = (struct SExecTaskInfo*)tinfo;
|
||||
|
||||
if (pTaskInfo == NULL || pInput == NULL || len == 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
return decodeOperator(pTaskInfo->pRoot, pInput, len);
|
||||
}
|
||||
|
||||
int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
|
||||
while (1) {
|
||||
uint8_t type = pOperator->operatorType;
|
||||
if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||
*scanner = pOperator->info;
|
||||
return 0;
|
||||
} else {
|
||||
ASSERT(pOperator->numOfDownstream == 1);
|
||||
pOperator = pOperator->pDownstream[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
|
||||
taosWriteQitem(pTaskInfo->streamInfo.inputQueue->queue, pItem);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t qStreamPrepareRecover(qTaskInfo_t tinfo, int64_t startVer, int64_t endVer) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
|
||||
pTaskInfo->streamInfo.recoverStartVer = startVer;
|
||||
pTaskInfo->streamInfo.recoverEndVer = endVer;
|
||||
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* qExtractReaderFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return (void*)pInfo->tqReader;
|
||||
}
|
||||
|
||||
const SSchemaWrapper* qExtractSchemaFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return pInfo->tqReader->pSchemaWrapper;
|
||||
}
|
||||
|
||||
const STqOffset* qExtractStatusFromStreamScanner(void* scanner) {
|
||||
SStreamScanInfo* pInfo = scanner;
|
||||
return &pInfo->offset;
|
||||
}
|
||||
|
||||
void* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
return pTaskInfo->streamInfo.metaBlk;
|
||||
}
|
||||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, const STqOffsetVal* pOffset) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
SOperatorInfo* pOperator = pTaskInfo->pRoot;
|
||||
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE);
|
||||
pTaskInfo->streamInfo.prepareStatus = *pOffset;
|
||||
if (!tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) {
|
||||
while (1) {
|
||||
uint8_t type = pOperator->operatorType;
|
||||
pOperator->status = OP_OPENED;
|
||||
if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||
SStreamScanInfo* pInfo = pOperator->info;
|
||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
|
||||
tsdbReaderClose(pTSInfo->dataReader);
|
||||
pTSInfo->dataReader = NULL;
|
||||
#if 0
|
||||
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
|
||||
pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
|
||||
qError("prepare scan ver %ld actual ver %ld, last %ld", pOffset->version,
|
||||
pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version);
|
||||
ASSERT(0);
|
||||
}
|
||||
#endif
|
||||
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1);
|
||||
} else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
/*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/
|
||||
int64_t uid = pOffset->uid;
|
||||
int64_t ts = pOffset->ts;
|
||||
|
||||
if (uid == 0) {
|
||||
if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0);
|
||||
uid = pTableInfo->uid;
|
||||
ts = INT64_MIN;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (pTaskInfo->streamInfo.lastStatus.type != TMQ_OFFSET__SNAPSHOT_DATA ||*/
|
||||
/*pTaskInfo->streamInfo.lastStatus.uid != uid || pTaskInfo->streamInfo.lastStatus.ts != ts) {*/
|
||||
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
|
||||
int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList);
|
||||
|
||||
#ifndef NDEBUG
|
||||
qDebug("switch to next table %ld (cursor %d), %ld rows returned", uid, pTableScanInfo->currentTable,
|
||||
pInfo->pTableScanOp->resultInfo.totalRows);
|
||||
pInfo->pTableScanOp->resultInfo.totalRows = 0;
|
||||
#endif
|
||||
|
||||
bool found = false;
|
||||
for (int32_t i = 0; i < tableSz; i++) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, i);
|
||||
if (pTableInfo->uid == uid) {
|
||||
found = true;
|
||||
pTableScanInfo->currentTable = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO after dropping table, table may be not found
|
||||
ASSERT(found);
|
||||
|
||||
if (pTableScanInfo->dataReader == NULL) {
|
||||
if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond,
|
||||
pTaskInfo->tableqinfoList.pTableList, &pTableScanInfo->dataReader, NULL) < 0 ||
|
||||
pTableScanInfo->dataReader == NULL) {
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
tsdbSetTableId(pTableScanInfo->dataReader, uid);
|
||||
int64_t oldSkey = pTableScanInfo->cond.twindows.skey;
|
||||
pTableScanInfo->cond.twindows.skey = ts + 1;
|
||||
tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond);
|
||||
pTableScanInfo->cond.twindows.skey = oldSkey;
|
||||
pTableScanInfo->scanTimes = 0;
|
||||
|
||||
qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts,
|
||||
pTableScanInfo->currentTable, tableSz);
|
||||
/*}*/
|
||||
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
ASSERT(pOperator->numOfDownstream == 1);
|
||||
pOperator = pOperator->pDownstream[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int32_t qStreamPrepareTsdbScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
|
||||
if (uid == 0) {
|
||||
if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) {
|
||||
STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0);
|
||||
uid = pTableInfo->uid;
|
||||
ts = INT64_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
return doPrepareScan(pTaskInfo->pRoot, uid, ts);
|
||||
}
|
||||
|
||||
int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) {
|
||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||
|
||||
return doGetScanStatus(pTaskInfo->pRoot, uid, ts);
|
||||
}
|
||||
#endif
|
|
@ -1333,7 +1333,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
|
|||
|
||||
static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep);
|
||||
|
||||
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
|
||||
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo) {
|
||||
if (pFilterNode == NULL || pBlock->info.rows == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1354,6 +1354,20 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
|
|||
filterFreeInfo(filter);
|
||||
|
||||
extractQualifiedTupleByFilterResult(pBlock, rowRes, keep);
|
||||
|
||||
if (pColMatchInfo != NULL) {
|
||||
for(int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) {
|
||||
SColMatchInfo* pInfo = taosArrayGet(pColMatchInfo, i);
|
||||
if (pInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pInfo->targetSlotId);
|
||||
if (pColData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
blockDataUpdateTsWindow(pBlock, pInfo->targetSlotId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taosMemoryFree(rowRes);
|
||||
}
|
||||
|
||||
|
@ -1651,9 +1665,6 @@ void queryCostStatis(SExecTaskInfo* pTaskInfo) {
|
|||
// hashSize += taosHashGetMemSize(pRuntimeEnv->tableqinfoGroupInfo.map);
|
||||
// pSummary->hashSize = hashSize;
|
||||
|
||||
// add the merge time
|
||||
pSummary->elapsedTime += pSummary->firstStageMergeTime;
|
||||
|
||||
// SResultRowPool* p = pTaskInfo->pool;
|
||||
// if (p != NULL) {
|
||||
// pSummary->winInfoSize = getResultRowPoolMemSize(p);
|
||||
|
@ -1662,17 +1673,16 @@ void queryCostStatis(SExecTaskInfo* pTaskInfo) {
|
|||
// pSummary->winInfoSize = 0;
|
||||
// pSummary->numOfTimeWindows = 0;
|
||||
// }
|
||||
//
|
||||
// calculateOperatorProfResults(pQInfo);
|
||||
|
||||
SFileBlockLoadRecorder* pRecorder = pSummary->pRecoder;
|
||||
if (pSummary->pRecoder != NULL) {
|
||||
qDebug("%s :cost summary: elapsed time:%" PRId64 " us, first merge:%" PRId64
|
||||
" us, total blocks:%d, "
|
||||
"load block statis:%d, load data block:%d, total rows:%" PRId64 ", check rows:%" PRId64,
|
||||
GET_TASKID(pTaskInfo), pSummary->elapsedTime, pSummary->firstStageMergeTime, pRecorder->totalBlocks,
|
||||
pRecorder->loadBlockStatis, pRecorder->loadBlocks, pRecorder->totalRows, pRecorder->totalCheckedRows);
|
||||
qDebug(
|
||||
"%s :cost summary: elapsed time:%.2f ms, total blocks:%d, load block SMA:%d, load data block:%d, total rows:%"
|
||||
PRId64 ", check rows:%" PRId64, GET_TASKID(pTaskInfo), pSummary->elapsedTime / 1000.0,
|
||||
pRecorder->totalBlocks, pRecorder->loadBlockStatis, pRecorder->loadBlocks, pRecorder->totalRows,
|
||||
pRecorder->totalCheckedRows);
|
||||
}
|
||||
|
||||
// qDebug("QInfo:0x%"PRIx64" :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb,
|
||||
// hashTable:%.2f Kb", pQInfo->qId, pSummary->winInfoSize/1024.0,
|
||||
// pSummary->numOfTimeWindows, pSummary->tableInfoSize/1024.0, pSummary->hashSize/1024.0);
|
||||
|
@ -3017,7 +3027,6 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
|
|||
}
|
||||
}
|
||||
|
||||
closeAllResultRows(&pAggInfo->binfo.resultRowInfo);
|
||||
initGroupedResultInfo(&pAggInfo->groupResInfo, pAggInfo->aggSup.pResultRowHashTable, 0);
|
||||
OPTR_SET_OPENED(pOperator);
|
||||
|
||||
|
@ -3043,7 +3052,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
|
|||
blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, pInfo, &pAggInfo->groupResInfo, pAggInfo->aggSup.pResultBuf);
|
||||
doFilter(pAggInfo->pCondition, pInfo->pRes);
|
||||
doFilter(pAggInfo->pCondition, pInfo->pRes, NULL);
|
||||
|
||||
if (!hasDataInGroupInfo(&pAggInfo->groupResInfo)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
|
@ -3209,6 +3218,7 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
|
|||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
||||
}
|
||||
|
||||
// here check for a new group data, we need to handle the data of the previous group.
|
||||
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
||||
pLimitInfo->numOfOutputGroups += 1;
|
||||
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
||||
|
@ -3221,6 +3231,11 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
|
|||
// reset the value for a new group data
|
||||
pLimitInfo->numOfOutputRows = 0;
|
||||
pLimitInfo->remainOffset = pLimitInfo->limit.offset;
|
||||
|
||||
// existing rows that belongs to previous group.
|
||||
if (pBlock->info.rows > 0) {
|
||||
return PROJECT_RETRIEVE_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
// here we reach the start position, according to the limit/offset requirements.
|
||||
|
@ -3265,7 +3280,9 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
|||
|
||||
SExprSupp* pSup = &pOperator->exprSupp;
|
||||
SSDataBlock* pRes = pInfo->pRes;
|
||||
blockDataCleanup(pRes);
|
||||
SSDataBlock* pFinalRes = pProjectInfo->pFinalRes;
|
||||
|
||||
blockDataCleanup(pFinalRes);
|
||||
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
|
@ -3276,24 +3293,6 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (pProjectInfo->existDataBlock) { // TODO refactor
|
||||
SSDataBlock* pBlock = pProjectInfo->existDataBlock;
|
||||
pProjectInfo->existDataBlock = NULL;
|
||||
|
||||
// the pDataBlock are always the same one, no need to call this again
|
||||
setInputDataBlock(pOperator, pInfo->pCtx, pBlock, TSDB_ORDER_ASC);
|
||||
|
||||
blockDataEnsureCapacity(pInfo->pRes, pBlock->info.rows);
|
||||
projectApplyFunctions(pOperator->exprSupp.pExprInfo, pInfo->pRes, pBlock, pInfo->pCtx, pOperator->exprSupp.numOfExprs);
|
||||
if (pRes->info.rows >= pProjectInfo->binfo.capacity * 0.8) {
|
||||
copyTsColoum(pRes, pInfo->pCtx, pOperator->exprSupp.numOfExprs);
|
||||
resetResultRowEntryResult(pInfo->pCtx, pOperator->exprSupp.numOfExprs);
|
||||
return pRes;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int64_t st = 0;
|
||||
int32_t order = 0;
|
||||
int32_t scanFlag = 0;
|
||||
|
@ -3303,67 +3302,142 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
SOperatorInfo* downstream = pOperator->pDownstream[0];
|
||||
SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo;
|
||||
|
||||
while (1) {
|
||||
// The downstream exec may change the value of the newgroup, so use a local variable instead.
|
||||
qDebug("projection call next");
|
||||
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
|
||||
if (pBlock == NULL) {
|
||||
qDebug("projection get null");
|
||||
while(1) {
|
||||
while (1) {
|
||||
blockDataCleanup(pRes);
|
||||
|
||||
/*if (pTaskInfo->execModel == OPTR_EXEC_MODEL_BATCH) {*/
|
||||
doSetOperatorCompleted(pOperator);
|
||||
/*} else if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {*/
|
||||
/*pOperator->status = OP_RES_TO_RETURN;*/
|
||||
/*}*/
|
||||
break;
|
||||
}
|
||||
if (pBlock->info.type == STREAM_RETRIEVE) {
|
||||
// for stream interval
|
||||
return pBlock;
|
||||
}
|
||||
// The downstream exec may change the value of the newgroup, so use a local variable instead.
|
||||
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
|
||||
if (pBlock == NULL) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
|
||||
// the pDataBlock are always the same one, no need to call this again
|
||||
int32_t code = getTableScanInfo(pOperator->pDownstream[0], &order, &scanFlag);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
longjmp(pTaskInfo->env, code);
|
||||
}
|
||||
if (pBlock->info.type == STREAM_RETRIEVE) {
|
||||
// for stream interval
|
||||
return pBlock;
|
||||
}
|
||||
|
||||
setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false);
|
||||
blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows);
|
||||
if (pLimitInfo->remainGroupOffset > 0) {
|
||||
if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.groupId) { // it is the first group
|
||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
||||
ASSERT(pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM);
|
||||
continue;
|
||||
} else if (pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
||||
// now it is the data from a new group
|
||||
pLimitInfo->remainGroupOffset -= 1;
|
||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
||||
|
||||
code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs,
|
||||
pProjectInfo->pPseudoColInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
longjmp(pTaskInfo->env, code);
|
||||
}
|
||||
// ignore data block in current group
|
||||
if (pLimitInfo->remainGroupOffset > 0) {
|
||||
ASSERT(pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t status = handleLimitOffset(pOperator, &pProjectInfo->limitInfo, pInfo->pRes, true);
|
||||
// set current group id of the project operator
|
||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
||||
}
|
||||
|
||||
// filter shall be applied after apply functions and limit/offset on the result
|
||||
doFilter(pProjectInfo->pFilterNode, pInfo->pRes);
|
||||
// remainGroupOffset == 0
|
||||
// here check for a new group data, we need to handle the data of the previous group.
|
||||
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
||||
pLimitInfo->numOfOutputGroups += 1;
|
||||
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) {
|
||||
// reset the value for a new group data
|
||||
// existing rows that belongs to previous group.
|
||||
pLimitInfo->numOfOutputRows = 0;
|
||||
pLimitInfo->remainOffset = pLimitInfo->limit.offset;
|
||||
}
|
||||
|
||||
// the pDataBlock are always the same one, no need to call this again
|
||||
int32_t code = getTableScanInfo(pOperator->pDownstream[0], &order, &scanFlag);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
longjmp(pTaskInfo->env, code);
|
||||
}
|
||||
|
||||
setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false);
|
||||
blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows);
|
||||
|
||||
code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs,
|
||||
pProjectInfo->pPseudoColInfo);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
longjmp(pTaskInfo->env, code);
|
||||
}
|
||||
|
||||
// set current group id
|
||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
||||
|
||||
if (pLimitInfo->remainOffset >= pInfo->pRes->info.rows) {
|
||||
pLimitInfo->remainOffset -= pInfo->pRes->info.rows;
|
||||
blockDataCleanup(pInfo->pRes);
|
||||
ASSERT(pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM);
|
||||
continue;
|
||||
} else if (pLimitInfo->remainOffset < pInfo->pRes->info.rows && pLimitInfo->remainOffset > 0) {
|
||||
blockDataTrimFirstNRows(pInfo->pRes, pLimitInfo->remainOffset);
|
||||
pLimitInfo->remainOffset = 0;
|
||||
ASSERT(pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM);
|
||||
}
|
||||
|
||||
// check for the limitation in each group
|
||||
if (pLimitInfo->limit.limit >= 0 &&
|
||||
pLimitInfo->numOfOutputRows + pInfo->pRes->info.rows >= pLimitInfo->limit.limit) {
|
||||
int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows);
|
||||
blockDataKeepFirstNRows(pInfo->pRes, keepRows);
|
||||
ASSERT(pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM);
|
||||
if (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) {
|
||||
pOperator->status = OP_EXEC_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
pLimitInfo->numOfOutputRows += pInfo->pRes->info.rows;
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == PROJECT_RETRIEVE_CONTINUE || pInfo->pRes->info.rows == 0) {
|
||||
continue;
|
||||
} else if (status == PROJECT_RETRIEVE_DONE) {
|
||||
if (pProjectInfo->mergeDataBlocks && pTaskInfo->execModel != OPTR_EXEC_MODEL_STREAM) {
|
||||
if (pRes->info.rows > 0) {
|
||||
pFinalRes->info.groupId = pRes->info.groupId;
|
||||
pFinalRes->info.version = pRes->info.version;
|
||||
|
||||
// continue merge data, ignore the group id
|
||||
blockDataMerge(pFinalRes, pRes);
|
||||
if (pFinalRes->info.rows + pRes->info.rows <= pOperator->resultInfo.threshold) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// do apply filter
|
||||
doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL);
|
||||
if (pFinalRes->info.rows > 0 || pRes->info.rows == 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// do apply filter
|
||||
if (pRes->info.rows > 0) {
|
||||
doFilter(pProjectInfo->pFilterNode, pRes, NULL);
|
||||
if (pRes->info.rows == 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size_t rows = pInfo->pRes->info.rows;
|
||||
pProjectInfo->limitInfo.numOfOutputRows += rows;
|
||||
|
||||
pOperator->resultInfo.totalRows += rows;
|
||||
SSDataBlock* p = pProjectInfo->mergeDataBlocks ? pFinalRes : pRes;
|
||||
pOperator->resultInfo.totalRows += p->info.rows;
|
||||
|
||||
if (pOperator->cost.openCost == 0) {
|
||||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||
}
|
||||
|
||||
return (rows > 0) ? pInfo->pRes : NULL;
|
||||
return (p->info.rows > 0) ? p : NULL;
|
||||
}
|
||||
|
||||
static void doHandleRemainBlockForNewGroupImpl(SFillOperatorInfo* pInfo, SResultInfo* pResultInfo,
|
||||
|
@ -3492,7 +3566,7 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
|
|||
break;
|
||||
}
|
||||
|
||||
doFilter(pInfo->pCondition, fillResult);
|
||||
doFilter(pInfo->pCondition, fillResult, pInfo->pColMatchColInfo);
|
||||
if (fillResult->info.rows > 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -3755,6 +3829,7 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
|
|||
cleanupAggSup(&pInfo->aggSup);
|
||||
taosArrayDestroy(pInfo->pPseudoColInfo);
|
||||
|
||||
blockDataDestroy(pInfo->pFinalRes);
|
||||
taosMemoryFreeClear(param);
|
||||
}
|
||||
|
||||
|
@ -3814,7 +3889,9 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
|
|||
initLimitInfo(pProjPhyNode->node.pLimit, pProjPhyNode->node.pSlimit, &pInfo->limitInfo);
|
||||
|
||||
pInfo->binfo.pRes = pResBlock;
|
||||
pInfo->pFinalRes = createOneDataBlock(pResBlock, false);
|
||||
pInfo->pFilterNode = pProjPhyNode->node.pConditions;
|
||||
pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock;
|
||||
|
||||
int32_t numOfRows = 4096;
|
||||
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
|
||||
|
@ -3950,7 +4027,7 @@ static SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) {
|
|||
}
|
||||
}
|
||||
|
||||
doFilter(pIndefInfo->pCondition, pInfo->pRes);
|
||||
doFilter(pIndefInfo->pCondition, pInfo->pRes, NULL);
|
||||
size_t rows = pInfo->pRes->info.rows;
|
||||
if (rows > 0 || pOperator->status == OP_EXEC_DONE) {
|
||||
break;
|
||||
|
@ -4134,9 +4211,6 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
|
|||
return pTaskInfo;
|
||||
}
|
||||
|
||||
static STsdbReader* doCreateDataReader(STableScanPhysiNode* pTableScanNode, SReadHandle* pHandle,
|
||||
STableListInfo* pTableListInfo, const char* idstr);
|
||||
|
||||
static SArray* extractColumnInfo(SNodeList* pNodeList);
|
||||
|
||||
SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode);
|
||||
|
@ -4177,9 +4251,11 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode,
|
|||
}
|
||||
|
||||
SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
|
||||
int32_t numOfCols = LIST_LENGTH(pScanNode->pScanCols);
|
||||
int32_t numOfCols = LIST_LENGTH(pScanNode->pScanCols);
|
||||
int32_t numOfTags = LIST_LENGTH(pScanNode->pScanPseudoCols);
|
||||
|
||||
SSchemaWrapper* pqSw = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
|
||||
pqSw->pSchema = taosMemoryCalloc(numOfCols, sizeof(SSchema));
|
||||
pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
|
||||
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
STargetNode* pNode = (STargetNode*)nodesListGetNode(pScanNode->pScanCols, i);
|
||||
|
@ -4192,6 +4268,22 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
|
|||
strncpy(pSchema->name, pColNode->colName, tListLen(pSchema->name));
|
||||
}
|
||||
|
||||
// this the tags and pseudo function columns, we only keep the tag columns
|
||||
for(int32_t i = 0; i < numOfTags; ++i) {
|
||||
STargetNode* pNode = (STargetNode*)nodesListGetNode(pScanNode->pScanPseudoCols, i);
|
||||
|
||||
int32_t type = nodeType(pNode->pExpr);
|
||||
if (type == QUERY_NODE_COLUMN) {
|
||||
SColumnNode* pColNode = (SColumnNode*)pNode->pExpr;
|
||||
|
||||
SSchema* pSchema = &pqSw->pSchema[pqSw->nCols++];
|
||||
pSchema->colId = pColNode->colId;
|
||||
pSchema->type = pColNode->node.resType.type;
|
||||
pSchema->type = pColNode->node.resType.bytes;
|
||||
strncpy(pSchema->name, pColNode->colName, tListLen(pSchema->name));
|
||||
}
|
||||
}
|
||||
|
||||
return pqSw;
|
||||
}
|
||||
|
||||
|
@ -4293,69 +4385,15 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
|
|||
int32_t groupNum = 0;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pTableListInfo->pTableList); i++) {
|
||||
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
|
||||
SMetaReader mr = {0};
|
||||
metaReaderInit(&mr, pHandle->meta, 0);
|
||||
metaGetTableEntryByUid(&mr, info->uid);
|
||||
|
||||
SNodeList* groupNew = nodesCloneList(group);
|
||||
|
||||
nodesRewriteExprsPostOrder(groupNew, doTranslateTagExpr, &mr);
|
||||
char* isNull = (char*)keyBuf;
|
||||
char* pStart = (char*)keyBuf + nullFlagSize;
|
||||
|
||||
SNode* pNode;
|
||||
int32_t index = 0;
|
||||
FOREACH(pNode, groupNew) {
|
||||
SNode* pNew = NULL;
|
||||
int32_t code = scalarCalculateConstants(pNode, &pNew);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
REPLACE_NODE(pNew);
|
||||
} else {
|
||||
taosMemoryFree(keyBuf);
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
return code;
|
||||
}
|
||||
|
||||
ASSERT(nodeType(pNew) == QUERY_NODE_VALUE);
|
||||
SValueNode* pValue = (SValueNode*)pNew;
|
||||
|
||||
if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL || pValue->isNull) {
|
||||
isNull[index++] = 1;
|
||||
continue;
|
||||
} else {
|
||||
isNull[index++] = 0;
|
||||
char* data = nodesGetValueFromNode(pValue);
|
||||
if (pValue->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
||||
if (tTagIsJson(data)) {
|
||||
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
|
||||
taosMemoryFree(keyBuf);
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
return terrno;
|
||||
}
|
||||
int32_t len = getJsonValueLen(data);
|
||||
memcpy(pStart, data, len);
|
||||
pStart += len;
|
||||
} else if (IS_VAR_DATA_TYPE(pValue->node.resType.type)) {
|
||||
memcpy(pStart, data, varDataTLen(data));
|
||||
pStart += varDataTLen(data);
|
||||
} else {
|
||||
memcpy(pStart, data, pValue->node.resType.bytes);
|
||||
pStart += pValue->node.resType.bytes;
|
||||
}
|
||||
}
|
||||
int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t len = (int32_t)(pStart - (char*)keyBuf);
|
||||
uint64_t groupId = calcGroupId(keyBuf, len);
|
||||
taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &groupId, sizeof(uint64_t));
|
||||
info->groupId = groupId;
|
||||
taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &info->groupId, sizeof(uint64_t));
|
||||
groupNum++;
|
||||
|
||||
nodesDestroyList(groupNew);
|
||||
metaReaderClear(&mr);
|
||||
}
|
||||
|
||||
taosMemoryFree(keyBuf);
|
||||
|
||||
if (pTableListInfo->needSortTableByGroupId) {
|
||||
|
@ -4382,7 +4420,7 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
|
|||
|
||||
pCond->twindows = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
|
||||
pCond->suid = uid;
|
||||
pCond->type = BLOCK_LOAD_OFFSET_ORDER;
|
||||
pCond->type = TIMEWINDOW_RANGE_CONTAINED;
|
||||
pCond->startVersion = -1;
|
||||
pCond->endVersion = -1;
|
||||
|
||||
|
@ -4443,12 +4481,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
|||
return createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
|
||||
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) {
|
||||
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
|
||||
STimeWindowAggSupp aggSup = (STimeWindowAggSupp){
|
||||
.waterMark = pTableScanNode->watermark,
|
||||
.calTrigger = pTableScanNode->triggerType,
|
||||
.maxTs = INT64_MIN,
|
||||
};
|
||||
|
||||
if (pHandle->vnode) {
|
||||
int32_t code =
|
||||
createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, pTableScanNode->groupSort,
|
||||
|
@ -4468,7 +4500,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
|||
#endif
|
||||
|
||||
pTaskInfo->schemaInfo.qsw = extractQueriedColumnSchema(&pTableScanNode->scan);
|
||||
SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle, pTableScanNode, pTagCond, &aggSup, pTaskInfo);
|
||||
SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle, pTableScanNode, pTagCond, pTaskInfo);
|
||||
return pOperator;
|
||||
|
||||
} else if (QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN == type) {
|
||||
|
|
|
@ -299,7 +299,7 @@ static SSDataBlock* buildGroupResultDataBlock(SOperatorInfo* pOperator) {
|
|||
SSDataBlock* pRes = pInfo->binfo.pRes;
|
||||
while(1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pRes);
|
||||
doFilter(pInfo->pCondition, pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
|
|
@ -211,7 +211,7 @@ SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator) {
|
|||
break;
|
||||
}
|
||||
if (pJoinInfo->pCondAfterMerge != NULL) {
|
||||
doFilter(pJoinInfo->pCondAfterMerge, pRes);
|
||||
doFilter(pJoinInfo->pCondAfterMerge, pRes, NULL);
|
||||
}
|
||||
if (pRes->info.rows >= pOperator->resultInfo.threshold) {
|
||||
break;
|
||||
|
|
|
@ -264,7 +264,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
|
|||
}
|
||||
|
||||
int64_t st = taosGetTimestampMs();
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock);
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo);
|
||||
|
||||
int64_t et = taosGetTimestampMs();
|
||||
pTableScanInfo->readRecorder.filterTime += (et - st);
|
||||
|
@ -273,6 +273,8 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
|
|||
pCost->filterOutBlocks += 1;
|
||||
qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
|
||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
} else {
|
||||
qDebug("%s data block filter out, elapsed time:%"PRId64, GET_TASKID(pTaskInfo), (et - st));
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -946,7 +948,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr
|
|||
}
|
||||
blockDataCleanup(pDestBlock);
|
||||
int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3);
|
||||
|
@ -994,16 +996,16 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
|
|||
|
||||
SColumnInfoData* pTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
||||
SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX);
|
||||
uint64_t* uidCol = (uint64_t*)pUidCol->pData;
|
||||
uint64_t* uidCol = (uint64_t*)pUidCol->pData;
|
||||
ASSERT(pTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
TSKEY* tsCol = (TSKEY*)pTsCol->pData;
|
||||
TSKEY* tsCol = (TSKEY*)pTsCol->pData;
|
||||
SColumnInfoData* pStartTsCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
||||
SColumnInfoData* pEndTsCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX);
|
||||
SColumnInfoData* pGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX);
|
||||
SColumnInfoData* pCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
|
||||
SColumnInfoData* pCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
|
||||
uint64_t groupId = getGroupId(pInfo->pTableScanOp, uidCol[0]);
|
||||
for (int32_t i = 0; i < rows; ) {
|
||||
uint64_t groupId = getGroupId(pInfo->pTableScanOp, uidCol[0]);
|
||||
for (int32_t i = 0; i < rows;) {
|
||||
colDataAppend(pCalStartTsCol, pDestBlock->info.rows, (const char*)(tsCol + i), false);
|
||||
STimeWindow win = getSlidingWindow(tsCol, &pInfo->interval, &pSrcBlock->info, &i);
|
||||
colDataAppend(pCalEndTsCol, pDestBlock->info.rows, (const char*)(tsCol + i - 1), false);
|
||||
|
@ -1134,7 +1136,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
|
|||
}
|
||||
}
|
||||
|
||||
doFilter(pInfo->pCondition, pInfo->pRes);
|
||||
doFilter(pInfo->pCondition, pInfo->pRes, NULL);
|
||||
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
||||
blockDataFreeRes((SSDataBlock*)pBlock);
|
||||
return 0;
|
||||
|
@ -1167,8 +1169,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
|||
return NULL;
|
||||
} else if (ret.fetchType == FETCH_TYPE__NONE) {
|
||||
pTaskInfo->streamInfo.lastStatus = ret.offset;
|
||||
ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 >= pTaskInfo->streamInfo.prepareStatus.version);
|
||||
qDebug("stream scan log return null");
|
||||
ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version);
|
||||
ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion);
|
||||
char formatBuf[80];
|
||||
tFormatOffset(formatBuf, 80, &ret.offset);
|
||||
qDebug("stream scan log return null, offset %s", formatBuf);
|
||||
return NULL;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
|
@ -1272,7 +1277,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SStreamAggSupporter* pSup = pInfo->sessionSup.pStreamAggSup;
|
||||
if (isStateWindow(pInfo) && pSup->pScanBlock->info.rows > 0) {
|
||||
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
|
||||
|
@ -1415,7 +1420,7 @@ static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) {
|
|||
}
|
||||
|
||||
SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond,
|
||||
STimeWindowAggSupp* pTwSup, SExecTaskInfo* pTaskInfo) {
|
||||
SExecTaskInfo* pTaskInfo) {
|
||||
SStreamScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamScanInfo));
|
||||
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
|
||||
|
||||
|
@ -1428,8 +1433,12 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
|
|||
SDataBlockDescNode* pDescNode = pScanPhyNode->node.pOutputDataBlockDesc;
|
||||
|
||||
pInfo->pTagCond = pTagCond;
|
||||
|
||||
pInfo->twAggSup = *pTwSup;
|
||||
pInfo->pGroupTags = pTableScanNode->pGroupTags;
|
||||
pInfo->twAggSup = (STimeWindowAggSupp){
|
||||
.waterMark = pTableScanNode->watermark,
|
||||
.calTrigger = pTableScanNode->triggerType,
|
||||
.maxTs = INT64_MIN,
|
||||
};
|
||||
|
||||
int32_t numOfCols = 0;
|
||||
pInfo->pColMatchInfo = extractColMatchInfo(pScanPhyNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID);
|
||||
|
@ -1641,55 +1650,7 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
|
|||
return pInfo->pRes->info.rows == 0 ? NULL : pInfo->pRes;
|
||||
}
|
||||
|
||||
doFilter(pInfo->pCondition, pInfo->pRes);
|
||||
#if 0
|
||||
SFilterInfo* filter = NULL;
|
||||
|
||||
int32_t code = filterInitFromNode(pInfo->pCondition, &filter, 0);
|
||||
|
||||
SFilterColumnParam param1 = {.numOfCols = pInfo->pRes->info.numOfCols, .pDataBlock = pInfo->pRes->pDataBlock};
|
||||
code = filterSetDataFromSlotId(filter, ¶m1);
|
||||
|
||||
int8_t* rowRes = NULL;
|
||||
bool keep = filterExecute(filter, pInfo->pRes, &rowRes, NULL, param1.numOfCols);
|
||||
filterFreeInfo(filter);
|
||||
|
||||
SSDataBlock* px = createOneDataBlock(pInfo->pRes, false);
|
||||
blockDataEnsureCapacity(px, pInfo->pRes->info.rows);
|
||||
|
||||
// TODO refactor
|
||||
int32_t numOfRow = 0;
|
||||
for (int32_t i = 0; i < pInfo->pRes->info.numOfCols; ++i) {
|
||||
SColumnInfoData* pDest = taosArrayGet(px->pDataBlock, i);
|
||||
SColumnInfoData* pSrc = taosArrayGet(pInfo->pRes->pDataBlock, i);
|
||||
|
||||
if (keep) {
|
||||
colDataAssign(pDest, pSrc, pInfo->pRes->info.rows, &px->info);
|
||||
numOfRow = pInfo->pRes->info.rows;
|
||||
} else if (NULL != rowRes) {
|
||||
numOfRow = 0;
|
||||
for (int32_t j = 0; j < pInfo->pRes->info.rows; ++j) {
|
||||
if (rowRes[j] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (colDataIsNull_s(pSrc, j)) {
|
||||
colDataAppendNULL(pDest, numOfRow);
|
||||
} else {
|
||||
colDataAppend(pDest, numOfRow, colDataGetData(pSrc, j), false);
|
||||
}
|
||||
|
||||
numOfRow += 1;
|
||||
}
|
||||
} else {
|
||||
numOfRow = 0;
|
||||
}
|
||||
}
|
||||
|
||||
px->info.rows = numOfRow;
|
||||
pInfo->pRes = px;
|
||||
#endif
|
||||
|
||||
doFilter(pInfo->pCondition, pInfo->pRes, NULL);
|
||||
return pInfo->pRes->info.rows == 0 ? NULL : pInfo->pRes;
|
||||
}
|
||||
|
||||
|
@ -1716,6 +1677,87 @@ static SSDataBlock* buildInfoSchemaTableMetaBlock(char* tableName) {
|
|||
return pBlock;
|
||||
}
|
||||
|
||||
int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int32_t* len) {
|
||||
int32_t n = 0;
|
||||
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_NULL:
|
||||
n = sprintf(str, "null");
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
n = sprintf(str, (*(int8_t*)buf) ? "true" : "false");
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
n = sprintf(str, "%d", *(int8_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
n = sprintf(str, "%d", *(int16_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
n = sprintf(str, "%d", *(int32_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
n = sprintf(str, "%" PRId64, *(int64_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_FLOAT:
|
||||
n = sprintf(str, "%.5f", GET_FLOAT_VAL(buf));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
n = sprintf(str, "%.9f", GET_DOUBLE_VAL(buf));
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
if (bufSize < 0) {
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
memcpy(str, buf, bufSize);
|
||||
n = bufSize;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_NCHAR:
|
||||
if (bufSize < 0) {
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
int32_t length = taosUcs4ToMbs((TdUcs4*)buf, bufSize, str);
|
||||
if (length <= 0) {
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
n = length;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
n = sprintf(str, "%u", *(uint8_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_USMALLINT:
|
||||
n = sprintf(str, "%u", *(uint16_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
n = sprintf(str, "%u", *(uint32_t*)buf);
|
||||
break;
|
||||
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
n = sprintf(str, "%" PRIu64, *(uint64_t*)buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (len) *len = n;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
SSysTableScanInfo* pInfo = pOperator->info;
|
||||
|
@ -1786,14 +1828,24 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
|||
pColInfoData = taosArrayGet(p->pDataBlock, 2);
|
||||
colDataAppend(pColInfoData, numOfRows, stableName, false);
|
||||
|
||||
// tag name
|
||||
char tagName[TSDB_COL_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(tagName, smr.me.stbEntry.schemaTag.pSchema[i].name);
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 3);
|
||||
colDataAppend(pColInfoData, numOfRows, tagName, false);
|
||||
|
||||
// tag type
|
||||
int8_t tagType = smr.me.stbEntry.schemaTag.pSchema[i].type;
|
||||
pColInfoData = taosArrayGet(p->pDataBlock, 4);
|
||||
colDataAppend(pColInfoData, numOfRows, (char*)&tagType, false);
|
||||
char tagTypeStr[VARSTR_HEADER_SIZE + 32];
|
||||
int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name);
|
||||
if (tagType == TSDB_DATA_TYPE_VARCHAR) {
|
||||
tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", (int32_t)(smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE));
|
||||
} else if (tagType == TSDB_DATA_TYPE_NCHAR) {
|
||||
tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", (int32_t)((smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||
}
|
||||
varDataSetLen(tagTypeStr, tagTypeLen);
|
||||
colDataAppend(pColInfoData, numOfRows, (char*)tagTypeStr, false);
|
||||
|
||||
STagVal tagVal = {0};
|
||||
tagVal.cid = smr.me.stbEntry.schemaTag.pSchema[i].colId;
|
||||
|
@ -1828,7 +1880,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
|
|||
: (3 + DBL_MANT_DIG - DBL_MIN_EXP + VARSTR_HEADER_SIZE);
|
||||
tagVarChar = taosMemoryMalloc(bufSize);
|
||||
int32_t len = -1;
|
||||
dataConverToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len);
|
||||
convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len);
|
||||
varDataSetLen(tagVarChar, len);
|
||||
}
|
||||
}
|
||||
|
@ -2657,7 +2709,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
|
|||
}
|
||||
|
||||
int64_t st = taosGetTimestampMs();
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock);
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo);
|
||||
|
||||
int64_t et = taosGetTimestampMs();
|
||||
pTableScanInfo->readRecorder.filterTime += (et - st);
|
||||
|
|
|
@ -216,7 +216,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
doFilter(pInfo->pCondition, pBlock);
|
||||
doFilter(pInfo->pCondition, pBlock, pInfo->pColMatchInfo);
|
||||
if (blockDataGetNumOfRows(pBlock) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -772,6 +772,41 @@ int32_t binarySearch(void* keyList, int num, TSKEY key, int order, __get_value_f
|
|||
return midPos;
|
||||
}
|
||||
|
||||
int32_t comparePullWinKey(void* pKey, void* data, int32_t index) {
|
||||
SArray* res = (SArray*)data;
|
||||
SPullWindowInfo* pos = taosArrayGet(res, index);
|
||||
SPullWindowInfo* pData = (SPullWindowInfo*) pKey;
|
||||
if (pData->window.skey == pos->window.skey) {
|
||||
if (pData->groupId > pos->groupId) {
|
||||
return 1;
|
||||
} else if (pData->groupId < pos->groupId) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
} else if (pData->window.skey > pos->window.skey) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) {
|
||||
int32_t size = taosArrayGetSize(pPullWins);
|
||||
int32_t index = binarySearchCom(pPullWins, size, pPullInfo, TSDB_ORDER_DESC, comparePullWinKey);
|
||||
if (index == -1) {
|
||||
index = 0;
|
||||
} else {
|
||||
if (comparePullWinKey(pPullInfo, pPullWins, index) > 0) {
|
||||
index++;
|
||||
} else {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
if (taosArrayInsert(pPullWins, index, pPullInfo) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t compareResKey(void* pKey, void* data, int32_t index) {
|
||||
SArray* res = (SArray*)data;
|
||||
SResKeyPos* pos = taosArrayGetP(res, index);
|
||||
|
@ -905,6 +940,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
|
|||
|
||||
if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) {
|
||||
saveResultRow(pResult, tableGroupId, pUpdated);
|
||||
setResultBufPageDirty(pInfo->aggSup.pResultBuf, &pResultRowInfo->cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -961,6 +997,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
|
|||
|
||||
if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM && pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) {
|
||||
saveResultRow(pResult, tableGroupId, pUpdated);
|
||||
setResultBufPageDirty(pInfo->aggSup.pResultBuf, &pResultRowInfo->cur);
|
||||
}
|
||||
|
||||
ekey = ascScan ? nextWin.ekey : nextWin.skey;
|
||||
|
@ -1057,7 +1094,6 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
|
|||
hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL);
|
||||
}
|
||||
|
||||
closeAllResultRows(&pInfo->binfo.resultRowInfo);
|
||||
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->order);
|
||||
OPTR_SET_OPENED(pOperator);
|
||||
|
||||
|
@ -1178,7 +1214,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
|
|||
if (pOperator->status == OP_RES_TO_RETURN) {
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
@ -1213,13 +1249,12 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
|
|||
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
|
||||
|
||||
pOperator->status = OP_RES_TO_RETURN;
|
||||
closeAllResultRows(&pBInfo->resultRowInfo);
|
||||
|
||||
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC);
|
||||
blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity);
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
@ -1256,7 +1291,7 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) {
|
|||
blockDataEnsureCapacity(pBlock, pOperator->resultInfo.capacity);
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBlock);
|
||||
doFilter(pInfo->pCondition, pBlock, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
@ -1970,7 +2005,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
|
|||
if (pOperator->status == OP_RES_TO_RETURN) {
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
@ -2008,13 +2043,12 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
|
|||
|
||||
// restore the value
|
||||
pOperator->status = OP_RES_TO_RETURN;
|
||||
closeAllResultRows(&pBInfo->resultRowInfo);
|
||||
|
||||
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC);
|
||||
blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity);
|
||||
while (1) {
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
|
@ -2172,8 +2206,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
|
|||
SSDataBlock* pResBlock = pSliceInfo->pRes;
|
||||
SExprSupp* pSup = &pOperator->exprSupp;
|
||||
|
||||
blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
|
||||
|
||||
// if (pOperator->status == OP_RES_TO_RETURN) {
|
||||
// // doBuildResultDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
|
||||
// if (pResBlock->info.rows == 0 || !hasDataInGroupInfo(&pSliceInfo->groupResInfo)) {
|
||||
|
@ -2313,10 +2345,10 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
|
|||
initResultSizeInfo(&pOperator->resultInfo, 4096);
|
||||
|
||||
pInfo->pFillColInfo = createFillColInfo(pExprInfo, numOfExprs, (SNodeListNode*)pInterpPhyNode->pFillValues);
|
||||
pInfo->pRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
|
||||
pInfo->win = pInterpPhyNode->timeRange;
|
||||
pInfo->pRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
|
||||
pInfo->win = pInterpPhyNode->timeRange;
|
||||
pInfo->interval.interval = pInterpPhyNode->interval;
|
||||
pInfo->current = pInfo->win.skey;
|
||||
pInfo->current = pInfo->win.skey;
|
||||
|
||||
pOperator->name = "TimeSliceOperator";
|
||||
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC;
|
||||
|
@ -2507,6 +2539,7 @@ static void rebuildIntervalWindow(SStreamFinalIntervalOperatorInfo* pInfo, SExpr
|
|||
}
|
||||
if (find && pUpdated) {
|
||||
saveResultRow(pCurResult, pWinRes->groupId, pUpdated);
|
||||
setResultBufPageDirty(pInfo->aggSup.pResultBuf, &pInfo->binfo.resultRowInfo.cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2586,7 +2619,7 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc
|
|||
if (isDeletedWindow(&nextWin, tableGroupId, &pInfo->aggSup) && !chIds) {
|
||||
SPullWindowInfo pull = {.window = nextWin, .groupId = tableGroupId};
|
||||
// add pull data request
|
||||
taosArrayPush(pInfo->pPullWins, &pull);
|
||||
savePullWindow(&pull, pInfo->pPullWins);
|
||||
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
||||
addPullWindow(pInfo->pPullDataMap, &winRes, size);
|
||||
qDebug("===stream===prepare retrive %" PRId64 ", size:%d", winRes.ts, size);
|
||||
|
@ -2627,6 +2660,7 @@ static void doHashInterval(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBloc
|
|||
}
|
||||
if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pUpdated) {
|
||||
saveResultRow(pResult, tableGroupId, pUpdated);
|
||||
setResultBufPageDirty(pInfo->aggSup.pResultBuf, &pResultRowInfo->cur);
|
||||
}
|
||||
updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true);
|
||||
doApplyFunctions(pTaskInfo, pSup->pCtx, &nextWin, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols,
|
||||
|
@ -2674,14 +2708,6 @@ void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsCol
|
|||
blockDataUpdateTsWindow(pDest, 0);
|
||||
}
|
||||
|
||||
static bool needBreak(SStreamFinalIntervalOperatorInfo* pInfo) {
|
||||
int32_t size = taosArrayGetSize(pInfo->pPullWins);
|
||||
if (pInfo->pullIndex < size) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pBlock) {
|
||||
clearSpecialDataBlock(pBlock);
|
||||
int32_t size = taosArrayGetSize(array);
|
||||
|
@ -2748,6 +2774,14 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
if (pOperator->status == OP_EXEC_DONE) {
|
||||
return NULL;
|
||||
} else if (pOperator->status == OP_RES_TO_RETURN) {
|
||||
doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes);
|
||||
if (pInfo->pPullDataRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
ASSERT(IS_FINAL_OP(pInfo));
|
||||
printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
return pInfo->pPullDataRes;
|
||||
}
|
||||
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
if (pInfo->binfo.pRes->info.rows == 0) {
|
||||
pOperator->status = OP_EXEC_DONE;
|
||||
|
@ -2776,13 +2810,13 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
// process the rest of the data
|
||||
return pInfo->pUpdateRes;
|
||||
}
|
||||
doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes);
|
||||
if (pInfo->pPullDataRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
ASSERT(IS_FINAL_OP(pInfo));
|
||||
printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
return pInfo->pPullDataRes;
|
||||
}
|
||||
// doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes);
|
||||
// if (pInfo->pPullDataRes->info.rows != 0) {
|
||||
// // process the rest of the data
|
||||
// ASSERT(IS_FINAL_OP(pInfo));
|
||||
// printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
// return pInfo->pPullDataRes;
|
||||
// }
|
||||
doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes);
|
||||
if (pInfo->pDelRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
|
@ -2882,10 +2916,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
SStreamFinalIntervalOperatorInfo* pChInfo = pChildOp->info;
|
||||
setInputDataBlock(pChildOp, pChildOp->exprSupp.pCtx, pBlock, pChInfo->order, MAIN_SCAN, true);
|
||||
doHashInterval(pChildOp, pBlock, pBlock->info.groupId, NULL);
|
||||
|
||||
if (needBreak(pInfo)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2899,6 +2929,15 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
finalizeUpdatedResult(pOperator->exprSupp.numOfExprs, pInfo->aggSup.pResultBuf, pUpdated, pSup->rowEntryInfoOffset);
|
||||
initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated);
|
||||
blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
|
||||
|
||||
doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes);
|
||||
if (pInfo->pPullDataRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
ASSERT(IS_FINAL_OP(pInfo));
|
||||
printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
return pInfo->pPullDataRes;
|
||||
}
|
||||
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
if (pInfo->binfo.pRes->info.rows != 0) {
|
||||
printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
|
@ -2913,14 +2952,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
|||
return pInfo->pUpdateRes;
|
||||
}
|
||||
|
||||
doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes);
|
||||
if (pInfo->pPullDataRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
ASSERT(IS_FINAL_OP(pInfo));
|
||||
printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi");
|
||||
return pInfo->pPullDataRes;
|
||||
}
|
||||
|
||||
doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes);
|
||||
if (pInfo->pDelRes->info.rows != 0) {
|
||||
// process the rest of the data
|
||||
|
@ -4638,7 +4669,7 @@ static SSDataBlock* doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
|||
getTableScanInfo(pOperator, &iaInfo->order, &scanFlag);
|
||||
setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->order, scanFlag, true);
|
||||
doMergeAlignedIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes);
|
||||
doFilter(miaInfo->pCondition, pRes);
|
||||
doFilter(miaInfo->pCondition, pRes, NULL);
|
||||
if (pRes->info.rows >= pOperator->resultInfo.capacity) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,9 @@ static void sifFreeParam(SIFParam *param) {
|
|||
|
||||
taosArrayDestroy(param->result);
|
||||
taosMemoryFree(param->condValue);
|
||||
param->condValue = NULL;
|
||||
taosHashCleanup(param->pFilter);
|
||||
param->pFilter = NULL;
|
||||
}
|
||||
|
||||
static int32_t sifGetOperParamNum(EOperatorType ty) {
|
||||
|
@ -180,6 +182,7 @@ static int32_t sifInitJsonParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
|||
param->colId = l->colId;
|
||||
param->colValType = l->node.resType.type;
|
||||
memcpy(param->dbName, l->dbName, sizeof(l->dbName));
|
||||
if (r->literal == NULL) return TSDB_CODE_QRY_INVALID_INPUT;
|
||||
memcpy(param->colName, r->literal, strlen(r->literal));
|
||||
param->colValType = r->typeData;
|
||||
param->status = SFLT_COARSE_INDEX;
|
||||
|
@ -281,6 +284,7 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
_return:
|
||||
for (int i = 0; i < nParam; i++) sifFreeParam(¶mList[i]);
|
||||
taosMemoryFree(paramList);
|
||||
SIF_RET(code);
|
||||
}
|
||||
|
@ -381,7 +385,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
|||
.reverse = reverse,
|
||||
.filterFunc = filterFunc};
|
||||
|
||||
ret = metaFilteTableIds(arg->metaEx, ¶m, output->result);
|
||||
ret = metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -536,6 +540,7 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
|
|||
SIF_ERR_RET(sifInitOperParams(¶ms, node, ctx));
|
||||
|
||||
if (params[0].status == SFLT_NOT_INDEX && (nParam > 1 && params[1].status == SFLT_NOT_INDEX)) {
|
||||
for (int i = 0; i < nParam; i++) sifFreeParam(¶ms[i]);
|
||||
output->status = SFLT_NOT_INDEX;
|
||||
return code;
|
||||
}
|
||||
|
@ -545,17 +550,18 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
|
|||
sif_func_t operFn = sifNullFunc;
|
||||
|
||||
if (!ctx->noExec) {
|
||||
SIF_ERR_RET(sifGetOperFn(node->opType, &operFn, &output->status));
|
||||
SIF_ERR_RET(operFn(¶ms[0], nParam > 1 ? ¶ms[1] : NULL, output));
|
||||
SIF_ERR_JRET(sifGetOperFn(node->opType, &operFn, &output->status));
|
||||
SIF_ERR_JRET(operFn(¶ms[0], nParam > 1 ? ¶ms[1] : NULL, output));
|
||||
} else {
|
||||
// ugly code, refactor later
|
||||
if (nParam > 1 && params[1].status == SFLT_NOT_INDEX) {
|
||||
output->status = SFLT_NOT_INDEX;
|
||||
return code;
|
||||
}
|
||||
SIF_ERR_RET(sifGetOperFn(node->opType, &operFn, &output->status));
|
||||
SIF_ERR_JRET(sifGetOperFn(node->opType, &operFn, &output->status));
|
||||
}
|
||||
|
||||
_return:
|
||||
for (int i = 0; i < nParam; i++) sifFreeParam(¶ms[i]);
|
||||
taosMemoryFree(params);
|
||||
return code;
|
||||
}
|
||||
|
@ -708,7 +714,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
|||
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
}
|
||||
sifFreeRes(ctx.pRes);
|
||||
|
||||
|
||||
SIF_RET(code);
|
||||
}
|
||||
|
||||
|
@ -738,6 +744,7 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status) {
|
|||
|
||||
sifFreeParam(res);
|
||||
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
taosHashCleanup(ctx.pRes);
|
||||
|
||||
SIF_RET(code);
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok
|
|||
if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) {
|
||||
COPY_STRING_FORM_ID_TOKEN(tempTable->table.tableAlias, pTableAlias);
|
||||
} else {
|
||||
sprintf(tempTable->table.tableAlias, "%p", tempTable);
|
||||
taosRandStr(tempTable->table.tableAlias, 8);
|
||||
}
|
||||
if (QUERY_NODE_SELECT_STMT == nodeType(pSubquery)) {
|
||||
strcpy(((SSelectStmt*)pSubquery)->stmtName, tempTable->table.tableAlias);
|
||||
|
|
|
@ -739,12 +739,12 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo*
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname,
|
||||
SArray* tagName) {
|
||||
static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, SArray* tagName, uint8_t tagNum) {
|
||||
pTbReq->type = TD_CHILD_TABLE;
|
||||
pTbReq->name = strdup(tname);
|
||||
pTbReq->ctb.suid = suid;
|
||||
if (sname) pTbReq->ctb.name = strdup(sname);
|
||||
pTbReq->ctb.tagNum = tagNum;
|
||||
if(sname) pTbReq->ctb.name = strdup(sname);
|
||||
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
||||
pTbReq->ctb.tagName = taosArrayDup(tagName);
|
||||
pTbReq->commentLen = -1;
|
||||
|
@ -903,7 +903,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16
|
|||
if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) {
|
||||
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||
}
|
||||
val->pData = pToken->z;
|
||||
val->pData = strdup(pToken->z);
|
||||
val->nData = pToken->n;
|
||||
break;
|
||||
}
|
||||
|
@ -969,10 +969,9 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
|||
}
|
||||
|
||||
SSchema* pTagSchema = &pSchema[pCxt->tags.boundColumns[i]];
|
||||
char* tmpTokenBuf = taosMemoryCalloc(1, sToken.n); // todo this can be optimize with parse column
|
||||
char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // todo this can be optimize with parse column
|
||||
code = checkAndTrimValue(&sToken, tmpTokenBuf, &pCxt->msg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(tmpTokenBuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -982,7 +981,6 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
|||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
if (sToken.n > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msg, "json string too long than 4095", sToken.z);
|
||||
taosMemoryFree(tmpTokenBuf);
|
||||
goto end;
|
||||
}
|
||||
if (isNullValue(pTagSchema->type, &sToken)) {
|
||||
|
@ -990,7 +988,6 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
|||
} else {
|
||||
code = parseJsontoTagData(sToken.z, pTagVals, &pTag, &pCxt->msg);
|
||||
}
|
||||
taosMemoryFree(tmpTokenBuf);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
@ -999,12 +996,9 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
|||
STagVal val = {0};
|
||||
code = parseTagToken(&pCxt->pSql, &sToken, pTagSchema, precision, &val, &pCxt->msg);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
taosMemoryFree(tmpTokenBuf);
|
||||
goto end;
|
||||
}
|
||||
if (pTagSchema->type != TSDB_DATA_TYPE_BINARY) {
|
||||
taosMemoryFree(tmpTokenBuf);
|
||||
}
|
||||
|
||||
taosArrayPush(pTagVals, &val);
|
||||
}
|
||||
}
|
||||
|
@ -1018,12 +1012,12 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
|||
goto end;
|
||||
}
|
||||
|
||||
buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName);
|
||||
buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName, pCxt->pTableMeta->tableInfo.numOfTags);
|
||||
|
||||
end:
|
||||
for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) {
|
||||
STagVal* p = (STagVal*)taosArrayGet(pTagVals, i);
|
||||
if (p->type == TSDB_DATA_TYPE_NCHAR) {
|
||||
if (IS_VAR_DATA_TYPE(p->type)) {
|
||||
taosMemoryFree(p->pData);
|
||||
}
|
||||
}
|
||||
|
@ -1902,7 +1896,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
}
|
||||
|
||||
SVCreateTbReq tbReq = {0};
|
||||
buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName, tagName);
|
||||
buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName, tagName, pDataBlock->pTableMeta->tableInfo.numOfTags);
|
||||
code = buildCreateTbMsg(pDataBlock, &tbReq);
|
||||
tdDestroySVCreateTbReq(&tbReq);
|
||||
|
||||
|
@ -2338,7 +2332,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
|
|||
return ret;
|
||||
}
|
||||
|
||||
buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName);
|
||||
buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, pTableMeta->tableInfo.numOfTags);
|
||||
taosArrayDestroy(tagName);
|
||||
|
||||
smlHandle->tableExecHandle.createTblReq.ctb.name = taosMemoryMalloc(sTableNameLen + 1);
|
||||
|
|
|
@ -1220,6 +1220,14 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu
|
|||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t getMultiResFuncNum(SNodeList* pParameterList) {
|
||||
if (1 == LIST_LENGTH(pParameterList)) {
|
||||
return isStar(nodesListGetNode(pParameterList, 0)) ? 2 : 1;
|
||||
}
|
||||
return LIST_LENGTH(pParameterList);
|
||||
}
|
||||
|
||||
static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
||||
if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) {
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt;
|
||||
|
@ -1229,7 +1237,9 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
|||
pSelect->hasMultiRowsFunc = pSelect->hasMultiRowsFunc ? true : fmIsMultiRowsFunc(pFunc->funcId);
|
||||
if (fmIsSelectFunc(pFunc->funcId)) {
|
||||
pSelect->hasSelectFunc = true;
|
||||
++(pSelect->selectFuncNum);
|
||||
pSelect->selectFuncNum += (fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId))
|
||||
? getMultiResFuncNum(pFunc->pParameterList)
|
||||
: 1;
|
||||
} else if (fmIsVectorFunc(pFunc->funcId)) {
|
||||
pSelect->hasOtherVectorFunc = true;
|
||||
}
|
||||
|
@ -2134,6 +2144,15 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t translateFillValues(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||
if (NULL == pSelect->pWindow || QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow) ||
|
||||
NULL == ((SIntervalWindowNode*)pSelect->pWindow)->pFill) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
SFillNode* pFill = (SFillNode*)((SIntervalWindowNode*)pSelect->pWindow)->pFill;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||
pCxt->currClause = SQL_CLAUSE_SELECT;
|
||||
int32_t code = translateExprList(pCxt, pSelect->pProjectionList);
|
||||
|
@ -2143,6 +2162,9 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = checkExprListForGroupBy(pCxt, pSelect, pSelect->pProjectionList);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = translateFillValues(pCxt, pSelect);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -5537,7 +5559,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
|
||||
static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt,
|
||||
const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo,
|
||||
SArray* tagName) {
|
||||
SArray* tagName, uint8_t tagNum) {
|
||||
// char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||
// SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId};
|
||||
// strcpy(name.dbname, pStmt->dbName);
|
||||
|
@ -5554,6 +5576,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S
|
|||
req.commentLen = -1;
|
||||
}
|
||||
req.ctb.suid = suid;
|
||||
req.ctb.tagNum = tagNum;
|
||||
req.ctb.name = strdup(sTableNmae);
|
||||
req.ctb.pTag = (uint8_t*)pTag;
|
||||
req.ctb.tagName = taosArrayDup(tagName);
|
||||
|
@ -5805,7 +5828,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid,
|
||||
pStmt->useTableName, &info, tagName);
|
||||
pStmt->useTableName, &info, tagName, pSuperTableMeta->tableInfo.numOfTags);
|
||||
}
|
||||
|
||||
taosArrayDestroy(tagName);
|
||||
|
@ -6053,7 +6076,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
|||
pReq->pTagVal = (uint8_t*)pTag;
|
||||
pStmt->pVal->datum.p = (char*)pTag; // for free
|
||||
} else {
|
||||
pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type);
|
||||
pReq->isNull = pStmt->pVal->isNull;
|
||||
pReq->nTagVal = pStmt->pVal->node.resType.bytes;
|
||||
pReq->pTagVal = nodesGetValueFromNode(pStmt->pVal);
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SInterva
|
|||
(NULL != pInterval->pSliding ? ((SValueNode*)pInterval->pSliding)->unit : pWindow->intervalUnit);
|
||||
pWindow->windowAlgo = pCxt->pPlanCxt->streamQuery ? INTERVAL_ALGO_STREAM_SINGLE : INTERVAL_ALGO_HASH;
|
||||
pWindow->node.groupAction = GROUP_ACTION_KEEP;
|
||||
pWindow->node.requireDataOrder = DATA_ORDER_LEVEL_IN_BLOCK;
|
||||
pWindow->node.requireDataOrder = pSelect->hasTimeLineFunc ? DATA_ORDER_LEVEL_IN_GROUP : DATA_ORDER_LEVEL_IN_BLOCK;
|
||||
pWindow->node.resultDataOrder = DATA_ORDER_LEVEL_IN_GROUP;
|
||||
|
||||
pWindow->pTspk = nodesCloneNode(pInterval->pCol);
|
||||
|
|
|
@ -1607,6 +1607,28 @@ static bool eliminateProjOptCanUseNewChildTargets(SLogicNode* pChild, SNodeList*
|
|||
return cxt.canUse;
|
||||
}
|
||||
|
||||
static void alignProjectionWithTarget(SLogicNode* pNode) {
|
||||
if (QUERY_NODE_LOGIC_PLAN_PROJECT != pNode->type) {
|
||||
return;
|
||||
}
|
||||
|
||||
SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode;
|
||||
SNode* pProjection = NULL;
|
||||
FOREACH(pProjection, pProjectNode->pProjections) {
|
||||
SNode* pTarget = NULL;
|
||||
bool keep = false;
|
||||
FOREACH(pTarget, pNode->pTargets) {
|
||||
if (0 == strcmp(((SColumnNode*)pProjection)->node.aliasName, ((SColumnNode*)pTarget)->colName)) {
|
||||
keep = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!keep) {
|
||||
nodesListErase(pProjectNode->pProjections, cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan,
|
||||
SProjectLogicNode* pProjectNode) {
|
||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
||||
|
@ -1634,6 +1656,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
NODES_CLEAR_LIST(pProjectNode->node.pChildren);
|
||||
nodesDestroyNode((SNode*)pProjectNode);
|
||||
alignProjectionWithTarget(pChild);
|
||||
}
|
||||
pCxt->optimized = true;
|
||||
return code;
|
||||
|
|
|
@ -231,7 +231,6 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) {
|
|||
int32_t code = tmsgPutToQueue(&mgmt->msgCb, QUERY_QUEUE, &pNewMsg);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
QW_SCH_TASK_ELOG("put query continue msg to queue failed, vgId:%d, code:%s", mgmt->nodeId, tstrerror(code));
|
||||
rpcFreeCont(req);
|
||||
QW_ERR_RET(code);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,4 +13,4 @@ target_link_libraries(scalar
|
|||
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
endif(${BUILD_TEST})
|
||||
|
|
|
@ -735,15 +735,13 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
|
|||
|
||||
res->translate = true;
|
||||
|
||||
res->node.resType.type = output.columnData->info.type;
|
||||
res->node.resType.bytes = output.columnData->info.bytes;
|
||||
res->node.resType.scale = output.columnData->info.scale;
|
||||
res->node.resType.precision = output.columnData->info.precision;
|
||||
if (colDataIsNull_s(output.columnData, 0)) {
|
||||
res->isNull = true;
|
||||
//res->node.resType.type = TSDB_DATA_TYPE_NULL;
|
||||
//res->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_NULL].bytes;
|
||||
} else {
|
||||
res->node.resType.type = output.columnData->info.type;
|
||||
res->node.resType.bytes = output.columnData->info.bytes;
|
||||
res->node.resType.scale = output.columnData->info.scale;
|
||||
res->node.resType.precision = output.columnData->info.precision;
|
||||
int32_t type = output.columnData->info.type;
|
||||
if (type == TSDB_DATA_TYPE_JSON){
|
||||
int32_t len = getJsonValueLen(output.columnData->pData);
|
||||
|
@ -826,16 +824,11 @@ EDealRes sclRewriteOperator(SNode** pNode, SScalarCtx *ctx) {
|
|||
|
||||
res->translate = true;
|
||||
|
||||
res->node.resType = node->node.resType;
|
||||
if (colDataIsNull_s(output.columnData, 0)) {
|
||||
if(node->node.resType.type != TSDB_DATA_TYPE_JSON){
|
||||
res->node.resType.type = TSDB_DATA_TYPE_NULL;
|
||||
res->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_NULL].bytes;
|
||||
}else{
|
||||
res->node.resType = node->node.resType;
|
||||
res->isNull = true;
|
||||
}
|
||||
} else {
|
||||
res->isNull = true;
|
||||
res->node.resType = node->node.resType;
|
||||
} else {
|
||||
int32_t type = output.columnData->info.type;
|
||||
if (IS_VAR_DATA_TYPE(type)) { // todo refactor
|
||||
res->datum.p = output.columnData->pData;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "tdatablock.h"
|
||||
#include "tjson.h"
|
||||
#include "ttime.h"
|
||||
#include "cJSON.h"
|
||||
#include "vnode.h"
|
||||
|
||||
typedef float (*_float_fn)(float);
|
||||
|
@ -1722,15 +1723,10 @@ int32_t winEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
|
||||
ASSERT(inputNum == 1);
|
||||
|
||||
SMetaReader mr = {0};
|
||||
metaReaderInit(&mr, pInput->param, 0);
|
||||
|
||||
uint64_t uid = *(uint64_t *)colDataGetData(pInput->columnData, 0);
|
||||
metaGetTableEntryByUid(&mr, uid);
|
||||
|
||||
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
STR_TO_VARSTR(str, mr.me.name);
|
||||
metaReaderClear(&mr);
|
||||
metaGetTableNameByUid(pInput->param, uid, str);
|
||||
|
||||
for(int32_t i = 0; i < pInput->numOfRows; ++i) {
|
||||
colDataAppend(pOutput->columnData, pOutput->numOfRows + i, str, false);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
enable_testing()
|
||||
|
||||
add_subdirectory(filter)
|
||||
#add_subdirectory(filter)
|
||||
add_subdirectory(scalar)
|
||||
|
|
|
@ -9,7 +9,7 @@ IF(NOT TD_DARWIN)
|
|||
ADD_EXECUTABLE(filterTest ${SOURCE_LIST})
|
||||
TARGET_LINK_LIBRARIES(
|
||||
filterTest
|
||||
PUBLIC os util common gtest qcom function nodes scalar
|
||||
PUBLIC os util common gtest qcom function nodes scalar parser catalog transport
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(
|
||||
|
@ -17,4 +17,4 @@ IF(NOT TD_DARWIN)
|
|||
PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar/"
|
||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/scalar/inc"
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "scalar.h"
|
||||
#include "stub.h"
|
||||
#include "taos.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tdef.h"
|
||||
#include "tlog.h"
|
||||
#include "tvariant.h"
|
||||
|
|
|
@ -300,6 +300,8 @@ int transSendResponse(const STransMsg* msg);
|
|||
int transRegisterMsg(const STransMsg* msg);
|
||||
int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn);
|
||||
|
||||
int transGetSockDebugInfo(struct sockaddr* sockname, char* dst);
|
||||
|
||||
int64_t transAllocHandle();
|
||||
|
||||
void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
|
||||
|
|
Binary file not shown.
|
@ -52,4 +52,4 @@ void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg) { (*defaultMsgCb.registerBrokenLin
|
|||
|
||||
void tmsgReleaseHandle(SRpcHandleInfo* pHandle, int8_t type) { (*defaultMsgCb.releaseHandleFp)(pHandle, type); }
|
||||
|
||||
void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.reportStartupFp)(name, desc); }
|
||||
void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.reportStartupFp)(name, desc); }
|
||||
|
|
|
@ -37,9 +37,11 @@ typedef struct SCliConn {
|
|||
uint32_t port;
|
||||
|
||||
SDelayTask* task;
|
||||
|
||||
// debug and log info
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_in localAddr;
|
||||
char src[32];
|
||||
char dst[32];
|
||||
|
||||
} SCliConn;
|
||||
|
||||
typedef struct SCliMsg {
|
||||
|
@ -95,6 +97,14 @@ static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port);
|
|||
static void addConnToPool(void* pool, SCliConn* conn);
|
||||
static void doCloseIdleConn(void* param);
|
||||
|
||||
static int sockDebugInfo(struct sockaddr* sockname, char* dst) {
|
||||
struct sockaddr_in addr = *(struct sockaddr_in*)sockname;
|
||||
|
||||
char buf[20] = {0};
|
||||
int r = uv_ip4_name(&addr, (char*)buf, sizeof(buf));
|
||||
sprintf(dst, "%s:%d", buf, ntohs(addr.sin_port));
|
||||
return r;
|
||||
}
|
||||
// register timer in each thread to clear expire conn
|
||||
// static void cliTimeoutCb(uv_timer_t* handle);
|
||||
// alloc buf for recv
|
||||
|
@ -196,6 +206,10 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
|
|||
CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle); \
|
||||
transClearBuffer(&conn->readBuf); \
|
||||
transFreeMsg(transContFromHead((char*)head)); \
|
||||
if (transQueueSize(&conn->cliMsgs) > 0 && ahandle == 0) { \
|
||||
SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, 0); \
|
||||
if (cliMsg->type == Release) return; \
|
||||
} \
|
||||
tDebug("%s conn %p receive release request, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn)); \
|
||||
if (T_REF_VAL_GET(conn) > 1) { \
|
||||
transUnrefCliHandle(conn); \
|
||||
|
@ -359,9 +373,9 @@ void cliHandleResp(SCliConn* conn) {
|
|||
}
|
||||
|
||||
STraceId* trace = &transMsg.info.traceId;
|
||||
tGTrace("%s conn %p %s received from %s:%d, local info:%s:%d, msg size:%d, code:0x%x", CONN_GET_INST_LABEL(conn),
|
||||
conn, TMSG_INFO(pHead->msgType), taosInetNtoa(conn->addr.sin_addr), ntohs(conn->addr.sin_port),
|
||||
taosInetNtoa(conn->localAddr.sin_addr), ntohs(conn->localAddr.sin_port), transMsg.contLen, transMsg.code);
|
||||
|
||||
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d, code:0x%x", CONN_GET_INST_LABEL(conn), conn,
|
||||
TMSG_INFO(pHead->msgType), conn->dst, conn->src, transMsg.contLen, transMsg.code);
|
||||
|
||||
if (pCtx == NULL && CONN_NO_PERSIST_BY_APP(conn)) {
|
||||
tDebug("%s except, conn %p read while cli ignore it", CONN_GET_INST_LABEL(conn), conn);
|
||||
|
@ -737,9 +751,8 @@ void cliSend(SCliConn* pConn) {
|
|||
uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
|
||||
|
||||
STraceId* trace = &pMsg->info.traceId;
|
||||
tGTrace("%s conn %p %s is sent to %s:%d, local info %s:%d", CONN_GET_INST_LABEL(pConn), pConn,
|
||||
TMSG_INFO(pHead->msgType), taosInetNtoa(pConn->addr.sin_addr), ntohs(pConn->addr.sin_port),
|
||||
taosInetNtoa(pConn->localAddr.sin_addr), ntohs(pConn->localAddr.sin_port));
|
||||
tGTrace("%s conn %p %s is sent to %s, local info %s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType),
|
||||
pConn->dst, pConn->src);
|
||||
|
||||
if (pHead->persist == 1) {
|
||||
CONN_SET_PERSIST_BY_APP(pConn);
|
||||
|
@ -760,11 +773,16 @@ void cliConnCb(uv_connect_t* req, int status) {
|
|||
cliHandleExcept(pConn);
|
||||
return;
|
||||
}
|
||||
int addrlen = sizeof(pConn->addr);
|
||||
uv_tcp_getpeername((uv_tcp_t*)pConn->stream, (struct sockaddr*)&pConn->addr, &addrlen);
|
||||
// int addrlen = sizeof(pConn->addr);
|
||||
struct sockaddr peername, sockname;
|
||||
int addrlen = sizeof(peername);
|
||||
|
||||
addrlen = sizeof(pConn->localAddr);
|
||||
uv_tcp_getsockname((uv_tcp_t*)pConn->stream, (struct sockaddr*)&pConn->localAddr, &addrlen);
|
||||
uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen);
|
||||
transGetSockDebugInfo(&peername, pConn->dst);
|
||||
|
||||
addrlen = sizeof(sockname);
|
||||
uv_tcp_getsockname((uv_tcp_t*)pConn->stream, &sockname, &addrlen);
|
||||
transGetSockDebugInfo(&sockname, pConn->src);
|
||||
|
||||
tTrace("%s conn %p connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn);
|
||||
assert(pConn->stream == req->handle);
|
||||
|
|
|
@ -102,7 +102,14 @@ void transFreeMsg(void* msg) {
|
|||
}
|
||||
taosMemoryFree((char*)msg - sizeof(STransMsgHead));
|
||||
}
|
||||
int transGetSockDebugInfo(struct sockaddr* sockname, char* dst) {
|
||||
struct sockaddr_in addr = *(struct sockaddr_in*)sockname;
|
||||
|
||||
char buf[20] = {0};
|
||||
int r = uv_ip4_name(&addr, (char*)buf, sizeof(buf));
|
||||
sprintf(dst, "%s:%d", buf, ntohs(addr.sin_port));
|
||||
return r;
|
||||
}
|
||||
int transInitBuffer(SConnBuffer* buf) {
|
||||
transClearBuffer(buf);
|
||||
return 0;
|
||||
|
|
|
@ -43,9 +43,13 @@ typedef struct SSvrConn {
|
|||
SSvrRegArg regArg;
|
||||
bool broken; // conn broken;
|
||||
|
||||
ConnStatus status;
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr_in localAddr;
|
||||
ConnStatus status;
|
||||
|
||||
uint32_t clientIp;
|
||||
uint16_t port;
|
||||
|
||||
char src[32];
|
||||
char dst[32];
|
||||
|
||||
int64_t refId;
|
||||
int spi;
|
||||
|
@ -149,34 +153,35 @@ static void* transAcceptThread(void* arg);
|
|||
static bool addHandleToWorkloop(SWorkThrd* pThrd, char* pipeName);
|
||||
static bool addHandleToAcceptloop(void* arg);
|
||||
|
||||
#define CONN_SHOULD_RELEASE(conn, head) \
|
||||
do { \
|
||||
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
|
||||
reallocConnRef(conn); \
|
||||
tTrace("conn %p received release request", conn); \
|
||||
\
|
||||
STraceId traceId = head->traceId; \
|
||||
conn->status = ConnRelease; \
|
||||
transClearBuffer(&conn->readBuf); \
|
||||
transFreeMsg(transContFromHead((char*)head)); \
|
||||
\
|
||||
STransMsg tmsg = {.code = 0, .info.handle = (void*)conn, .info.traceId = traceId, .info.ahandle = NULL}; \
|
||||
SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg)); \
|
||||
srvMsg->msg = tmsg; \
|
||||
srvMsg->type = Release; \
|
||||
srvMsg->pConn = conn; \
|
||||
if (!transQueuePush(&conn->srvMsgs, srvMsg)) { \
|
||||
return; \
|
||||
} \
|
||||
if (conn->regArg.init) { \
|
||||
tTrace("conn %p release, notify server app", conn); \
|
||||
STrans* pTransInst = conn->pTransInst; \
|
||||
(*pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL); \
|
||||
memset(&conn->regArg, 0, sizeof(conn->regArg)); \
|
||||
} \
|
||||
uvStartSendRespInternal(srvMsg); \
|
||||
return; \
|
||||
} \
|
||||
#define CONN_SHOULD_RELEASE(conn, head) \
|
||||
do { \
|
||||
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
|
||||
reallocConnRef(conn); \
|
||||
tTrace("conn %p received release request", conn); \
|
||||
\
|
||||
STraceId traceId = head->traceId; \
|
||||
conn->status = ConnRelease; \
|
||||
transClearBuffer(&conn->readBuf); \
|
||||
transFreeMsg(transContFromHead((char*)head)); \
|
||||
\
|
||||
STransMsg tmsg = { \
|
||||
.code = 0, .info.handle = (void*)conn, .info.traceId = traceId, .info.ahandle = (void*)0x9527}; \
|
||||
SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg)); \
|
||||
srvMsg->msg = tmsg; \
|
||||
srvMsg->type = Release; \
|
||||
srvMsg->pConn = conn; \
|
||||
if (!transQueuePush(&conn->srvMsgs, srvMsg)) { \
|
||||
return; \
|
||||
} \
|
||||
if (conn->regArg.init) { \
|
||||
tTrace("conn %p release, notify server app", conn); \
|
||||
STrans* pTransInst = conn->pTransInst; \
|
||||
(*pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL); \
|
||||
memset(&conn->regArg, 0, sizeof(conn->regArg)); \
|
||||
} \
|
||||
uvStartSendRespInternal(srvMsg); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SRV_RELEASE_UV(loop) \
|
||||
|
@ -247,15 +252,11 @@ static void uvHandleReq(SSvrConn* pConn) {
|
|||
if (pConn->status == ConnNormal && pHead->noResp == 0) {
|
||||
transRefSrvHandle(pConn);
|
||||
|
||||
tGTrace("%s conn %p %s received from %s:%d, local info:%s:%d, msg size:%d", transLabel(pTransInst), pConn,
|
||||
TMSG_INFO(transMsg.msgType), taosInetNtoa(pConn->addr.sin_addr), ntohs(pConn->addr.sin_port),
|
||||
taosInetNtoa(pConn->localAddr.sin_addr), ntohs(pConn->localAddr.sin_port), transMsg.contLen);
|
||||
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d", transLabel(pTransInst), pConn,
|
||||
TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen);
|
||||
} else {
|
||||
tGTrace("%s conn %p %s received from %s:%d, local info:%s:%d, msg size:%d, resp:%d, code:%d",
|
||||
transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), taosInetNtoa(pConn->addr.sin_addr),
|
||||
ntohs(pConn->addr.sin_port), taosInetNtoa(pConn->localAddr.sin_addr), ntohs(pConn->localAddr.sin_port),
|
||||
transMsg.contLen, pHead->noResp, transMsg.code);
|
||||
// no ref here
|
||||
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d, resp:%d, code:%d", transLabel(pTransInst),
|
||||
pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen, pHead->noResp, transMsg.code);
|
||||
}
|
||||
|
||||
// pHead->noResp = 1,
|
||||
|
@ -277,14 +278,13 @@ static void uvHandleReq(SSvrConn* pConn) {
|
|||
|
||||
// set up conn info
|
||||
SRpcConnInfo* pConnInfo = &(transMsg.info.conn);
|
||||
pConnInfo->clientIp = (uint32_t)(pConn->addr.sin_addr.s_addr);
|
||||
pConnInfo->clientPort = ntohs(pConn->addr.sin_port);
|
||||
pConnInfo->clientIp = pConn->clientIp;
|
||||
pConnInfo->clientPort = pConn->port;
|
||||
tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user));
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), pConn->refId);
|
||||
|
||||
(*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
|
||||
// uv_timer_start(&pConn->pTimer, uvHandleActivityTimeout, pRpc->idleTime * 10000, 0);
|
||||
}
|
||||
|
||||
void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
|
||||
|
@ -396,11 +396,11 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
|
|||
|
||||
if (pConn->status == ConnNormal) {
|
||||
pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType);
|
||||
if (smsg->type == Release) pHead->msgType = 0;
|
||||
} else {
|
||||
if (smsg->type == Release) {
|
||||
pHead->msgType = 0;
|
||||
pConn->status = ConnNormal;
|
||||
|
||||
destroyConnRegArg(pConn);
|
||||
transUnrefSrvHandle(pConn);
|
||||
} else {
|
||||
|
@ -417,9 +417,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
|
|||
|
||||
STrans* pTransInst = pConn->pTransInst;
|
||||
STraceId* trace = &pMsg->info.traceId;
|
||||
tGTrace("%s conn %p %s is sent to %s:%d, local info:%s:%d, msglen:%d", transLabel(pTransInst), pConn,
|
||||
TMSG_INFO(pHead->msgType), taosInetNtoa(pConn->addr.sin_addr), ntohs(pConn->addr.sin_port),
|
||||
taosInetNtoa(pConn->localAddr.sin_addr), ntohs(pConn->localAddr.sin_port), len);
|
||||
tGTrace("%s conn %p %s is sent to %s, local info:%s, msglen:%d", transLabel(pTransInst), pConn,
|
||||
TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len);
|
||||
pHead->msgLen = htonl(len);
|
||||
|
||||
wb->base = msg;
|
||||
|
@ -645,20 +644,26 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
|
|||
uv_fileno((const uv_handle_t*)pConn->pTcp, &fd);
|
||||
tTrace("conn %p created, fd:%d", pConn, fd);
|
||||
|
||||
int addrlen = sizeof(pConn->addr);
|
||||
if (0 != uv_tcp_getpeername(pConn->pTcp, (struct sockaddr*)&pConn->addr, &addrlen)) {
|
||||
struct sockaddr peername, sockname;
|
||||
int addrlen = sizeof(peername);
|
||||
if (0 != uv_tcp_getpeername(pConn->pTcp, (struct sockaddr*)&peername, &addrlen)) {
|
||||
tError("conn %p failed to get peer info", pConn);
|
||||
transUnrefSrvHandle(pConn);
|
||||
return;
|
||||
}
|
||||
transGetSockDebugInfo(&peername, pConn->dst);
|
||||
|
||||
addrlen = sizeof(pConn->localAddr);
|
||||
if (0 != uv_tcp_getsockname(pConn->pTcp, (struct sockaddr*)&pConn->localAddr, &addrlen)) {
|
||||
addrlen = sizeof(sockname);
|
||||
if (0 != uv_tcp_getsockname(pConn->pTcp, (struct sockaddr*)&sockname, &addrlen)) {
|
||||
tError("conn %p failed to get local info", pConn);
|
||||
transUnrefSrvHandle(pConn);
|
||||
return;
|
||||
}
|
||||
transGetSockDebugInfo(&sockname, pConn->src);
|
||||
struct sockaddr_in addr = *(struct sockaddr_in*)&sockname;
|
||||
|
||||
pConn->clientIp = addr.sin_addr.s_addr;
|
||||
pConn->port = ntohs(addr.sin_port);
|
||||
uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -21,7 +21,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead);
|
|||
static int32_t walSkipFetchBodyNew(SWalReader *pRead);
|
||||
|
||||
SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond) {
|
||||
SWalReader *pRead = taosMemoryMalloc(sizeof(SWalReader));
|
||||
SWalReader *pRead = taosMemoryCalloc(1, sizeof(SWalReader));
|
||||
if (pRead == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
|
@ -75,6 +75,7 @@ int32_t walNextValidMsg(SWalReader *pRead) {
|
|||
|
||||
wDebug("vgId:%d wal start to fetch, ver %ld, last ver %ld commit ver %ld, applied ver %ld, end ver %ld",
|
||||
pRead->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer, endVer);
|
||||
pRead->curStopped = 0;
|
||||
while (fetchVer <= endVer) {
|
||||
if (walFetchHeadNew(pRead, fetchVer) < 0) {
|
||||
return -1;
|
||||
|
@ -93,6 +94,7 @@ int32_t walNextValidMsg(SWalReader *pRead) {
|
|||
ASSERT(fetchVer == pRead->curVersion);
|
||||
}
|
||||
}
|
||||
pRead->curStopped = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -221,6 +223,8 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
|
|||
int64_t contLen;
|
||||
bool seeked = false;
|
||||
|
||||
wDebug("vgId:%d, wal starts to fetch head %d", pRead->pWal->cfg.vgId, fetchVer);
|
||||
|
||||
if (pRead->curInvalid || pRead->curVersion != fetchVer) {
|
||||
if (walReadSeekVer(pRead, fetchVer) < 0) {
|
||||
ASSERT(0);
|
||||
|
@ -257,6 +261,8 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
|
|||
SWalCont *pReadHead = &pRead->pHead->head;
|
||||
int64_t ver = pReadHead->version;
|
||||
|
||||
wDebug("vgId:%d, wal starts to fetch body %ld", pRead->pWal->cfg.vgId, ver);
|
||||
|
||||
if (pRead->capacity < pReadHead->bodyLen) {
|
||||
void *ptr = taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + pReadHead->bodyLen);
|
||||
if (ptr == NULL) {
|
||||
|
@ -300,8 +306,8 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
wDebug("version %ld is fetched, cursor advance", ver);
|
||||
pRead->curVersion = ver + 1;
|
||||
wDebug("version advance to %ld, fetch body", pRead->curVersion);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,17 +45,35 @@ STaosError errors[] = {
|
|||
{.val = 0, .str = "success"},
|
||||
#endif
|
||||
|
||||
// rpc
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_AUTH_FAILURE, "Authentication failure")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_REDIRECT, "Redirect")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_UNAVAIL, "Unable to establish connection")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQDN")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken")
|
||||
|
||||
//common & util
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_ACTION_IN_PROGRESS, "Action in progress")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_APP_ERROR, "Unexpected generic error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_APP_NOT_READY, "Database not ready")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "Out of Memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_INVALID_ID, "Invalid Ref ID")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_APP_ERROR, "Unexpected generic error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_ACTION_IN_PROGRESS, "Action in progress")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RANGE, "Out of range")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Shared memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid message")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG_LEN, "Invalid message len")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, "Invalid option")
|
||||
|
@ -63,11 +81,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_JSON_FORMAT, "Invalid json format")
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_NUMBER, "Invalid version number")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_STRING, "Invalid version string")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VERSION_NOT_COMPATIBLE, "Version not compatible")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_COMPRESS_ERROR, "Failed to compress msg")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization")
|
||||
|
@ -78,21 +93,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_TIMESTAMP, "Invalid timestamp for
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_DECODE_ERROR, "Msg decode error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Unsynced time")
|
||||
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_INVALID_ID, "Invalid Ref ID")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
||||
|
||||
// rpc
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_REDIRECT, "Redirect")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_AUTH_FAILURE, "Authentication failure")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_UNAVAIL, "Unable to establish connection")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken")
|
||||
|
||||
//client
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
|
||||
|
@ -140,16 +140,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_NO_EXEC_NODE, "No available executio
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_NOT_STABLE_ERROR, "Table is not a super table")
|
||||
|
||||
// mnode-common
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_APP_ERROR, "Mnode internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NOT_READY, "Mnode not ready")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_RIGHTS, "Insufficient privilege for operation")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_DISABLED, "User is disabled")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_APP_ERROR, "Mnode internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CONNECTION, "Invalid message connection")
|
||||
|
||||
// mnode-show
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SHOWOBJ, "Data expired")
|
||||
|
||||
// mnode-profile
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_QUERY_ID, "Invalid query id")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_ID, "Invalid stream id")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CONN_ID, "Invalid connection id")
|
||||
|
@ -158,14 +152,13 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_FAILED_TO_CONFIG_SYNC, "failed to config sync
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FAILED_TO_START_SYNC, "failed to start sync")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FAILED_TO_CREATE_DIR, "failed to create mnode dir")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FAILED_TO_INIT_STEP, "failed to init components")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_DISABLED, "User is disabled")
|
||||
|
||||
// mnode-sdb
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_APP_ERROR, "Unexpected generic error in sdb")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_ALREADY_THERE, "Object already there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_NOT_THERE, "Object not there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_CREATING, "Object is creating")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_DROPPING, "Object is dropping")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_APP_ERROR, "Unexpected generic error in sdb")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_TABLE_TYPE, "Invalid table type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_NOT_THERE, "Object not there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_KEY_TYPE, "Invalid key type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_ACTION_TYPE, "Invalid action type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_STATUS_TYPE, "Invalid status type")
|
||||
|
@ -173,18 +166,68 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_DATA_VER, "Invalid raw data vers
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_DATA_LEN, "Invalid raw data len")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_DATA_CONTENT, "Invalid raw data content")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_INVALID_WAl_VER, "Invalid wal version")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_CREATING, "Object is creating")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SDB_OBJ_DROPPING, "Object is dropping")
|
||||
|
||||
// mnode-dnode
|
||||
// mnode-dnode-part1
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ALREADY_EXIST, "Dnode already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, "Dnode does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DNODES, "Too many dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_EXIST, "Vgroup does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_CANT_DROP_LEADER, "Cannot drop mnode which is leader")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_DNODES, "Out of dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE, "No enough memory in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CLUSTER_CFG, "Cluster cfg inconsistent")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_IN_DNODE, "Vgroup not in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE, "Vgroup already in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CLUSTER_ID, "Cluster id not match")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_CFG, "Invalid dnode cfg")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_EP, "Invalid dnode end point")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_ID, "Invalid dnode id")
|
||||
|
||||
// mnode-acct
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, "Account already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT_OPTION, "Invalid account options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_EXPIRED, "Account authorization has expired")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_NOT_EXIST, "Invalid account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_ACCTS, "Too many accounts")
|
||||
|
||||
// mnode-user
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_ALREADY_EXIST, "User already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_EXIST, "Invalid user")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ALTER_OPER, "Invalid alter operation")
|
||||
|
||||
// mnode-stable-part1
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_ALREADY_EXIST, "STable already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_NOT_EXIST, "STable not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_TAGS, "Too many tags")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_COLUMNS, "Too many columns")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_ALREADY_EXIST, "Tag already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_NOT_EXIST, "Tag does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_ALREADY_EXIST, "Column already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_NOT_EXIST, "Column does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STB_OPTION, "Invalid stable options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ROW_BYTES, "Invalid row bytes")
|
||||
|
||||
// mnode-func
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_NAME, "Invalid func name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_CODE, "Invalid func code")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FUNC_ALREADY_EXIST, "Func already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FUNC_NOT_EXIST, "Func not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
|
||||
|
||||
// mnode-db
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_SELECTED, "Database not specified or available")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_ALREADY_EXIST, "Database already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION, "Invalid database options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB, "Invalid database name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DATABASES, "Too many databases for account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_EXIST, "Database not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_ACCT, "Invalid database account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_OPTION_UNCHANGED, "Database options not changed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_INDEX_NOT_EXIST, "Index not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table name")
|
||||
|
||||
// mnode-node
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists")
|
||||
|
@ -197,77 +240,27 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_ALREADY_EXIST, "Bnode already exists"
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_NOT_EXIST, "Bnode not there")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_FEW_MNODES, "The replica of mnode cannot less than 1")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_MNODES, "The replica of mnode cannot exceed 3")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_CANT_DROP_LEADER, "Cannot drop mnode which is leader")
|
||||
|
||||
// mnode-acct
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, "Account already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_NOT_EXIST, "Invalid account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_ACCTS, "Too many accounts")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT_OPTION, "Invalid account options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_EXPIRED, "Account authorization has expired")
|
||||
|
||||
// mnode-user
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_ALREADY_EXIST, "User already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_EXIST, "Invalid user")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ALTER_OPER, "Invalid alter operation")
|
||||
|
||||
// mnode-db
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_ALREADY_EXIST, "Database already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_EXIST, "Database not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DATABASES, "Too many databases for account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_SELECTED, "Database not specified or available")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB, "Invalid database name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION, "Invalid database options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_ACCT, "Invalid database account")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_OPTION_UNCHANGED, "Database options not changed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_INDEX_NOT_EXIST, "Index not exist")
|
||||
|
||||
// mnode-vgroup
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE, "Vgroup already in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_IN_DNODE, "Vgroup not in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_EXIST, "Vgroup does not exist")
|
||||
// mnode-dnode-part2
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DNODES, "Too many dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE, "No enough memory in dnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_CFG, "Invalid dnode cfg")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_EP, "Invalid dnode end point")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_ID, "Invalid dnode id")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_UN_CHANGED, "Vgroup distribution has not changed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_HAS_OFFLINE_DNODE, "Offline dnode exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_REPLICA, "Invalid vgroup replica")
|
||||
|
||||
// mnode-stable
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_ALREADY_EXIST, "STable already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_NOT_EXIST, "STable not exist")
|
||||
// mnode-stable-part2
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC, "STable confilct with topic")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STBS, "Too many stables")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STB, "Invalid stable name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STB_OPTION, "Invalid stable options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STB_ALTER_OPTION, "Invalid stable alter options")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_OPTION_UNCHNAGED, "STable option unchanged")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ROW_BYTES, "Invalid row bytes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_TAGS, "Too many tags")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_ALREADY_EXIST, "Tag already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_NOT_EXIST, "Tag does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_COLUMNS, "Too many columns")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_ALREADY_EXIST, "Column already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_COLUMN_NOT_EXIST, "Column does not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC,"Field used by topic")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single stable mode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SCHEMA_VER, "Invalid schema version while alter stb")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid while alter stb")
|
||||
|
||||
// mnode-infoSchema
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table name")
|
||||
|
||||
// mnode-func
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FUNC_ALREADY_EXIST, "Func already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FUNC_NOT_EXIST, "Func not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC, "Invalid func")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_NAME, "Invalid func name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_CODE, "Invalid func code")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
|
||||
|
||||
// mnode-trans
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists")
|
||||
|
@ -303,7 +296,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
||||
|
||||
// dnode
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_REDIRECT, "Node need redirect")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, "Node is offline")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
||||
|
@ -319,8 +311,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, "No write permission f
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, "Missing data file")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, "Out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, "Unexpected generic error in vnode")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_CFG_FILE, "Invalid config file")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TERM_FILE, "Invalid term file")
|
||||
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_FLOWCTRL, "Database memory is full")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_DROPPING, "Database is dropping")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_UPDATING, "Database is updating")
|
||||
|
@ -337,15 +328,14 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TABLE_ACTION, "Invalid table action"
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_COL_ALREADY_EXISTS, "Table column already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_TABLE_COL_NOT_EXISTS, "Table column not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_COL_SUBSCRIBED, "Table column is subscribed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_CFG_FILE, "Invalid config file")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TERM_FILE, "Invalid term file")
|
||||
|
||||
// tsdb
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, "Invalid table ID")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_TYPE, "Invalid table type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION, "Invalid table schema version")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_ALREADY_EXIST, "Table already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_NOT_EXIST, "Table not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_ALREADY_EXIST, "Stable already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_CONFIG, "Invalid configuration")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INIT_FAILED, "Tsdb init failed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_DISKSPACE, "No diskspace for tsdb")
|
||||
|
@ -365,10 +355,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_AVAIL_DISK, "TSDB no available dis
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_MESSED_MSG, "TSDB messed message")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_IVLD_TAG_VAL, "TSDB invalid tag value")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_CACHE_LAST_ROW, "TSDB no cache last row data")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_NOT_EXIST, "Table not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_ALREADY_EXIST, "Stable already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_RECREATED, "Table re-created")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR, "TDB env open error")
|
||||
|
||||
|
||||
// query
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_QHANDLE, "Invalid handle")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_MSG, "Invalid message") // failed to validate the sql expression msg by vnode
|
||||
|
@ -383,8 +375,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_IN_EXEC, "Multiple retrieval of
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW, "Too many time window in query")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_NOT_ENOUGH_BUFFER, "Query buffer limit has reached")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INCONSISTAN, "File inconsistance in replica")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_TIME_CONDITION, "One valid time range condition expected")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_SYS_ERROR, "System error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_TIME_CONDITION, "One valid time range condition expected")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_INPUT, "invalid input")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_SCH_NOT_EXIST, "Scheduler not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_NOT_EXIST, "Task not exist")
|
||||
|
@ -397,11 +389,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_DROPPING, "Task dropping")
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUPLICATTED_OPERATION, "Duplicatted operation")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_MSG_ERROR, "Task message error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_FREED, "Job already freed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_NOT_EXIST, "Job not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JSON_IN_ERROR, "Json not support in in/notin operator")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR, "Json not support in this place")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JSON_IN_GROUP_ERROR, "Json not support in group/partition by")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_NOT_EXIST, "Job not exist")
|
||||
|
||||
// grant
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")
|
||||
|
@ -418,17 +410,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license")
|
||||
|
||||
// sync
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_CONFIG, "Invalid Sync Configuration")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_NOT_ENABLED, "Sync module not enabled")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_VERSION, "Invalid Sync version")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_CONFIRM_EXPIRED, "Sync confirm expired")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TOO_MANY_FWDINFO, "Too many sync fwd infos")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_MISMATCHED_PROTOCOL, "Mismatched protocol")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_MISMATCHED_CLUSTERID, "Mismatched clusterId")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_MISMATCHED_SIGNATURE, "Mismatched signature")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_CHECKSUM, "Invalid msg checksum")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_MSGLEN, "Invalid msg length")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_MSGTYPE, "Invalid msg type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_IS_LEADER, "Sync is leader")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_NOT_LEADER, "Sync not leader")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_ONE_REPLICA, "Sync one replica")
|
||||
|
@ -438,18 +420,33 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RECONFIG_NOT_READY, "Sync not ready for re
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_PROPOSE_NOT_READY, "Sync not ready for propose")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_STANDBY_NOT_READY, "Sync not ready for standby")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BATCH_ERROR, "Sync batch error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error")
|
||||
|
||||
//tq
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_INVALID_CONFIG, "TQ invalid config")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_INIT_FAILED, "TQ init falied")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_DISKSPACE, "TQ no disk space")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_DISK_PERMISSIONS, "TQ no disk permissions")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_FILE_CORRUPTED, "TQ file corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_OUT_OF_MEMORY, "TQ out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_FILE_ALREADY_EXISTS, "TQ file already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_FAILED_TO_CREATE_DIR, "TQ failed to create dir")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_NO_SUCH_KEY, "TQ meta no such key")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_NOT_IN_TXN, "TQ meta key not in txn")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_DUP_IN_TXN, "TQ met key dup in txn")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_GROUP_NOT_SET, "TQ group not exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND, "TQ table schema not found")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no commited offset")
|
||||
|
||||
// wal
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_APP_ERROR, "Unexpected generic error in wal")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_APP_ERROR, "Wal unexpected generic error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_SIZE_LIMIT, "WAL size exceeds limit")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_INVALID_VER, "WAL use invalid version")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_OUT_OF_MEMORY, "WAL out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_LOG_NOT_EXIST, "WAL log not exist")
|
||||
|
||||
// tfs
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_APP_ERROR, "tfs out of memory")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_CFG, "tfs invalid mount config")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_TOO_MANY_MOUNT, "tfs too many mount")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_DUP_PRIMARY, "tfs duplicate primary mount")
|
||||
|
@ -458,6 +455,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_MOUNT_AT_TIER, "tfs no mount at tier"
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_FILE_ALREADY_EXISTS, "tfs file already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_LEVEL, "tfs invalid level")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_VALID_DISK, "tfs no valid disk")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FS_APP_ERROR, "tfs out of memory")
|
||||
|
||||
// catalog
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_CTG_INTERNAL_ERROR, "catalog internal error")
|
||||
|
@ -471,15 +469,13 @@ TAOS_DEFINE_ERROR(TSDB_CODE_CTG_VG_META_MISMATCH, "table meta and vgroup
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_CTG_EXIT, "catalog exit")
|
||||
|
||||
//scheduler
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QW_MSG_ERROR, "Invalid msg order")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_STATUS_ERROR, "scheduler status error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_INTERNAL_ERROR, "scheduler internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_TIMEOUT_ERROR, "Task timeout")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_JOB_IS_DROPPING, "Job is dropping")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_QW_MSG_ERROR, "Invalid msg order")
|
||||
|
||||
// parser
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PERMISSION_DENIED, "Permission denied")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYNTAX_ERROR, "syntax error near")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INCOMPLETE_SQL, "Incomplete SQL statement")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLUMN, "Invalid column name")
|
||||
|
@ -534,6 +530,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TOO_MANY_COLUMNS, "Too many columns")
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FIRST_COLUMN, "First column must be timestamp")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN, "Invalid binary/nchar column length")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TAGS_NUM, "Invalid number of tag columns")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PERMISSION_DENIED, "Permission denied")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PERMISSION_DENIED, "Invalid stream query")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_INTERNAL_PK, "Invalid _c0 or _rowts expression")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TIMELINE_FUNC, "Invalid timeline function")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PASSWD, "Invalid password")
|
||||
|
@ -551,10 +549,29 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be jso
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill now allowed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WINDOW_PC, "Invalid windows pc")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC, "Window not allowed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC, "Stream not allowed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC, "Group by not allowd")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, "Invalid interp clause")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function ion window")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, "Only support single table")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SMA_INDEX, "Invalid sma index")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SELECTED_EXPR, "Invalid SELECTed expression")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
|
||||
|
||||
//planner
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_INTERNAL_ERROR, "Planner internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_EXPECTED_TS_EQUAL, "Expect ts equal")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_NOT_SUPPORT_CROSS_JOIN, "Cross join not support")
|
||||
|
||||
//function
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_ERROR, "Function internal error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_NUM, "Invalid function para number")
|
||||
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")
|
||||
|
||||
//udf
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_UDF_STOPPING, "udf is stopping")
|
||||
|
@ -576,6 +593,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_DB_CONF, "Invalid schemaless
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_SML_NOT_SAME_TYPE, "Not the same type like before")
|
||||
|
||||
//tsma
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INIT_FAILED, "Tsma init failed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_ALREADY_EXIST, "Tsma already exists")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NO_INDEX_IN_META, "No tsma index in meta")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_ENV, "Invalid tsma env")
|
||||
|
@ -590,14 +608,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state"
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_QTASKINFO_CREATE, "Rsma qtaskinfo creation error")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_FILE_CORRUPTED, "Rsma file corrupted")
|
||||
|
||||
|
||||
//tq
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "No committed offset")
|
||||
|
||||
|
||||
//index
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_REBUILDING, "Index is rebuilding")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_REBUILDING, "Invalid index file")
|
||||
|
||||
//tmq
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_INVALID_MSG, "Invalid message")
|
||||
|
||||
#ifdef TAOS_ERROR_C
|
||||
|
|
|
@ -1327,6 +1327,8 @@ class Task():
|
|||
|
||||
# TDengine 3.0 Error Codes:
|
||||
0x0333, # Object is creating # TODO: this really is NOT an acceptable error
|
||||
0x0369, # Tag already exists
|
||||
0x0388, # Database not exist
|
||||
0x03A0, # STable already exists
|
||||
0x03A1, # STable [does] not exist
|
||||
0x03AA, # Tag already exists
|
||||
|
|
|
@ -99,9 +99,9 @@
|
|||
./test.sh -f tsim/parser/commit.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/condition.sim
|
||||
./test.sh -f tsim/parser/constCol.sim
|
||||
./test.sh -f tsim/parser/create_db.sim
|
||||
#./test.sh -f tsim/parser/create_db.sim
|
||||
./test.sh -f tsim/parser/create_mt.sim
|
||||
# TD-17653 ./test.sh -f tsim/parser/create_tb_with_tag_name.sim
|
||||
./test.sh -f tsim/parser/create_tb_with_tag_name.sim
|
||||
./test.sh -f tsim/parser/create_tb.sim
|
||||
./test.sh -f tsim/parser/dbtbnameValidate.sim
|
||||
./test.sh -f tsim/parser/distinct.sim
|
||||
|
@ -113,8 +113,8 @@
|
|||
# TD-17659 ./test.sh -f tsim/parser/function.sim
|
||||
./test.sh -f tsim/parser/groupby-basic.sim
|
||||
./test.sh -f tsim/parser/groupby.sim
|
||||
# TD-17622 ./test.sh -f tsim/parser/having_child.sim
|
||||
# TD-17622 ./test.sh -f tsim/parser/having.sim
|
||||
./test.sh -f tsim/parser/having_child.sim
|
||||
./test.sh -f tsim/parser/having.sim
|
||||
./test.sh -f tsim/parser/import_commit1.sim
|
||||
./test.sh -f tsim/parser/import_commit2.sim
|
||||
./test.sh -f tsim/parser/import_commit3.sim
|
||||
|
@ -129,7 +129,8 @@
|
|||
# TD-17707 ./test.sh -f tsim/parser/join.sim
|
||||
./test.sh -f tsim/parser/last_cache.sim
|
||||
./test.sh -f tsim/parser/last_groupby.sim
|
||||
# TD-17722 ./test.sh -f tsim/parser/lastrow.sim
|
||||
./test.sh -f tsim/parser/lastrow.sim
|
||||
./test.sh -f tsim/parser/lastrow2.sim
|
||||
./test.sh -f tsim/parser/like.sim
|
||||
# TD-17464 ./test.sh -f tsim/parser/limit.sim
|
||||
# TD-17464 ./test.sh -f tsim/parser/limit1.sim
|
||||
|
@ -137,7 +138,7 @@
|
|||
./test.sh -f tsim/parser/mixed_blocks.sim
|
||||
./test.sh -f tsim/parser/nchar.sim
|
||||
# TD-17703 ./test.sh -f tsim/parser/nestquery.sim
|
||||
# TD-17685 ./test.sh -f tsim/parser/null_char.sim
|
||||
./test.sh -f tsim/parser/null_char.sim
|
||||
./test.sh -f tsim/parser/precision_ns.sim
|
||||
./test.sh -f tsim/parser/projection_limit_offset.sim
|
||||
./test.sh -f tsim/parser/regex.sim
|
||||
|
@ -146,12 +147,12 @@
|
|||
./test.sh -f tsim/parser/select_from_cache_disk.sim
|
||||
# TD-17659 ./test.sh -f tsim/parser/select_with_tags.sim
|
||||
./test.sh -f tsim/parser/selectResNum.sim
|
||||
# TD-17685 ./test.sh -f tsim/parser/set_tag_vals.sim
|
||||
./test.sh -f tsim/parser/set_tag_vals.sim
|
||||
./test.sh -f tsim/parser/single_row_in_tb.sim
|
||||
# TD-17684 ./test.sh -f tsim/parser/sliding.sim
|
||||
# TD-17722 ./test.sh -f tsim/parser/slimit_alter_tags.sim
|
||||
# TD-17722 ./test.sh -f tsim/parser/slimit.sim
|
||||
# TD-17722 ./test.sh -f tsim/parser/slimit1.sim
|
||||
./test.sh -f tsim/parser/sliding.sim
|
||||
./test.sh -f tsim/parser/slimit_alter_tags.sim
|
||||
./test.sh -f tsim/parser/slimit.sim
|
||||
./test.sh -f tsim/parser/slimit1.sim
|
||||
./test.sh -f tsim/parser/stableOp.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/tags_filter.sim
|
||||
|
|
|
@ -63,10 +63,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
|||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||
|
||||
if $data(1)[2] != leader then
|
||||
goto step3
|
||||
$leaderNum = 0
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(2)[2] != follower then
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $leaderNum == 0 then
|
||||
goto step3
|
||||
endi
|
||||
if $data(3)[2] != offline then
|
||||
|
@ -97,10 +101,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
|||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||
|
||||
if $data(1)[2] != leader then
|
||||
goto step4
|
||||
$leaderNum = 0
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(2)[2] != follower then
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $leaderNum == 0 then
|
||||
goto step4
|
||||
endi
|
||||
if $data(3)[2] != follower then
|
||||
|
@ -132,10 +140,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
|||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||
|
||||
if $data(1)[2] != leader then
|
||||
goto step5
|
||||
$leaderNum = 0
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(2)[2] != follower then
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $leaderNum == 0 then
|
||||
goto step5
|
||||
endi
|
||||
if $data(3)[2] != offline then
|
||||
|
@ -169,10 +181,14 @@ print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
|||
if $rows != 2 then
|
||||
goto step6
|
||||
endi
|
||||
if $data(1)[2] != leader then
|
||||
goto step6
|
||||
$leaderNum = 0
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(2)[2] != follower then
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $leaderNum == 0 then
|
||||
goto step6
|
||||
endi
|
||||
if $data(3)[2] != null then
|
||||
|
|
|
@ -68,13 +68,17 @@ step31:
|
|||
return -1
|
||||
endi
|
||||
sql show mnodes
|
||||
if $data(1)[2] != leader then
|
||||
goto step31
|
||||
$leaderNum = 0
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(2)[2] != follower then
|
||||
goto step31
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(3)[2] != follower then
|
||||
if $data(3)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $leaderNum == 0 then
|
||||
goto step31
|
||||
endi
|
||||
|
||||
|
@ -302,10 +306,10 @@ print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
|||
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||
print ===> $data20 $data21 $data22 $data23 $data24 $data25
|
||||
$leaderNum = 0
|
||||
if $data(2)[2] == leader then
|
||||
if $data(1)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(3)[2] == leader then
|
||||
if $data(2)[2] == leader then
|
||||
$leaderNum = 1
|
||||
endi
|
||||
if $data(3)[2] == leader then
|
||||
|
|
|
@ -93,7 +93,7 @@ sql_error create table tb11 using st2 (id,t1,) tags (1,1,1);
|
|||
|
||||
sql create table tb12 using st2 (t1,id) tags (2,1);
|
||||
sql show tags from tb12;
|
||||
if $rows != 5 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != 1 then
|
||||
|
@ -109,9 +109,9 @@ if $data35 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql create table tb13 using st2 ("t1",'id') tags (2,1);
|
||||
sql create table tb13 using st2 (t1,id) tags (2,1);
|
||||
sql show tags from tb13;
|
||||
if $rows != 2 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != 1 then
|
||||
|
|
|
@ -960,6 +960,7 @@ endi
|
|||
|
||||
sql select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 4:2:15' interval(500a) fill(value, 99,91,90,89,88,87,86,85) ;
|
||||
if $rows != 21749 then
|
||||
print expect 21749, actual: $rows
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
echo '2020-1-1 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' > C:\\Windows\\Temp\\data.sql
|
||||
echo '2020-1-2 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' >> C:\\Windows\\Temp\\data.sql
|
||||
echo '2020-1-3 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' >> C:\\Windows\\Temp\\data.sql
|
|
@ -26,8 +26,7 @@ sql insert into tb1 values (now+50s ,3,3.0,3.0,3,3,3,false,"3","3")
|
|||
sql insert into tb1 values (now+100s,4,4.0,4.0,4,4,4,true ,"4","4")
|
||||
sql insert into tb1 values (now+150s,4,4.0,4.0,4,4,4,false,"4","4")
|
||||
|
||||
|
||||
sql select count(*),f1 from st2 group by f1 having count(f1) > 0;
|
||||
sql select count(*),f1 from st2 group by f1 having count(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -56,10 +55,7 @@ if $data31 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
|
||||
|
||||
sql select count(*),f1 from st2 group by f1 having count(*) > 0;
|
||||
sql select count(*),f1 from st2 group by f1 having count(*) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -88,8 +84,7 @@ if $data31 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select count(*),f1 from st2 group by f1 having count(f2) > 0;
|
||||
sql select count(*),f1 from st2 group by f1 having count(f2) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -120,7 +115,7 @@ endi
|
|||
|
||||
sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0;
|
||||
|
||||
sql select last(f1) from st2 group by f1 having count(f2) > 0;
|
||||
sql select last(f1) from st2 group by f1 having count(f2) > 0 order by f1;;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -141,7 +136,7 @@ sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0;
|
|||
sql_error select top(f1,2) from st2 group by f1 having count(f2) > 0;
|
||||
sql_error select top(f1,2) from st2 group by f1 having avg(f1) > 0;
|
||||
|
||||
sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2;
|
||||
sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -158,8 +153,7 @@ if $data11 != 2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0;
|
||||
sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -176,7 +170,7 @@ if $data11 != 2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -199,7 +193,7 @@ if $data12 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -222,7 +216,7 @@ if $data12 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -263,7 +257,7 @@ if $data32 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 2 and sum(f1) < 6;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 2 and sum(f1) < 6 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -278,7 +272,7 @@ if $data02 != 4 then
|
|||
endi
|
||||
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having 1 <= sum(f1) and 5 >= sum(f1);
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having 1 <= sum(f1) and 5 >= sum(f1) order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -301,7 +295,7 @@ if $data12 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by tbname having twa(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1),tbname from st2 group by tbname having twa(f1) > 0;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -318,9 +312,9 @@ if $data04 != tb1 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having twa(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having twa(f1) > 0;
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by tbname having sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1),tbname from st2 group by tbname having sum(f1) > 0;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -337,9 +331,9 @@ if $data04 != tb1 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from st2 group by f1 having sum(f1) > 0;
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -380,7 +374,7 @@ if $data32 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -413,7 +407,7 @@ if $data22 != 8 then
|
|||
endi
|
||||
|
||||
###########and issue
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 and sum(f1) > 1;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -454,8 +448,7 @@ if $data32 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 1;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -496,7 +489,7 @@ if $data32 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 4;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 4 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -529,12 +522,12 @@ if $data22 != 8 then
|
|||
endi
|
||||
|
||||
############or issue
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or avg(f1) > 4;
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 and avg(f1) > 4 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(f1) > 3);
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(f1) > 3) order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -568,7 +561,7 @@ endi
|
|||
|
||||
sql_error select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(*) > 3);
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3);
|
||||
sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3) order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -600,7 +593,7 @@ if $data22 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3);
|
||||
sql select avg(f1),count(st2.*),sum(f1) from st2 group by f1 having (sum(st2.f1) > 3) order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -632,7 +625,7 @@ if $data22 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),stddev(f1) from st2 group by f1;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),stddev(f1) from st2 group by f1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -697,12 +690,12 @@ if $data34 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) > 3);
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) > 3) order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) < 1);
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (stddev(st2.f1) < 1) order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -760,15 +753,54 @@ sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 ha
|
|||
|
||||
sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1) < 1;
|
||||
|
||||
sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) < 1;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) < 1;
|
||||
|
||||
sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
|
||||
sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
|
||||
sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having sum(f1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from st2 group by f1 having sum(f1) > 2 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != 4.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data23 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having min(f1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having min(f1) > 2 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -797,7 +829,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having min(f1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having min(f1) > 2 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -832,7 +864,7 @@ if $data14 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having max(f1) > 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having max(f1) > 2 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -867,7 +899,7 @@ if $data14 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having max(f1) != 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having max(f1) != 2 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -926,7 +958,7 @@ if $data25 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having first(f1) != 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having first(f1) != 2 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -987,7 +1019,7 @@ endi
|
|||
|
||||
|
||||
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from st2 group by f1 having first(f1) != 2;
|
||||
sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from st2 group by f1 having first(f1) != 2 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1071,7 +1103,7 @@ sql_error select PERCENTILE(f1) from st2 group by f1 having sum(f1) > 1;
|
|||
|
||||
sql_error select PERCENTILE(f1,20) from st2 group by f1 having sum(f1) > 1;
|
||||
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having sum(f1) > 1;
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1088,7 +1120,7 @@ if $data30 != 4.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1;
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1102,7 +1134,7 @@ if $data20 != 4.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50;
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1116,7 +1148,7 @@ if $data20 != 4.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3;
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1124,7 +1156,7 @@ if $data00 != 2.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3;
|
||||
sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1136,9 +1168,9 @@ sql_error select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(1) >
|
|||
|
||||
sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from st2 group by f1 having apercentile(1) > 1;
|
||||
|
||||
sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from st2 group by f1 having apercentile(f1,1) > 1;
|
||||
sql select aPERCENTILE(f1,20),LAST_ROW(f1) from st2 group by f1 having apercentile(f1,1) > 1;
|
||||
|
||||
sql_error select sum(f1) from st2 group by f1 having last_row(f1) > 1;
|
||||
sql select sum(f1) from st2 group by f1 having last_row(f1) > 1;
|
||||
|
||||
sql_error select avg(f1) from st2 group by f1 having diff(f1) > 0;
|
||||
|
||||
|
@ -1146,12 +1178,12 @@ sql_error select avg(f1),diff(f1) from st2 group by f1 having avg(f1) > 0;
|
|||
|
||||
sql_error select avg(f1),diff(f1) from st2 group by f1 having spread(f2) > 0;
|
||||
|
||||
sql select avg(f1) from st2 group by f1 having spread(f2) > 0;
|
||||
sql select avg(f1) from st2 group by f1 having spread(f2) > 0 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1) from st2 group by f1 having spread(f2) = 0;
|
||||
sql select avg(f1) from st2 group by f1 having spread(f2) = 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1168,7 +1200,7 @@ if $data30 != 4.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f2) from st2 group by f1;
|
||||
sql select avg(f1),spread(f2) from st2 group by f1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1197,7 +1229,7 @@ if $data31 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) = 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1250,48 +1282,47 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) != 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) != 0 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + 1 > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 1 > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + sum(f1);
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) - sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) * sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) * sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) / sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) / sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) > sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) 0 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) 0 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + 0 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) + 0 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) - f1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - f1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) - id1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) - id1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1) > 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > id1 and sum(f1) > 1;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) > 2 and sum(f1) > 1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) > 2 and sum(f1) > 1 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0 and sum(f1) > 1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) = 0 and sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1344,7 +1375,7 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by f1 having spread(f1) = 0 and avg(f1) > 1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) = 0 and avg(f1) > 1 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1385,40 +1416,37 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by c1 having spread(f1) = 0 and avg(f1) > 1;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by c1 having spread(f1) = 0 and avg(f1) > 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(id1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by id1 having avg(id1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) > id1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by id1 having avg(f1) > id1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),avg(id1) from st2 group by id1 having avg(f1) > id1;
|
||||
sql select avg(f1),spread(f1),spread(f2),spread(st2.f1),avg(id1) from st2 group by id1 having avg(f1) > id1;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by id1 having avg(f1) > 0;
|
||||
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having avg(f1) > 0 and avg(f1) = 3 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2.500000000 then
|
||||
if $data00 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 3.000000000 then
|
||||
if $data01 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 3.000000000 then
|
||||
if $data02 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 1 then
|
||||
if $data03 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 group by id1 having avg(f1) < 2;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
#sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having avg(f1) < 0 and avg(f1) = 3;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by id1 having avg(f1) < 2;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f1 > 0 group by f1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f1 > 0 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1471,7 +1499,7 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f1 > 2 group by f1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f1 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1500,7 +1528,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 2 group by f1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1529,7 +1557,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f3 > 2 group by f1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f3 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1558,7 +1586,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1575,15 +1603,15 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(ts) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having avg(ts) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f7) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having avg(f7) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f8) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having avg(f8) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having avg(f9) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having avg(f9) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having count(f9) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having count(f9) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1600,9 +1628,9 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f9) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having last(f9) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f2) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having last(f2) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1619,7 +1647,7 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 3 group by f1 having last(f3) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 3 group by f1 having last(f3) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1636,7 +1664,7 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f3) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 1 group by f1 having last(f3) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1677,7 +1705,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f4) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 1 group by f1 having last(f4) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1718,7 +1746,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f5) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 1 group by f1 having last(f5) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1759,7 +1787,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 1 group by f1 having last(f6) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1801,39 +1829,45 @@ if $data23 != 0.000000000 then
|
|||
endi
|
||||
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f2 from st2 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(st2.f1),f1,f2 from st2 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(st2.f1),f1,f6 from st2 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1,f2 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(st2.f1),f1,f6 from st2 where f2 > 1 group by f1,f2 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by f1,id1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(st2.f1),f1,f6 from st2 where f2 > 1 group by f1,id1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,st2.f1),f1,f6 from st2 where f2 > 1 group by id1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(st2.f1),f1,f6 from st2 where f2 > 1 group by id1 having last(f6) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,st2.f1) from st2 where f2 > 1 group by id1 having last(f6) > 0;
|
||||
if $rows != 1 then
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 3.000000000 then
|
||||
if $data00 != 2.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2.000000000 then
|
||||
if $data01 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2.000000000 then
|
||||
if $data02 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 2.000000000 then
|
||||
if $data03 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 1 then
|
||||
if $data10 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0;
|
||||
sql_error select count(*) from tb1 group by f1 having last(*) > 0;
|
||||
|
||||
print bug for select count(*) k from tb1 group by f1 having k > 0;
|
||||
sql_error select top(f1,2) from st2 group by f1 having count(f1) > 0;
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -26,7 +26,6 @@ sql insert into tb1 values (now+50s ,3,3.0,3.0,3,3,3,false,"3","3")
|
|||
sql insert into tb1 values (now+100s,4,4.0,4.0,4,4,4,true ,"4","4")
|
||||
sql insert into tb1 values (now+150s,4,4.0,4.0,4,4,4,false,"4","4")
|
||||
|
||||
|
||||
sql select count(*),f1 from tb1 group by f1 having count(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
|
@ -56,7 +55,6 @@ if $data31 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select count(*),f1 from tb1 group by f1 having count(*) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
|
@ -299,13 +297,13 @@ if $data12 != 4 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having twa(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having twa(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having twa(f1) > 3;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having twa(f1) > 3;
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having sum(f1) > 0;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname having sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having sum(f1) = 4;
|
||||
sql select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having sum(f1) = 4;
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
|
@ -381,7 +379,7 @@ if $data22 != 8 then
|
|||
endi
|
||||
|
||||
###########and issue
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and sum(f1) > 1 order by f1;
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -422,7 +420,6 @@ if $data32 != 8 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
|
@ -497,7 +494,7 @@ if $data22 != 8 then
|
|||
endi
|
||||
|
||||
############or issue
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or avg(f1) > 4 order by f1;
|
||||
sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and avg(f1) > 4 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -728,11 +725,11 @@ sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 ha
|
|||
|
||||
sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1) < 1;
|
||||
|
||||
sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) < 1;
|
||||
sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) < 1;
|
||||
|
||||
sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
|
||||
sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2;
|
||||
|
||||
sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having sum(f1) > 2 order by f1;
|
||||
if $rows != 3 then
|
||||
|
@ -1149,9 +1146,9 @@ sql_error select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(1) >
|
|||
|
||||
sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from tb1 group by f1 having apercentile(1) > 1;
|
||||
|
||||
sql_error select aPERCENTILE(f1,20),LAST_ROW(f1) from tb1 group by f1 having apercentile(f1,1) > 1;
|
||||
sql select aPERCENTILE(f1,20),LAST_ROW(f1) from tb1 group by f1 having apercentile(f1,1) > 1;
|
||||
|
||||
sql_error select sum(f1) from tb1 group by f1 having last_row(f1) > 1;
|
||||
sql select sum(f1) from tb1 group by f1 having last_row(f1) > 1;
|
||||
|
||||
sql_error select avg(f1) from tb1 group by f1 having diff(f1) > 0;
|
||||
|
||||
|
@ -1210,7 +1207,7 @@ if $data31 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) = 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1263,48 +1260,47 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) != 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) != 0 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + 1 > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 1 > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1);
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) - sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) * sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) * sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) / sum(f1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) / sum(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) > sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) 0 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) 0 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + 0 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) + 0 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) - f1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - f1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) - id1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) - id1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1);
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1);
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1) > 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1) > 1;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > 2 and sum(f1) > 1 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) > 2 and sum(f1) > 1 order by f1;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and sum(f1) > 1 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) = 0 and sum(f1) > 1 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1357,7 +1353,7 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and avg(f1) > 1 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) = 0 and avg(f1) > 1 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1398,17 +1394,17 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by c1 having spread(f1) = 0 and avg(f1) > 1;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by c1 having spread(f1) = 0 and avg(f1) > 1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(id1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by id1 having avg(id1) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) > id1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by id1 having avg(f1) > id1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),avg(id1) from tb1 group by id1 having avg(f1) > id1;
|
||||
sql select avg(f1),spread(f1),spread(f2),spread(tb1.f1),avg(id1) from tb1 group by id1 having avg(f1) > id1;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by id1 having avg(f1) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) > 0 and avg(f1) = 3 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having avg(f1) > 0 and avg(f1) = 3 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1425,10 +1421,10 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
#sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) < 0 and avg(f1) = 3;
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) < 2;
|
||||
#sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having avg(f1) < 0 and avg(f1) = 3;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by id1 having avg(f1) < 2;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 0 group by f1 having avg(f1) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f1 > 0 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1481,7 +1477,7 @@ if $data33 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f1 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1510,7 +1506,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1539,7 +1535,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1568,7 +1564,7 @@ if $data13 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f1) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f1) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1585,15 +1581,15 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(ts) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having avg(ts) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f7) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f7) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f8) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f8) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f9) > 0;
|
||||
sql_error select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f9) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having count(f9) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having count(f9) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1610,9 +1606,9 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f9) > 0;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having last(f9) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f2) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having last(f2) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1629,7 +1625,7 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f3) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 3 group by f1 having last(f3) > 0 order by f1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1646,7 +1642,7 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f3) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 1 group by f1 having last(f3) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1687,7 +1683,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f4) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 1 group by f1 having last(f4) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1728,7 +1724,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f5) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 1 group by f1 having last(f5) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1769,7 +1765,7 @@ if $data23 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f6) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 1 group by f1 having last(f6) > 0 order by f1;
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -1811,17 +1807,17 @@ if $data23 != 0.000000000 then
|
|||
endi
|
||||
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f2 from tb1 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(tb1.f1),f1,f2 from tb1 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,f2 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,f2 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,id1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(tb1.f1),f1,f6 from tb1 where f2 > 1 group by f1,id1 having last(f6) > 0;
|
||||
|
||||
sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by id1 having last(f6) > 0;
|
||||
sql_error select avg(f1),spread(f1),spread(f2),spread(tb1.f1),f1,f6 from tb1 where f2 > 1 group by id1 having last(f6) > 0;
|
||||
|
||||
sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0 order by f1;
|
||||
sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0 order by f1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -7,8 +7,11 @@ sql drop database if exists indb
|
|||
sql create database if not exists indb
|
||||
sql use indb
|
||||
|
||||
$inFileName = '/tmp/data.csv'
|
||||
$numOfRows = 10000
|
||||
$inFileName = '/tmp/data.sql'
|
||||
system_content printf %OS%
|
||||
if $system_content == Windows_NT then
|
||||
$inFileName = 'C:\\Windows\\Temp\\data.sql'
|
||||
endi
|
||||
system tsim/parser/gendata.sh
|
||||
|
||||
sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) tags(a int, b binary(12));
|
||||
|
@ -16,8 +19,8 @@ sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16
|
|||
sql create table tbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2))
|
||||
print ====== create tables success, starting insert data
|
||||
|
||||
sql insert into tbx file '/tmp/data.sql'
|
||||
sql import into tbx file '/tmp/data.sql'
|
||||
sql insert into tbx file $inFileName
|
||||
sql import into tbx file $inFileName
|
||||
|
||||
sql select count(*) from tbx
|
||||
if $rows != 1 then
|
||||
|
@ -31,8 +34,8 @@ endi
|
|||
|
||||
sql drop table tbx;
|
||||
|
||||
sql insert into tbx using stbx tags(1,'abc') file '/tmp/data.sql';
|
||||
sql insert into tbx using stbx tags(1,'abc') file '/tmp/data.sql';
|
||||
sql insert into tbx using stbx tags(1,'abc') file $inFileName ;
|
||||
sql insert into tbx using stbx tags(1,'abc') file $inFileName ;
|
||||
|
||||
sql select count(*) from tbx
|
||||
if $rows != 1 then
|
||||
|
@ -44,7 +47,7 @@ if $data00 != 3 then
|
|||
endi
|
||||
|
||||
sql drop table tbx;
|
||||
sql insert into tbx using stbx(b) tags('abcf') file '/tmp/data.sql';
|
||||
sql insert into tbx using stbx(b) tags('abcf') file $inFileName ;
|
||||
|
||||
sql select ts,a,b from tbx;
|
||||
if $rows != 3 then
|
||||
|
@ -64,6 +67,6 @@ if $data02 != @abcf@ then
|
|||
return -1
|
||||
endi
|
||||
|
||||
system rm -f /tmp/data.sql
|
||||
system rm -f $inFileName
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -64,21 +64,4 @@ sql connect
|
|||
|
||||
run tsim/parser/lastrow_query.sim
|
||||
|
||||
print =================== last_row + nested query
|
||||
sql use $db
|
||||
sql create table lr_nested(ts timestamp, f int)
|
||||
sql insert into lr_nested values(now, 1)
|
||||
sql insert into lr_nested values(now+1s, null)
|
||||
sql select last_row(*) from (select * from lr_nested)
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select last_row(*) from (select f from lr_nested)
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
sql create database d1;
|
||||
sql use d1;
|
||||
|
||||
print ========>td-1317, empty table last_row query crashed
|
||||
sql drop table if exists m1;
|
||||
sql create table m1(ts timestamp, k int) tags (a int);
|
||||
sql create table t1 using m1 tags(1);
|
||||
sql create table t2 using m1 tags(2);
|
||||
|
||||
sql select last_row(*) from t1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select last_row(*) from m1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select last_row(*) from m1 where tbname in ('t1')
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into t1 values('2019-1-1 1:1:1', 1);
|
||||
print ===================> last_row query against normal table along with ts/tbname
|
||||
sql select last_row(*),ts,'k' from t1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ===================> last_row + user-defined column + normal tables
|
||||
sql select last_row(ts), 'abc', 1234.9384, ts from t1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != @abc@ then
|
||||
print expect abc, actual $data02
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1234.938400000 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != @19-01-01 01:01:01.000@ then
|
||||
print expect 19-01-01 01:01:01.000, actual:$data03
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ===================> last_row + stable + ts/tag column + condition + udf
|
||||
sql select last_row(*), ts, 'abc', 123.981, tbname from m1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != @19-01-01 01:01:01.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != @abc@ then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 123.981000000 then
|
||||
print expect 123.981000000, actual: $data04
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table tu(ts timestamp, k int)
|
||||
sql select last_row(*) from tu
|
||||
if $row != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =================== last_row + nested query
|
||||
sql create table lr_nested(ts timestamp, f int)
|
||||
sql insert into lr_nested values(now, 1)
|
||||
sql insert into lr_nested values(now+1s, null)
|
||||
sql select last_row(*) from (select * from lr_nested)
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#sql select last_row(*) from (select f from lr_nested)
|
||||
#if $rows != 1 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -79,19 +79,6 @@ endi
|
|||
if $data03 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != 59 then
|
||||
print expect 59, actual: $data03
|
||||
return -1
|
||||
endi
|
||||
if $data14 != 7 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 9
|
||||
if $rows != 18 then
|
||||
|
@ -129,43 +116,41 @@ if $rows != 1 then
|
|||
endi
|
||||
|
||||
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 1
|
||||
if $rows != 0 then
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 0
|
||||
if $rows != 0 then
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
return
|
||||
|
||||
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 2 soffset 0 limit 250000 offset 1
|
||||
if $rows != 172799 then
|
||||
if $rows != 172798 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 0 limit 250000 offset 1
|
||||
if $rows != 86399 then
|
||||
if $rows != 85648 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts DESC limit 30
|
||||
if $rows != 30 then
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 30
|
||||
if $rows != 48 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 2
|
||||
if $rows != 2 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 1 limit 250000 offset 1
|
||||
if $rows != 86399 then
|
||||
if $rows != 87150 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts desc limit 1
|
||||
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 1
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -174,68 +159,3 @@ sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000'
|
|||
if $rows != 46 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ========>td-1317, empty table last_row query crashed
|
||||
sql drop table if exists m1;
|
||||
sql create table m1(ts timestamp, k int) tags (a int);
|
||||
sql create table t1 using m1 tags(1);
|
||||
sql create table t2 using m1 tags(2);
|
||||
|
||||
sql select last_row(*) from t1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select last_row(*) from m1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select last_row(*) from m1 where tbname in ('t1')
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into t1 values('2019-1-1 1:1:1', 1);
|
||||
print ===================> last_row query against normal table along with ts/tbname
|
||||
sql select last_row(*),ts,'k' from t1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ===================> last_row + user-defined column + normal tables
|
||||
sql select last_row(ts), 'abc', 1234.9384, ts from t1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != @abc@ then
|
||||
print expect abc, actual $data02
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 1234.938400000 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != @19-01-01 01:01:01.000@ then
|
||||
print expect 19-01-01 01:01:01.000, actual:$data03
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ===================> last_row + stable + ts/tag column + condition + udf
|
||||
sql select last_row(*), ts, 'abc', 123.981, tbname from m1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != @19-01-01 01:01:01.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != @abc@ then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != 123.981000000 then
|
||||
print expect 123.981000000, actual: $data04
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table tu(ts timestamp, k int)
|
||||
sql select last_row(*) from tu
|
||||
if $row != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -285,7 +285,7 @@ if $data02 != 2147483647 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error alter table st41 set tag tag_int = -2147483648
|
||||
sql alter table st41 set tag tag_int = -2147483648
|
||||
sql_error alter table st41 set tag tag_int = 2147483648
|
||||
|
||||
sql alter table st41 set tag tag_int = '-379'
|
||||
|
@ -304,8 +304,8 @@ if $data02 != NULL then
|
|||
print ==10== expect: NULL, actually: $data02
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_int = 'NULL'
|
||||
sql_error alter table st41 set tag tag_int = ''
|
||||
sql_error alter table st41 set tag tag_int = 'NULL'
|
||||
sql alter table st41 set tag tag_int = ''
|
||||
sql_error alter table st41 set tag tag_int = abc379
|
||||
|
||||
################### bool
|
||||
|
@ -331,8 +331,8 @@ if $data03 != 1 then
|
|||
endi
|
||||
sql alter table st41 set tag tag_bool = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data03 != NULL then
|
||||
print ==14== expect: NULL, actually: $data03
|
||||
if $data03 != 0 then
|
||||
print ==14== expect: 0, actually: $data03
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_bool = NULL
|
||||
|
@ -341,8 +341,8 @@ if $data03 != NULL then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error alter table st41 set tag tag_bool = '123'
|
||||
sql_error alter table st41 set tag tag_bool = ''
|
||||
sql alter table st41 set tag tag_bool = '123'
|
||||
sql alter table st41 set tag tag_bool = ''
|
||||
sql_error alter table st41 set tag tag_bool = abc379
|
||||
|
||||
################### float
|
||||
|
@ -378,8 +378,8 @@ if $data04 != NULL then
|
|||
endi
|
||||
sql alter table st41 set tag tag_float = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data04 != NULL then
|
||||
print ==17== expect: NULL, actually : $data04
|
||||
if $data04 != 0.00000 then
|
||||
print ==17== expect: 0.00000, actually : $data04
|
||||
return -1
|
||||
endi
|
||||
sql alter table st41 set tag tag_float = '54.123456'
|
||||
|
@ -394,10 +394,10 @@ if $data04 != -54.12346 then
|
|||
print ==19== expect: -54.12346, actually : $data04
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st41 set tag tag_float = ''
|
||||
sql alter table st41 set tag tag_float = ''
|
||||
|
||||
sql_error alter table st41 set tag tag_float = 'abc'
|
||||
sql_error alter table st41 set tag tag_float = '123abc'
|
||||
sql alter table st41 set tag tag_float = 'abc'
|
||||
sql alter table st41 set tag tag_float = '123abc'
|
||||
sql_error alter table st41 set tag tag_float = abc
|
||||
|
||||
################### double
|
||||
|
@ -426,20 +426,20 @@ if $data05 != NULL then
|
|||
endi
|
||||
sql alter table st41 set tag tag_double = 'NULL'
|
||||
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
|
||||
if $data05 != NULL then
|
||||
print ==20== expect: NULL, actually : $data05
|
||||
if $data05 != 0.000000000 then
|
||||
print ==20== expect: 0.000000000, actually : $data05
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st41 set tag tag_double = ''
|
||||
|
||||
|
||||
sql_error alter table st41 set tag tag_double = 'abc'
|
||||
sql_error alter table st41 set tag tag_double = '123abc'
|
||||
sql alter table st41 set tag tag_double = ''
|
||||
sql alter table st41 set tag tag_double = 'abc'
|
||||
sql alter table st41 set tag tag_double = '123abc'
|
||||
sql_error alter table st41 set tag tag_double = abc
|
||||
|
||||
################### bigint smallint tinyint
|
||||
sql create table mt5 (ts timestamp, c1 int) tags (tag_bigint bigint, tag_smallint smallint, tag_tinyint tinyint)
|
||||
sql create table st51 using mt5 tags (1, 2, 3)
|
||||
sql insert into st51 values(now, 1)
|
||||
sql alter table st51 set tag tag_bigint = '-379'
|
||||
sql alter table st51 set tag tag_bigint = -2000
|
||||
sql alter table st51 set tag tag_bigint = NULL
|
||||
|
@ -455,10 +455,10 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
|||
if $data00 != -9223372036854775807 then
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st51 set tag tag_bigint = -9223372036854775808
|
||||
sql alter table st51 set tag tag_bigint = -9223372036854775808
|
||||
|
||||
sql alter table st51 set tag tag_bigint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_bigint = ''
|
||||
sql_error alter table st51 set tag tag_bigint = 'NULL'
|
||||
sql alter table st51 set tag tag_bigint = ''
|
||||
sql_error alter table st51 set tag tag_bigint = abc379
|
||||
|
||||
####
|
||||
|
@ -476,10 +476,10 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
|||
if $data01 != -32767 then
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st51 set tag tag_smallint = -32768
|
||||
sql alter table st51 set tag tag_smallint = -32768
|
||||
|
||||
sql alter table st51 set tag tag_smallint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_smallint = ''
|
||||
sql_error alter table st51 set tag tag_smallint = 'NULL'
|
||||
sql alter table st51 set tag tag_smallint = ''
|
||||
sql_error alter table st51 set tag tag_smallint = abc379
|
||||
|
||||
####
|
||||
|
@ -495,15 +495,13 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
|
|||
if $data02 != -127 then
|
||||
return -1
|
||||
endi
|
||||
sql_error alter table st51 set tag tag_tinyint = '-128'
|
||||
sql alter table st51 set tag tag_tinyint = '-128'
|
||||
sql_error alter table st51 set tag tag_tinyint = 128
|
||||
sql alter table st51 set tag tag_tinyint = 'NULL'
|
||||
sql_error alter table st51 set tag tag_tinyint = ''
|
||||
sql_error alter table st51 set tag tag_tinyint = 'NULL'
|
||||
sql alter table st51 set tag tag_tinyint = ''
|
||||
sql_error alter table st51 set tag tag_tinyint = abc379
|
||||
|
||||
|
||||
# test end
|
||||
#sql drop database $db
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -356,9 +356,6 @@ if $data03 != 0.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
#TODO
|
||||
return
|
||||
|
||||
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) sliding(20s) order by _wstart desc limit 1 offset 15;
|
||||
if $row != 1 then
|
||||
return -1
|
||||
|
|
|
@ -11,82 +11,54 @@ $db = $dbPrefix
|
|||
|
||||
sql use $db
|
||||
|
||||
#### group by t2,t1 + slimit
|
||||
sql select count(*) from stb group by t2,t1 order by t2 asc slimit 5 soffset 6
|
||||
#### partition by t2,t1 + slimit
|
||||
sql select count(*) from stb partition by t2,t1 slimit 5 soffset 6
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 7 then
|
||||
return -1
|
||||
endi
|
||||
$res = 2 * $rowNum
|
||||
if $data20 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != 8 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## desc
|
||||
sql select count(*) from stb group by t2,t1 order by t2 desc slimit 5 soffset 0
|
||||
if $rows != 5 then
|
||||
sql select count(*),t2,t1 from stb partition by t2,t1 order by t2,t1 asc slimit 5 soffset 0
|
||||
if $rows != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = 2 * $rowNum
|
||||
if $data00 != $res then
|
||||
if $data00 != 300 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 8 then
|
||||
if $data02 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != $rowNum then
|
||||
if $data10 != 300 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 2 then
|
||||
if $data11 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 7 then
|
||||
if $data12 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != $rowNum then
|
||||
if $data20 != 300 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 2 then
|
||||
if $data21 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != 6 then
|
||||
if $data22 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != $rowNum then
|
||||
if $data30 != 300 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data32 != 5 then
|
||||
if $data32 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != $rowNum then
|
||||
if $data40 != 300 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 1 then
|
||||
|
@ -97,87 +69,70 @@ if $data42 != 4 then
|
|||
endi
|
||||
|
||||
### empty result set
|
||||
#sql select count(*) from stb group by t2,t1 order by t2 asc slimit 0 soffset 0
|
||||
#if $rows != 0 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql select count(*) from stb group by t2,t1 order by t2 asc slimit 5 soffset 10
|
||||
#if $rows != 0 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 0 soffset 0
|
||||
if $rows != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#### group by t2 + slimit
|
||||
sql select count(*) from stb group by t2 order by t2 asc slimit 2 soffset 0
|
||||
if $rows != 2 then
|
||||
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 5 soffset 10
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data00 != $res then
|
||||
|
||||
#### partition by t2 + slimit
|
||||
sql select t2, count(*) from stb partition by t2 order by t2 asc slimit 2 soffset 0
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != $res then
|
||||
if $data00 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
if $data10 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 1 then
|
||||
if $data20 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 900 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 900 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 1200 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*) from stb group by t2 order by t2 desc slimit 2 soffset 0
|
||||
if $rows != 2 then
|
||||
sql select t2, count(*) from stb partition by t2 order by t2 desc slimit 2 soffset 0
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
$res = 4 * $rowNum
|
||||
if $data00 != $res then
|
||||
if $data00 != 2 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data10 != $res then
|
||||
if $data10 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 2 then
|
||||
if $data20 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 1 then
|
||||
if $data01 != 1200 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 900 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 900 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*) from stb group by t2 order by t2 asc slimit 2 soffset 1
|
||||
if $rows != 2 then
|
||||
sql select count(*) from stb partition by t2 order by t2 asc slimit 2 soffset 1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data00 != $res then
|
||||
return -1
|
||||
endi
|
||||
$res = 4 * $rowNum
|
||||
if $data10 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*) from stb group by t2 order by t2 desc slimit 2 soffset 1
|
||||
if $rows != 2 then
|
||||
sql select count(*) from stb partition by t2 order by t2 desc slimit 2 soffset 1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data00 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -81,16 +81,15 @@ while $i < 10
|
|||
endw
|
||||
|
||||
sql select t1,t2,tg_added from tb0
|
||||
if $rows != 1 then
|
||||
if $rows != 300 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != tb0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql reset query cache
|
||||
sql select count(*), first(ts) from stb group by tg_added order by tg_added asc slimit 5 soffset 3
|
||||
sql select count(*), first(ts), tg_added from stb partition by tg_added slimit 5 soffset 3
|
||||
if $rows != 5 then
|
||||
print ===== result: $rows
|
||||
return -1
|
||||
|
@ -110,59 +109,12 @@ endi
|
|||
if $data40 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != tb3 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != tb4 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != tb5 then
|
||||
return -1
|
||||
endi
|
||||
if $data32 != tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data42 != tb7 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql alter table tb9 set tag t2 = 3
|
||||
sql select count(*), first(*) from stb group by t2 order by t2 slimit 6 soffset 1
|
||||
sql select count(*), first(*) from stb partition by t2 slimit 6 soffset 1
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data00 != $res then
|
||||
return -1
|
||||
endi
|
||||
#if $data01 != @18-09-17 09:00:00.000@ then
|
||||
# return -1
|
||||
#endi
|
||||
if $data02 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data10 != $res then
|
||||
return -1
|
||||
endi
|
||||
#if $data11 != @18-09-17 09:00:00.000@ then
|
||||
# return -1
|
||||
#endi
|
||||
if $data15 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data24 != 9.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data25 != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ================== restart server to commit data into disk
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
@ -171,7 +123,7 @@ print ================== server restart completed
|
|||
|
||||
sql use $db
|
||||
### repeat above queries
|
||||
sql select count(*), first(ts) from stb group by tg_added order by tg_added asc slimit 5 soffset 3;
|
||||
sql select count(*), first(ts) from stb partition by tg_added slimit 5 soffset 3;
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -190,63 +142,10 @@ endi
|
|||
if $data40 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != tb3 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != tb4 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != tb5 then
|
||||
return -1
|
||||
endi
|
||||
if $data32 != tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data42 != tb7 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), first(*) from stb group by t2 order by t2 slimit 6 soffset 1
|
||||
sql select count(*), first(*) from stb partition by t2 slimit 6 soffset 1
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data00 != $res then
|
||||
return -1
|
||||
endi
|
||||
#if $data01 != @18-09-17 09:00:00.000@ then
|
||||
# return -1
|
||||
#endi
|
||||
if $data02 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
$res = 3 * $rowNum
|
||||
if $data10 != $res then
|
||||
return -1
|
||||
endi
|
||||
#if $data11 != @18-09-17 09:00:00.000@ then
|
||||
# return -1
|
||||
#endi
|
||||
if $data15 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data24 != 9.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data25 != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#sql drop database $db
|
||||
#sql show databases
|
||||
#if $rows != 0 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -30,449 +30,108 @@ $tsu = $tsu + $ts0
|
|||
#sql_error select top(c1, 1) from $stb where ts >= $ts0 and ts <= $tsu slimit 5 offset 1
|
||||
#sql_error select bottom(c1, 1) from $stb where ts >= $ts0 and ts <= $tsu slimit 5 offset 1
|
||||
|
||||
### select from stb + group by + slimit offset
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 slimit 5 soffset 0
|
||||
if $rows != 5 then
|
||||
### select from stb + partition by + slimit offset
|
||||
sql select t1, max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1
|
||||
if $rows != 10 then
|
||||
return -1
|
||||
endi
|
||||
#if $data08 != NULL then
|
||||
#if $data08 != 涛思nchar9 then
|
||||
# return -1
|
||||
#endi
|
||||
$res = $tbPrefix . 0
|
||||
if $data09 != $res then
|
||||
if $data(slm_tb0)[1] != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 1
|
||||
if $data19 != $res then
|
||||
if $data(slm_tb0)[1] != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 4
|
||||
if $data49 != $res then
|
||||
if $data(slm_tb0)[2] != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data(slm_tb0)[3] != 4.500000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#sql reset query cache
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 5
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 5
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 0
|
||||
print res = $res
|
||||
if $data09 != $res then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 4
|
||||
if $data49 != $res then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## asc
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 1
|
||||
if $data09 != $res then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 4
|
||||
if $data39 != $res then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## desc
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 desc slimit 4 soffset 1
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 8
|
||||
if $data09 != $res then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 5
|
||||
if $data39 != $res then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### limit + slimit
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1 limit 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1 limit 0
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1 limit 2 offset 1
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1 limit 2 offset 1
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1,t2 order by t1 asc slimit 4 soffset 1 limit 1 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1,t2 slimit 4 soffset 1 limit 1 offset 0
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 1
|
||||
if $data08 != $res then
|
||||
return -1
|
||||
endi
|
||||
print data09 = $data09
|
||||
if $data09 != 1 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 4
|
||||
if $data38 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data39 != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1,t2 order by t1 desc slimit 4 soffset 1 limit 1 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1,t2 slimit 4 soffset 1 limit 1 offset 0
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 8
|
||||
if $data08 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != 8 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 5
|
||||
if $data38 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data39 != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 group by t1,t2,t3 order by t1 asc slimit 3 soffset 1 limit 1 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 partition by t1,t2,t3 slimit 3 soffset 1 limit 1 offset 0
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 3
|
||||
if $data08 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != 3 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 4
|
||||
if $data18 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data19 != 4 then
|
||||
return -1
|
||||
endi
|
||||
$res = $tbPrefix . 5
|
||||
if $data28 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data29 != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
### slimit + fill
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 0 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 0 offset 0
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 2 offset 0
|
||||
print select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 2 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
|
||||
print select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
|
||||
print $rows $data00 $data01 $data02 $data03
|
||||
if $rows != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != -1 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != -2 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != -2.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data17 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data18 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data19 != slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data29 != slm_tb7 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != -1 then
|
||||
return -1
|
||||
endi
|
||||
if $data36 != -2 then
|
||||
return -1
|
||||
endi
|
||||
if $data39 != slm_tb7 then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data49 != slm_tb8 then
|
||||
return -1
|
||||
endi
|
||||
if $data50 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data59 != slm_tb8 then
|
||||
return -1
|
||||
endi
|
||||
if $data69 != slm_tb9 then
|
||||
return -1
|
||||
endi
|
||||
if $data79 != slm_tb9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
# desc
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 order by t1 desc slimit 4 soffset 4 limit 2 offset 0
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
|
||||
if $rows != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != slm_tb5 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != -1 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != -2 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != -2.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data17 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data18 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data19 != slm_tb5 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data29 != slm_tb4 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != -1 then
|
||||
return -1
|
||||
endi
|
||||
if $data36 != -2 then
|
||||
return -1
|
||||
endi
|
||||
if $data39 != slm_tb4 then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data49 != slm_tb3 then
|
||||
return -1
|
||||
endi
|
||||
if $data50 != @18-09-17 09:05:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data59 != slm_tb3 then
|
||||
return -1
|
||||
endi
|
||||
if $data69 != slm_tb2 then
|
||||
return -1
|
||||
endi
|
||||
if $data79 != slm_tb2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 order by t1 asc slimit 4 soffset 4 limit 2 offset 598
|
||||
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 598
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @18-09-19 10:50:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data09 != slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @18-09-19 10:50:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data13 != 9.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data19 != slm_tb7 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != @18-09-19 10:50:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data24 != 9.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data29 != slm_tb8 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != @18-09-19 10:50:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data35 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data36 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data37 != binary9 then
|
||||
return -1
|
||||
endi
|
||||
if $data38 != 涛思nchar9 then
|
||||
return -1
|
||||
endi
|
||||
if $data39 != slm_tb9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
sql select count(ts) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
if $rows != $tbNum then
|
||||
return -1
|
||||
endi
|
||||
$res = $rowNum + 1
|
||||
if $data00 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data90 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != slm_tb9 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data23 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data34 != 涛思slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data45 != 5.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data56 != 1 then
|
||||
return -1
|
||||
endi
|
||||
$res = $rowNum + 1
|
||||
if $data60 != $res then
|
||||
return -1
|
||||
endi
|
||||
if $data71 != slm_tb2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(c1) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
sql select count(c1) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
if $rows != 10 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data90 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != slm_tb9 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data23 != 7 then
|
||||
return -1
|
||||
endi
|
||||
if $data34 != 涛思slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data45 != 5.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data56 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data60 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data71 != slm_tb2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
## [TBASE-604]
|
||||
#sql_error select count(tbname) from slm_stb0 group by t1
|
||||
#sql_error select count(tbname) from slm_stb0 partition by t1
|
||||
#sql show databases
|
||||
|
||||
## [TBASE-605]
|
||||
sql_error select * from slm_stb0 where t2 >= 2 and t3 <= 9 group by tbname slimit 40 limit 1;
|
||||
|
||||
sql select * from slm_stb0 where t2 >= 2 and t3 <= 9 partition by tbname slimit 40 limit 1;
|
||||
|
||||
##################################################
|
||||
# slm_db1 is a database that contains the exactly the same
|
||||
|
@ -482,6 +141,7 @@ $db = $dbPrefix . 1
|
|||
sql use $db
|
||||
|
||||
###
|
||||
sql reset query cache
|
||||
sql select count(*) from $stb
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
|
@ -491,45 +151,42 @@ if $data00 != $totalNum then
|
|||
endi
|
||||
|
||||
sql select count(c1) from $stb
|
||||
if $rows != 0 then
|
||||
print $data00
|
||||
if $data00 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 asc
|
||||
sql select t1,t2,t3,t4,t5,t6,count(ts) from $stb partition by t1,t2,t3,t4,t5,t6
|
||||
if $rows != $tbNum then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != $rowNum then
|
||||
|
||||
if $data(slm_tb1)[6] != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data90 != $rowNum then
|
||||
if $data(slm_tb2)[6] != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != slm_tb0 then
|
||||
if $data(slm_tb3)[0] != slm_tb3 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 1 then
|
||||
if $data(slm_tb4)[1] != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data23 != 2 then
|
||||
if $data(slm_tb5)[2] != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data34 != 涛思slm_tb3 then
|
||||
if $data(slm_tb6)[3] != 涛思slm_tb6 then
|
||||
return -1
|
||||
endi
|
||||
if $data45 != 4.000000000 then
|
||||
if $data(slm_tb7)[4] != 7.000000000 then
|
||||
return -1
|
||||
endi
|
||||
if $data56 != 1 then
|
||||
if $data(slm_tb8)[5] != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data60 != $rowNum then
|
||||
return -1
|
||||
endi
|
||||
if $data71 != slm_tb7 then
|
||||
return -1
|
||||
endi
|
||||
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
|
||||
sql select count(ts),t1,t2,t3,t4,t5,t6 from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
if $rows != $tbNum then
|
||||
return -1
|
||||
endi
|
||||
|
@ -564,8 +221,8 @@ if $data71 != slm_tb2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select count(c1) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
if $rows != 0 then
|
||||
sql select count(c1) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
|
||||
if $rows != 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -89,10 +89,4 @@ endi
|
|||
#TODO: MOVE IT TO NORMAL CASE
|
||||
sql_error select * from tb1 where not (null);
|
||||
|
||||
sql select sum(1/0) from tb1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -50,7 +50,6 @@ sql select avg(tbcol) from tb1
|
|||
sql select avg(tbcol) from tb1 where ts <= 1601481840000
|
||||
sql select avg(tbcol) as b from tb1
|
||||
sql select avg(tbcol) as b from tb1 interval(1d)
|
||||
goto _OVER
|
||||
sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m)
|
||||
sql select avg(tbcol) as c from stb
|
||||
sql select avg(tbcol) as c from stb where ts <= 1601481840000
|
||||
|
|
|
@ -253,6 +253,9 @@ class TDTestCase:
|
|||
tdSql.execute(f'alter table {self.stbname}_{tb_no} set tag {tag} = {values}')
|
||||
tdSql.query(f'select {tag} from {self.stbname}_{tb_no}')
|
||||
tdSql.checkData(0,0,values)
|
||||
tdSql.execute(f'alter table {self.stbname}_{tb_no} set tag {tag} = null')
|
||||
tdSql.query(f'select {tag} from {self.stbname}_{tb_no}')
|
||||
tdSql.checkData(0,0,None)
|
||||
def alter_check_stb(self):
|
||||
tdSql.prepare()
|
||||
tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict))
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
|
||||
import taos
|
||||
import sys
|
||||
import time
|
||||
import socket
|
||||
import os
|
||||
import threading
|
||||
import math
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
from util.dnodes import *
|
||||
from util.common import *
|
||||
sys.path.append("./7-tmq")
|
||||
from tmqCommon import *
|
||||
|
||||
class TDTestCase:
|
||||
def __init__(self):
|
||||
self.vgroups = 4
|
||||
self.ctbNum = 100
|
||||
self.rowsPerTbl = 1000
|
||||
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), False)
|
||||
|
||||
def prepareTestEnv(self):
|
||||
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
|
||||
paraDict = {'dbName': 'dbt',
|
||||
'dropFlag': 1,
|
||||
'event': '',
|
||||
'vgroups': 1,
|
||||
'stbName': 'stb',
|
||||
'colPrefix': 'c',
|
||||
'tagPrefix': 't',
|
||||
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ctb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'rowsPerTbl': 1000,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 10,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
tmqCom.initConsumerTable()
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdLog.info("create stb")
|
||||
tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"])
|
||||
tdLog.info("create ctb")
|
||||
tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'],
|
||||
ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx'])
|
||||
|
||||
tdLog.info("insert data")
|
||||
tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
|
||||
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
|
||||
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
|
||||
|
||||
tdLog.info("flush db to let data falls into the disk")
|
||||
tdSql.query("flush database %s"%(paraDict['dbName']))
|
||||
return
|
||||
|
||||
def tmqCase1(self):
|
||||
tdLog.printNoPrefix("======== test case 1: ")
|
||||
paraDict = {'dbName': 'dbt',
|
||||
'dropFlag': 1,
|
||||
'event': '',
|
||||
'vgroups': 1,
|
||||
'stbName': 'stb',
|
||||
'colPrefix': 'c',
|
||||
'tagPrefix': 't',
|
||||
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ctb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'rowsPerTbl': 1000,
|
||||
'batchNum': 500,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 5,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
topicNameList = ['topic1']
|
||||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
|
||||
tdLog.info("create topics from stb with filter")
|
||||
queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName'])
|
||||
# sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
|
||||
sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
|
||||
tdLog.info("create topic sql: %s"%sqlString)
|
||||
tdSql.execute(sqlString)
|
||||
# tdSql.query(queryString)
|
||||
# expectRowsList.append(tdSql.getRows())
|
||||
|
||||
# init consume info, and start tmq_sim, then check consume result
|
||||
tdLog.info("insert consume info to consume processor")
|
||||
consumerId = 0
|
||||
expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
|
||||
topicList = topicNameList[0]
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
# after start consume, continue insert some data
|
||||
paraDict['batchNum'] = 100
|
||||
paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl
|
||||
pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
pInsertThread.join()
|
||||
|
||||
tdSql.query(queryString)
|
||||
expectRowsList.append(tdSql.getRows())
|
||||
|
||||
tdLog.info("wait the consume result")
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
|
||||
if expectRowsList[0] != resultList[0]:
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
# tmqCom.checkFileContent(consumerId, queryString)
|
||||
|
||||
tdSql.query("flush database %s"%(paraDict['dbName']))
|
||||
|
||||
for i in range(len(topicNameList)):
|
||||
tmqCom.waitSubscriptionExit(tdSql,topicNameList[i])
|
||||
tdSql.query("drop topic %s"%topicNameList[i])
|
||||
|
||||
tdLog.printNoPrefix("======== test case 1 end ...... ")
|
||||
|
||||
def tmqCase2(self):
|
||||
tdLog.printNoPrefix("======== test case 2: ")
|
||||
paraDict = {'dbName': 'dbt',
|
||||
'dropFlag': 1,
|
||||
'event': '',
|
||||
'vgroups': 1,
|
||||
'stbName': 'stb',
|
||||
'colPrefix': 'c',
|
||||
'tagPrefix': 't',
|
||||
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ctb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'rowsPerTbl': 1000,
|
||||
'batchNum': 500,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 3,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
topicNameList = ['topic1']
|
||||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
|
||||
tdLog.info("create topics from stb with filter")
|
||||
queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName'])
|
||||
# sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
|
||||
sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
|
||||
tdLog.info("create topic sql: %s"%sqlString)
|
||||
tdSql.execute(sqlString)
|
||||
tdSql.query(queryString)
|
||||
expectRowsList.append(tdSql.getRows())
|
||||
totalRowsInserted = expectRowsList[0]
|
||||
|
||||
# init consume info, and start tmq_sim, then check consume result
|
||||
tdLog.info("insert consume info to consume processor")
|
||||
consumerId = 1
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
|
||||
topicList = topicNameList[0]
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor 0")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
tdLog.info("wait the consume result")
|
||||
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
actConsumeRows = resultList[0]
|
||||
|
||||
tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(actConsumeRows, expectrowcnt, totalRowsInserted))
|
||||
if not (expectrowcnt <= actConsumeRows and totalRowsInserted >= actConsumeRows):
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
# reinit consume info, and start tmq_sim, then check consume result
|
||||
tmqCom.initConsumerTable()
|
||||
consumerId = 2
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor 1")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
tdLog.info("wait the consume result")
|
||||
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
actConsumeRows = resultList[0]
|
||||
tdLog.info("act consume rows: %d, expect rows: %d, act insert rows: %d"%(actConsumeRows, expectrowcnt, totalRowsInserted))
|
||||
if not ((actConsumeRows >= expectrowcnt) and (totalRowsInserted > actConsumeRows)):
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
for i in range(len(topicNameList)):
|
||||
tmqCom.waitSubscriptionExit(tdSql,topicNameList[i])
|
||||
tdSql.query("drop topic %s"%topicNameList[i])
|
||||
|
||||
tdLog.printNoPrefix("======== test case 2 end ...... ")
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
self.prepareTestEnv()
|
||||
self.tmqCase1()
|
||||
self.tmqCase2()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
event = threading.Event()
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -17,8 +17,8 @@ from tmqCommon import *
|
|||
|
||||
class TDTestCase:
|
||||
def __init__(self):
|
||||
self.vgroups = 1
|
||||
self.ctbNum = 100
|
||||
self.vgroups = 4
|
||||
self.ctbNum = 1
|
||||
self.rowsPerTbl = 10000
|
||||
|
||||
def init(self, conn, logSql):
|
||||
|
@ -38,9 +38,9 @@ class TDTestCase:
|
|||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ctb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'ctbNum': 1,
|
||||
'rowsPerTbl': 10000,
|
||||
'batchNum': 3000,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 10,
|
||||
'showMsg': 1,
|
||||
|
@ -85,7 +85,7 @@ class TDTestCase:
|
|||
'rowsPerTbl': 10000,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 3,
|
||||
'pollDelay': 5,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
@ -117,17 +117,16 @@ class TDTestCase:
|
|||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
# after start consume, continue insert some data
|
||||
paraDict['batchNum'] = 100
|
||||
paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl
|
||||
tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],
|
||||
ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
|
||||
startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
|
||||
pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
#
|
||||
pInsertThread.join()
|
||||
|
||||
tdSql.query(queryString)
|
||||
expectRowsList.append(tdSql.getRows())
|
||||
|
||||
|
@ -135,15 +134,16 @@ class TDTestCase:
|
|||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
|
||||
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
|
||||
if expectRowsList[0] != resultList[0]:
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
tmqCom.checkFileContent(consumerId, queryString)
|
||||
|
||||
time.sleep(10)
|
||||
tdSql.query("flush database %s"%(paraDict['dbName']))
|
||||
|
||||
for i in range(len(topicNameList)):
|
||||
tmqCom.waitSubscriptionExit(tdSql,topicNameList[i])
|
||||
tdSql.query("drop topic %s"%topicNameList[i])
|
||||
|
||||
tdLog.printNoPrefix("======== test case 1 end ...... ")
|
||||
|
@ -204,13 +204,12 @@ class TDTestCase:
|
|||
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]):
|
||||
tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted))
|
||||
actConsumeRows = resultList[0]
|
||||
|
||||
tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(actConsumeRows, expectrowcnt, totalRowsInserted))
|
||||
if not (expectrowcnt <= actConsumeRows and totalRowsInserted >= actConsumeRows):
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
firstConsumeRows = resultList[0]
|
||||
|
||||
|
||||
# reinit consume info, and start tmq_sim, then check consume result
|
||||
tmqCom.initConsumerTable()
|
||||
consumerId = 2
|
||||
|
@ -224,15 +223,13 @@ class TDTestCase:
|
|||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
actConsumeTotalRows = firstConsumeRows + resultList[0]
|
||||
|
||||
if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows):
|
||||
tdLog.info("act consume rows, first: %d, second: %d "%(firstConsumeRows, resultList[0]))
|
||||
tdLog.info("and sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||
actConsumeRows = resultList[0]
|
||||
tdLog.info("act consume rows: %d, expect rows: %d, act insert rows: %d"%(actConsumeRows, expectrowcnt, totalRowsInserted))
|
||||
if not ((actConsumeRows >= expectrowcnt) and (totalRowsInserted > actConsumeRows)):
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
time.sleep(10)
|
||||
for i in range(len(topicNameList)):
|
||||
tmqCom.waitSubscriptionExit(tdSql,topicNameList[i])
|
||||
tdSql.query("drop topic %s"%topicNameList[i])
|
||||
|
||||
tdLog.printNoPrefix("======== test case 2 end ...... ")
|
||||
|
@ -241,7 +238,7 @@ class TDTestCase:
|
|||
tdSql.prepare()
|
||||
self.prepareTestEnv()
|
||||
self.tmqCase1()
|
||||
# self.tmqCase2()
|
||||
self.tmqCase2()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -635,46 +635,47 @@ class TDTestCase:
|
|||
|
||||
tdSql.execute("create topic %s as select * from %s.%s " %(columnTopicFromCtb,parameterDict['dbName'],ctbName))
|
||||
|
||||
tdSql.error("alter table %s.%s modify column c2 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify column c4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify column c5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify tag t2 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify tag t4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify tag t5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdSql.query("alter table %s.%s set tag t1=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t2='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t3=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t4='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t5='20'"%(parameterDict['dbName'], ctbName))
|
||||
|
||||
tdSql.error("alter table %s.%s rename column c1 c1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c2 c2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c3 c3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c4 c4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c5 c5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t1 t1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t2 t2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t3 t3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t4 t4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t5 t5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
# alter actions allowed: drop column/tag, modify column/tag type, rename column/tag not included in topic
|
||||
tdSql.query("alter table %s.%s add column c6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s add tag t6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
# alter actions prohibited: drop column/tag, modify column/tag type, rename column/tag included in topic
|
||||
tdSql.error("alter table %s.%s drop column c1"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c2"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c3"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c4"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c5"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t1"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t2"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t3"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t4"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t5"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
# must have one tag
|
||||
# tdSql.query("alter table %s.%s drop tag t5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdSql.error("alter table %s.%s modify column c2 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify column c4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify column c5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify tag t2 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify tag t4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify tag t5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdSql.error("alter table %s.%s set tag t1=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t2='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t3=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t4='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t5='20'"%(parameterDict['dbName'], ctbName))
|
||||
|
||||
tdSql.error("alter table %s.%s rename column c1 c1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c2 c2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c3 c3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c4 c4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c5 c5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t1 t1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t2 t2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t3 t3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t4 t4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t5 t5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
# alter actions allowed: drop column/tag, modify column/tag type, rename column/tag not included in topic
|
||||
tdSql.query("alter table %s.%s add column c6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s add tag t6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdLog.printNoPrefix("======== test case 3 end ...... ")
|
||||
|
||||
def tmqCase4(self, cfgPath, buildPath):
|
||||
|
@ -819,6 +820,77 @@ class TDTestCase:
|
|||
|
||||
tdLog.printNoPrefix("======== test case 5 end ...... ")
|
||||
|
||||
def tmqCase6(self, cfgPath, buildPath):
|
||||
tdLog.printNoPrefix("======== test case 6: ")
|
||||
parameterDict = {'cfg': '', \
|
||||
'actionType': 0, \
|
||||
'dbName': 'db6', \
|
||||
'dropFlag': 1, \
|
||||
'vgroups': 4, \
|
||||
'replica': 1, \
|
||||
'stbName': 'stb3', \
|
||||
'ctbPrefix': 'stb3', \
|
||||
'ctbNum': 10, \
|
||||
'rowsPerTbl': 10000, \
|
||||
'batchNum': 23, \
|
||||
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
|
||||
parameterDict['cfg'] = cfgPath
|
||||
|
||||
tdLog.info("create database, super table, child table, normal table")
|
||||
self.create_database(tdSql, parameterDict["dbName"])
|
||||
tdLog.info("======== child table test:")
|
||||
parameterDict['stbName'] = 'stb6'
|
||||
ctbName = 'stb6_0'
|
||||
tdSql.query("create table %s.%s (ts timestamp, c1 int, c2 binary(32), c3 double, c4 binary(32), c5 nchar(10)) tags (t1 int, t2 binary(32), t3 double, t4 binary(32), t5 nchar(10))"%(parameterDict["dbName"],parameterDict['stbName']))
|
||||
tdSql.query("create table %s.%s using %s.%s tags (10, '10', 10, '10', '10')"%(parameterDict["dbName"],ctbName,parameterDict["dbName"],parameterDict['stbName']))
|
||||
|
||||
tdLog.info("create topics from child table")
|
||||
columnTopicFromCtb = 'column_topic_from_ctb6'
|
||||
|
||||
tdSql.execute("create topic %s as select c1, c2, c3 from %s.%s where t1 > 10 and t2 = 'beijign' and sin(t3) < 0" %(columnTopicFromCtb,parameterDict['dbName'],ctbName))
|
||||
|
||||
tdSql.error("alter table %s.%s modify column c1 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify column c4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify column c5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s modify tag t2 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify tag t4 binary(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s modify tag t5 nchar(40)"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdSql.error("alter table %s.%s set tag t1=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t2='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.error("alter table %s.%s set tag t3=20"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t4='20'"%(parameterDict['dbName'], ctbName))
|
||||
tdSql.query("alter table %s.%s set tag t5='20'"%(parameterDict['dbName'], ctbName))
|
||||
|
||||
tdSql.error("alter table %s.%s rename column c1 c1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c2 c2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename column c3 c3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename column c4 c4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename column c5 c5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t1 t1new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t2 t2new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s rename tag t3 t3new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t4 t4new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s rename tag t5 t5new"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
# alter actions allowed: drop column/tag, modify column/tag type, rename column/tag not included in topic
|
||||
tdSql.query("alter table %s.%s add column c6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s add tag t6 float"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
# alter actions prohibited: drop column/tag, modify column/tag type, rename column/tag included in topic
|
||||
tdSql.error("alter table %s.%s drop column c1"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c2"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop column c3"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop column c4"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop column c5"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t1"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t2"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.error("alter table %s.%s drop tag t3"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t4"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
tdSql.query("alter table %s.%s drop tag t5"%(parameterDict['dbName'], parameterDict['stbName']))
|
||||
|
||||
tdLog.printNoPrefix("======== test case 6 end ...... ")
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
|
||||
|
|
|
@ -151,41 +151,6 @@ class TDTestCase:
|
|||
if not (totalConsumeRows == totalRowsFromQury):
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
||||
|
||||
|
||||
# tdLog.info("****************************************************************************")
|
||||
# tmqCom.initConsumerTable()
|
||||
# consumerId = 1
|
||||
# expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2
|
||||
# topicList = topicFromStb1
|
||||
# ifcheckdata = 0
|
||||
# ifManualCommit = 0
|
||||
# keyList = 'group.id:cgrp2,\
|
||||
# enable.auto.commit:true,\
|
||||
# auto.commit.interval.ms:3000,\
|
||||
# auto.offset.reset:earliest'
|
||||
# tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
# tdLog.info("start consume processor")
|
||||
# tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
# expectRows = 1
|
||||
# resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
# totalConsumeRows = 0
|
||||
# for i in range(expectRows):
|
||||
# totalConsumeRows += resultList[i]
|
||||
|
||||
# tdSql.query(queryString)
|
||||
# totalRowsFromQury = tdSql.getRows()
|
||||
|
||||
# tdLog.info("act consume rows: %d, act query rows: %d"%(totalConsumeRows, totalRowsFromQury))
|
||||
# if not (totalConsumeRows == totalRowsFromQury):
|
||||
# tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
||||
# tdLog.info("****************************************************************************")
|
||||
|
||||
tmqCom.waitSubscriptionExit(tdSql, topicFromStb1)
|
||||
tdSql.query("drop topic %s"%topicFromStb1)
|
||||
|
||||
|
@ -259,7 +224,7 @@ class TDTestCase:
|
|||
tdLog.info("create some new child table and insert data ")
|
||||
paraDict["batchNum"] = 100
|
||||
paraDict["ctbPrefix"] = 'newCtb'
|
||||
# tmqCom.insert_data_with_autoCreateTbl(tdSql,paraDict["dbName"],paraDict["stbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"])
|
||||
tmqCom.insert_data_with_autoCreateTbl(tdSql,paraDict["dbName"],paraDict["stbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"])
|
||||
|
||||
tdLog.info("insert process end, and start to check consume result")
|
||||
expectRows = 1
|
||||
|
|
|
@ -0,0 +1,225 @@
|
|||
|
||||
import taos
|
||||
import sys
|
||||
import time
|
||||
import socket
|
||||
import os
|
||||
import threading
|
||||
from enum import Enum
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
from util.dnodes import *
|
||||
sys.path.append("./7-tmq")
|
||||
from tmqCommon import *
|
||||
|
||||
class TDTestCase:
|
||||
def __init__(self):
|
||||
self.snapshot = 0
|
||||
self.vgroups = 4
|
||||
self.ctbNum = 1000
|
||||
self.rowsPerTbl = 10
|
||||
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), False)
|
||||
|
||||
# drop some ntbs
|
||||
def tmqCase1(self):
|
||||
tdLog.printNoPrefix("======== test case 1: ")
|
||||
paraDict = {'dbName': 'dbt',
|
||||
'dropFlag': 1,
|
||||
'event': '',
|
||||
'vgroups': 4,
|
||||
'stbName': 'stb',
|
||||
'colPrefix': 'c',
|
||||
'tagPrefix': 't',
|
||||
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ntb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 1000,
|
||||
'rowsPerTbl': 100,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'endTs': 0,
|
||||
'pollDelay': 5,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 0}
|
||||
paraDict['snapshot'] = self.snapshot
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
tmqCom.initConsumerTable()
|
||||
tdLog.info("start create database....")
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdLog.info("start create normal tables....")
|
||||
tmqCom.create_ntable(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_elm_list=paraDict["colSchema"], colPrefix='c', tblNum=paraDict["ctbNum"])
|
||||
tdLog.info("start insert data into normal tables....")
|
||||
tmqCom.insert_rows_into_ntbl(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_ele_list=paraDict["colSchema"],startTs=paraDict["startTs"], tblNum=paraDict["ctbNum"], rows=paraDict["rowsPerTbl"])
|
||||
|
||||
tdLog.info("create topics from database")
|
||||
topicFromDb = 'topic_dbt'
|
||||
tdSql.execute("create topic %s as database %s" %(topicFromDb, paraDict['dbName']))
|
||||
|
||||
if self.snapshot == 0:
|
||||
consumerId = 0
|
||||
elif self.snapshot == 1:
|
||||
consumerId = 1
|
||||
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||
topicList = topicFromDb
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
keyList = 'group.id:cgrp1,\
|
||||
enable.auto.commit:true,\
|
||||
auto.commit.interval.ms:1000,\
|
||||
auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
tmqCom.getStartConsumeNotifyFromTmqsim()
|
||||
tdLog.info("drop some ntables")
|
||||
# drop 1/4 ctbls from half offset
|
||||
paraDict["ctbStartIdx"] = paraDict["ctbStartIdx"] + int(paraDict["ctbNum"] * 1 / 2)
|
||||
paraDict["ctbNum"] = int(paraDict["ctbNum"] / 4)
|
||||
tmqCom.drop_ctable(tdSql, dbname=paraDict['dbName'], count=paraDict["ctbNum"], default_ctbname_prefix=paraDict["ctbPrefix"], ctbStartIdx=paraDict["ctbStartIdx"])
|
||||
|
||||
tdLog.info("start to check consume result")
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
totalConsumeRows = 0
|
||||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
|
||||
|
||||
if not ((totalConsumeRows >= expectrowcnt * 3/4) and (totalConsumeRows < expectrowcnt)):
|
||||
tdLog.exit("tmq consume rows error with snapshot = 0!")
|
||||
|
||||
tdLog.info("wait subscriptions exit ....")
|
||||
tmqCom.waitSubscriptionExit(tdSql, topicFromDb)
|
||||
|
||||
tdSql.query("drop topic %s"%topicFromDb)
|
||||
tdLog.info("success dorp topic: %s"%topicFromDb)
|
||||
tdLog.printNoPrefix("======== test case 1 end ...... ")
|
||||
|
||||
|
||||
|
||||
# drop some ntbs and create some new ntbs
|
||||
def tmqCase2(self):
|
||||
tdLog.printNoPrefix("======== test case 2: ")
|
||||
paraDict = {'dbName': 'dbt',
|
||||
'dropFlag': 1,
|
||||
'event': '',
|
||||
'vgroups': 4,
|
||||
'stbName': 'stb',
|
||||
'colPrefix': 'c',
|
||||
'tagPrefix': 't',
|
||||
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ntb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 1000,
|
||||
'rowsPerTbl': 100,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'endTs': 0,
|
||||
'pollDelay': 10,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 0}
|
||||
paraDict['snapshot'] = self.snapshot
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
tmqCom.initConsumerTable()
|
||||
tdLog.info("start create database....")
|
||||
tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1)
|
||||
tdLog.info("start create normal tables....")
|
||||
tmqCom.create_ntable(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_elm_list=paraDict["colSchema"], colPrefix='c', tblNum=paraDict["ctbNum"])
|
||||
tdLog.info("start insert data into normal tables....")
|
||||
tmqCom.insert_rows_into_ntbl(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_ele_list=paraDict["colSchema"],startTs=paraDict["startTs"], tblNum=paraDict["ctbNum"], rows=paraDict["rowsPerTbl"])
|
||||
|
||||
tdLog.info("create topics from database")
|
||||
topicFromDb = 'topic_dbt'
|
||||
tdSql.execute("create topic %s as database %s" %(topicFromDb, paraDict['dbName']))
|
||||
|
||||
if self.snapshot == 0:
|
||||
consumerId = 2
|
||||
elif self.snapshot == 1:
|
||||
consumerId = 3
|
||||
|
||||
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2)
|
||||
topicList = topicFromDb
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
keyList = 'group.id:cgrp1,\
|
||||
enable.auto.commit:true,\
|
||||
auto.commit.interval.ms:1000,\
|
||||
auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
|
||||
tmqCom.getStartConsumeNotifyFromTmqsim()
|
||||
tdLog.info("drop some ntables")
|
||||
# drop 1/4 ctbls from half offset
|
||||
paraDict["ctbStartIdx"] = paraDict["ctbStartIdx"] + int(paraDict["ctbNum"] * 1 / 2)
|
||||
paraDict["ctbNum"] = int(paraDict["ctbNum"] / 4)
|
||||
tmqCom.drop_ctable(tdSql, dbname=paraDict['dbName'], count=paraDict["ctbNum"], default_ctbname_prefix=paraDict["ctbPrefix"], ctbStartIdx=paraDict["ctbStartIdx"])
|
||||
|
||||
tdLog.info("start create some new normal tables....")
|
||||
paraDict["ctbPrefix"] = 'newCtb'
|
||||
paraDict["ctbNum"] = self.ctbNum
|
||||
tmqCom.create_ntable(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_elm_list=paraDict["colSchema"], colPrefix='c', tblNum=paraDict["ctbNum"])
|
||||
tdLog.info("start insert data into these new normal tables....")
|
||||
tmqCom.insert_rows_into_ntbl(tsql=tdSql, dbname=paraDict["dbName"], tbname_prefix=paraDict["ctbPrefix"], tbname_index_start_num = 1, column_ele_list=paraDict["colSchema"],startTs=paraDict["startTs"], tblNum=paraDict["ctbNum"], rows=paraDict["rowsPerTbl"])
|
||||
|
||||
tdLog.info("start to check consume result")
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
totalConsumeRows = 0
|
||||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
|
||||
|
||||
if not ((totalConsumeRows >= expectrowcnt / 2 * (1 + 3/4)) and (totalConsumeRows < expectrowcnt)):
|
||||
tdLog.exit("tmq consume rows error with snapshot = 0!")
|
||||
|
||||
tdLog.info("wait subscriptions exit ....")
|
||||
tmqCom.waitSubscriptionExit(tdSql, topicFromDb)
|
||||
|
||||
tdSql.query("drop topic %s"%topicFromDb)
|
||||
tdLog.info("success dorp topic: %s"%topicFromDb)
|
||||
tdLog.printNoPrefix("======== test case 2 end ...... ")
|
||||
|
||||
def run(self):
|
||||
tdLog.printNoPrefix("=============================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
self.snapshot = 0
|
||||
self.tmqCase1()
|
||||
self.tmqCase2()
|
||||
|
||||
# tdLog.printNoPrefix("====================================================================")
|
||||
# tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal")
|
||||
# self.snapshot = 1
|
||||
# self.tmqCase1()
|
||||
# self.tmqCase2()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
event = threading.Event()
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -18,7 +18,7 @@ class TDTestCase:
|
|||
def __init__(self):
|
||||
self.snapshot = 0
|
||||
self.vgroups = 4
|
||||
self.ctbNum = 100
|
||||
self.ctbNum = 1000
|
||||
self.rowsPerTbl = 10
|
||||
|
||||
def init(self, conn, logSql):
|
||||
|
@ -39,9 +39,9 @@ class TDTestCase:
|
|||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ntb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'rowsPerTbl': 1000,
|
||||
'batchNum': 1000,
|
||||
'ctbNum': 1000,
|
||||
'rowsPerTbl': 100,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'endTs': 0,
|
||||
'pollDelay': 5,
|
||||
|
@ -125,9 +125,9 @@ class TDTestCase:
|
|||
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||
'ctbPrefix': 'ntb',
|
||||
'ctbStartIdx': 0,
|
||||
'ctbNum': 100,
|
||||
'rowsPerTbl': 1000,
|
||||
'batchNum': 1000,
|
||||
'ctbNum': 1000,
|
||||
'rowsPerTbl': 100,
|
||||
'batchNum': 100,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'endTs': 0,
|
||||
'pollDelay': 10,
|
||||
|
@ -203,16 +203,16 @@ class TDTestCase:
|
|||
tdLog.printNoPrefix("======== test case 2 end ...... ")
|
||||
|
||||
def run(self):
|
||||
tdLog.printNoPrefix("=============================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
self.snapshot = 0
|
||||
# tdLog.printNoPrefix("=============================================")
|
||||
# tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
|
||||
# self.snapshot = 0
|
||||
# self.tmqCase1()
|
||||
self.tmqCase2()
|
||||
# self.tmqCase2()
|
||||
|
||||
tdLog.printNoPrefix("====================================================================")
|
||||
tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal")
|
||||
self.snapshot = 1
|
||||
# self.tmqCase1()
|
||||
self.tmqCase1()
|
||||
self.tmqCase2()
|
||||
|
||||
def stop(self):
|
|
@ -189,7 +189,7 @@ python3 ./test.py -f 7-tmq/subscribeStb3.py
|
|||
python3 ./test.py -f 7-tmq/subscribeStb4.py
|
||||
python3 ./test.py -f 7-tmq/db.py
|
||||
python3 ./test.py -f 7-tmq/tmqError.py
|
||||
#python3 ./test.py -f 7-tmq/schema.py
|
||||
python3 ./test.py -f 7-tmq/schema.py
|
||||
python3 ./test.py -f 7-tmq/stbFilter.py
|
||||
python3 ./test.py -f 7-tmq/tmqCheckData.py
|
||||
python3 ./test.py -f 7-tmq/tmqCheckData1.py
|
||||
|
@ -210,7 +210,7 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py
|
|||
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py
|
||||
python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py
|
||||
python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py
|
||||
#python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
|
||||
python3 ./test.py -f 7-tmq/tmqDnodeRestart.py
|
||||
python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py
|
||||
python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py
|
||||
python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
|
||||
|
@ -219,12 +219,14 @@ python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
|
|||
python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py
|
||||
python3 ./test.py -f 7-tmq/tmqDropStb.py
|
||||
python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
||||
python3 ./test.py -f 7-tmq/tmqDropNtb.py
|
||||
python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
|
||||
python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py
|
||||
python3 ./test.py -f 7-tmq/tmqUdf.py
|
||||
python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py
|
||||
python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py
|
||||
python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
|
||||
|
||||
python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py
|
||||
python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py
|
||||
# python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py
|
||||
|
||||
#------------querPolicy 2-----------
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue