pRes=taos_query(pConn,"create stable if not exists st1 (ts timestamp, k int) tags(a int)");
pRes=taos_query(pConn,"create stable if not exists st1 (ts timestamp, k int, j varchar(20)) tags(a varchar(20))");
if(taos_errno(pRes)!=0){
if(taos_errno(pRes)!=0){
printf("failed to create super table st1, reason:%s\n",taos_errstr(pRes));
printf("failed to create super table st1, reason:%s\n",taos_errstr(pRes));
return-1;
return-1;
}
}
taos_free_result(pRes);
taos_free_result(pRes);
pRes=taos_query(pConn,"create table if not exists tu1 using st1 tags(1)");
pRes=taos_query(pConn,"create table if not exists tu1 using st1 tags('c1')");
if(taos_errno(pRes)!=0){
if(taos_errno(pRes)!=0){
printf("failed to create child table tu1, reason:%s\n",taos_errstr(pRes));
printf("failed to create child table tu1, reason:%s\n",taos_errstr(pRes));
return-1;
return-1;
}
}
taos_free_result(pRes);
taos_free_result(pRes);
pRes=taos_query(pConn,"create table if not exists tu2 using st1 tags(2)");
pRes=taos_query(pConn,"create table if not exists tu2 using st1 tags('c2')");
if(taos_errno(pRes)!=0){
if(taos_errno(pRes)!=0){
printf("failed to create child table tu2, reason:%s\n",taos_errstr(pRes));
printf("failed to create child table tu2, reason:%s\n",taos_errstr(pRes));
return-1;
return-1;
}
}
taos_free_result(pRes);
taos_free_result(pRes);
pRes=taos_query(pConn,"create table if not exists tu3 using st1 tags(3)");
pRes=taos_query(pConn,"create table if not exists tu3 using st1 tags('c3')");
if(taos_errno(pRes)!=0){
if(taos_errno(pRes)!=0){
printf("failed to create child table tu3, reason:%s\n",taos_errstr(pRes));
printf("failed to create child table tu3, reason:%s\n",taos_errstr(pRes));
return-1;
return-1;
...
@@ -96,7 +96,8 @@ int32_t create_stream() {
...
@@ -96,7 +96,8 @@ int32_t create_stream() {
taos_free_result(pRes);
taos_free_result(pRes);
pRes=taos_query(pConn,
pRes=taos_query(pConn,
"create stream stream1 trigger at_once watermark 10s into outstb as select _wstart start, avg(k) from st1 partition by tbname interval(10s)");
/*"create stream stream1 trigger at_once watermark 10s into outstb as select _wstart start, avg(k) from st1 partition by tbname interval(10s)");*/
"create stream stream2 into outstb subtable(concat(concat(concat('prefix_', tname), '_suffix_'), cast(k1 as varchar(20)))) as select _wstart wstart, avg(k) from st1 partition by tbname tname, a k1 interval(10s);");
if(taos_errno(pRes)!=0){
if(taos_errno(pRes)!=0){
printf("failed to create stream stream1, reason:%s\n",taos_errstr(pRes));
printf("failed to create stream stream1, reason:%s\n",taos_errstr(pRes));