提交 e14310a5 编写于 作者: S Shengliang Guan

merge from master

......@@ -265,7 +265,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
SSqlCmd* pCmd = &pSql->cmd;
pSub->lastSyncTime = taosGetTimestampMs();
TSDB_QUERY_CLEAR_TYPE(tscGetQueryInfoDetail(pCmd, 0)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0);
if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) {
......@@ -276,6 +276,8 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
taosArrayClear(pSub->progress);
taosArrayPush(pSub->progress, &target);
}
pSub->lastSyncTime = taosGetTimestampMs();
return 1;
}
......@@ -305,7 +307,11 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
}
taosArrayDestroy(tables);
TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
if (pTableMetaInfo->pVgroupTables && taosArrayGetSize(pTableMetaInfo->pVgroupTables) > 0) {
TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
}
pSub->lastSyncTime = taosGetTimestampMs();
return 1;
}
......
......@@ -3572,6 +3572,9 @@ int32_t tsdbGetTableGroupFromIdList(STsdbRepo* tsdb, SArray* pTableIdList, STabl
if (pTable->type == TSDB_SUPER_TABLE) {
tsdbError("direct query on super tale is not allowed, table uid:%"PRIu64", tid:%d", id->uid, id->tid);
terrno = TSDB_CODE_QRY_INVALID_MSG;
tsdbUnlockRepoMeta(tsdb);
taosArrayDestroy(group);
return terrno;
}
tsdbRefTable(pTable);
......
......@@ -265,6 +265,10 @@ static int32_t tKeywordCode(const char* z, int n) {
}
}
if (keywordHashTable == NULL) {
return TK_ILLEGAL;
}
SKeyword** pKey = (SKeyword**)taosHashGet(keywordHashTable, key, n);
return (pKey != NULL)? (*pKey)->type:TK_ID;
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
......@@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
......@@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
......@@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
......@@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
......@@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
......@@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
......@@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册