diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 2745e4ef87ce2bc4ed7da58f1378c515c036365d..528e646ff02c4c9507d8a771f176de90bb8bc56d 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -985,7 +985,7 @@ void splitStreamSql(const char *str, char **sql, char **to, char **split) { strcpy(*to, p); return ; } - len = p2 - p1 - LABEL_TO_LEN; + len = (int32_t)(p2 - p1 - LABEL_TO_LEN); *to = (char *)tmalloc(len + 1); strncpy(*to, p1 + LABEL_TO_LEN, len); (*to)[len] = 0; // str end diff --git a/tests/pytest/stream/new.py b/tests/pytest/stream/new.py index bf05a1a50fa83df10779542e607595dd929f3524..6b1b797d1a2bdae9c2a56d6ed1f8293e1a74c1d1 100644 --- a/tests/pytest/stream/new.py +++ b/tests/pytest/stream/new.py @@ -27,14 +27,14 @@ class TDTestCase: def run(self): rowNum = 200 tdSql.prepare() - ts_begin = 1633017600000 - + ts_now = 1633017600000 tdLog.info("=============== step1") tdSql.execute("create table mt(ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)") for i in range(5): tdSql.execute("create table tb%d using mt tags(%d)" % (i, i)) for j in range(rowNum): - tdSql.execute("insert into tb%d values(%d, %d, %d)" % (i, ts_begin+j*1000, j, j)) + tdSql.execute("insert into tb%d values(%d, %d, %d)" % (i, ts_now, j, j)) + ts_now += 1000 time.sleep(0.1) tdLog.info("=============== step2") @@ -46,14 +46,15 @@ class TDTestCase: tdSql.waitedQuery("select * from st", 1, 180) delay = int(time.time() - start) + 80 v = tdSql.getData(0, 3) - if v >= 51: - tdLog.exit("value is %d, which is larger than 51" % v) + if v != 10: + tdLog.exit("value is %d, expect is 10." % v) tdLog.info("=============== step4") for i in range(5, 10): tdSql.execute("create table tb%d using mt tags(%d)" % (i, i)) for j in range(rowNum): - tdSql.execute("insert into tb%d values(%d, %d, %d)" % (i, ts_begin+j*1000, j, j)) + tdSql.execute("insert into tb%d values(%d, %d, %d)" % (i, ts_now, j, j)) + ts_now += 1000 tdLog.info("=============== step5") maxValue = 0 @@ -63,11 +64,11 @@ class TDTestCase: v = tdSql.getData(0, 3) if v > maxValue: maxValue = v - if v > 51: + if v >= 10: break - if maxValue <= 51: - tdLog.exit("value is %d, which is smaller than 51" % maxValue) + if maxValue < 10: + tdLog.exit("value is %d, expect is 10" % maxValue) def stop(self): tdSql.close()