未验证 提交 c0a5eeeb 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2001 from taosdata/feature/query

Feature/query
......@@ -638,7 +638,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
(*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * 1);
(*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * pSql->numOfSubs);
if (*pMemBuffer == NULL) {
tscError("%p failed to allocate memory", pSql);
pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY;
......
......@@ -571,7 +571,6 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
pTableIdInfo->key = htobe64(tscGetSubscriptionProgress(pSql->pSubscription, pTableMeta->uid, dfltKey));
pQueryMsg->numOfTables = htonl(1); // set the number of tables
pMsg += sizeof(STableIdInfo);
} else {
int32_t index = pTableMetaInfo->vgroupIndex;
......@@ -601,8 +600,8 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
}
tscTrace("%p vgId:%d, query on table:%s, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name,
pTableMeta->uid);
tscTrace("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name,
pTableMeta->sid, pTableMeta->uid);
return pMsg;
}
......@@ -1869,6 +1868,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
}
free(pTableMeta);
tscTrace("%p recv table meta: %"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->uid, pTableMeta->sid, pTableMetaInfo->name);
return TSDB_CODE_SUCCESS;
}
......
......@@ -6041,6 +6041,8 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi
isSTableQuery = TSDB_QUERY_HAS_TYPE(pQueryMsg->queryType, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
STableIdInfo *id = taosArrayGet(pTableIdList, 0);
qTrace("qmsg:%p query table, uid:%"PRId64", tid:%d", pQueryMsg, id->uid, id->tid);
if ((code = tsdbGetOneTableGroup(tsdb, id->uid, &groupInfo)) != TSDB_CODE_SUCCESS) {
goto _over;
}
......
此差异已折叠。
......@@ -216,14 +216,14 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c
return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH;
}
static UNUSED_FUNC int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
static int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
SPatternCompareInfo pInfo = {'%', '_'};
const char* pattern = pRight;
const char* str = pLeft;
int32_t ret = patternMatch(pattern, str, strlen(str), &pInfo);
char pattern[128] = {0};
memcpy(pattern, varDataVal(pRight), varDataLen(pRight));
assert(varDataLen(pRight) < 128);
int32_t ret = patternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft), &pInfo);
return (ret == TSDB_PATTERN_MATCH) ? 0 : 1;
}
......@@ -232,14 +232,14 @@ static int32_t compareFindStrInArray(const void* pLeft, const void* pRight) {
return taosArraySearchString(arr, pLeft) == NULL ? 0 : 1;
}
static UNUSED_FUNC int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) {
static int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) {
SPatternCompareInfo pInfo = {'%', '_'};
const wchar_t* pattern = pRight;
const wchar_t* str = pLeft;
int32_t ret = WCSPatternMatch(pattern, str, wcslen(str), &pInfo);
wchar_t pattern[128] = {0};
memcpy(pattern, varDataVal(pRight), varDataLen(pRight)/TSDB_NCHAR_SIZE);
assert(varDataLen(pRight) < 128);
int32_t ret = WCSPatternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft)/TSDB_NCHAR_SIZE, &pInfo);
return (ret == TSDB_PATTERN_MATCH) ? 0 : 1;
}
......
......@@ -32,10 +32,10 @@ sql connect
sql create database ir1db days 7
sql use ir1db
sql create table tb(ts timestamp, i int)
sql create table tb(ts timestamp, i bigint)
print ================= step1
sql import into tb values(1520000010000, 10000)
sql import into tb values(1520000010000, 1520000010000)
sql select * from tb;
print $rows
if $rows != 1 then
......@@ -43,7 +43,7 @@ if $rows != 1 then
endi
print ================= step2
sql insert into tb values(1520000008000, 8000)
sql insert into tb values(1520000008000, 1520000008000)
print $rows
sql select * from tb;
if $rows != 2 then
......@@ -51,7 +51,7 @@ if $rows != 2 then
endi
print ================= step3
sql insert into tb values(1520000020000, 20000)
sql insert into tb values(1520000020000, 1520000020000)
sql select * from tb;
print $rows
if $rows != 3 then
......@@ -59,9 +59,9 @@ if $rows != 3 then
endi
print ================= step4
sql import into tb values(1520000009000, 9000)
sql import into tb values(1520000015000, 15000)
sql import into tb values(1520000030000, 30000)
sql import into tb values(1520000009000, 1520000009000)
sql import into tb values(1520000015000, 1520000015000)
sql import into tb values(1520000030000, 1520000030000)
sql select * from tb;
print $rows
if $rows != 6 then
......@@ -69,10 +69,10 @@ if $rows != 6 then
endi
print ================= step5
sql insert into tb values(1520000008000, 8000)
sql insert into tb values(1520000014000, 14000)
sql insert into tb values(1520000025000, 25000)
sql insert into tb values(1520000040000, 40000)
sql insert into tb values(1520000008000, 1520000008000)
sql insert into tb values(1520000014000, 1520000014000)
sql insert into tb values(1520000025000, 1520000025000)
sql insert into tb values(1520000040000, 1520000040000)
sql select * from tb;
print $rows
if $rows != 9 then
......@@ -80,11 +80,11 @@ if $rows != 9 then
endi
print ================= step6
sql import into tb values(1520000007000, 7000)
sql import into tb values(1520000012000, 12000)
sql import into tb values(1520000023000, 23000)
sql import into tb values(1520000034000, 34000)
sql import into tb values(1520000050000, 50000)
sql import into tb values(1520000007000, 1520000007000)
sql import into tb values(1520000012000, 1520000012000)
sql import into tb values(1520000023000, 1520000023000)
sql import into tb values(1520000034000, 1520000034000)
sql import into tb values(1520000050000, 1520000050000)
sql select * from tb;
print $rows
if $rows != 14 then
......@@ -104,11 +104,11 @@ if $rows != 14 then
endi
print ================= step7
sql import into tb values(1520000007001, 7001)
sql import into tb values(1520000012001, 12001)
sql import into tb values(1520000023001, 23001)
sql import into tb values(1520000034001, 34001)
sql import into tb values(1520000050001, 50001)
sql import into tb values(1520000007001, 1520000007001)
sql import into tb values(1520000012001, 1520000012001)
sql import into tb values(1520000023001, 1520000023001)
sql import into tb values(1520000034001, 1520000034001)
sql import into tb values(1520000050001, 1520000050001)
sql select * from tb;
print $rows
if $rows != 19 then
......@@ -117,10 +117,10 @@ if $rows != 19 then
endi
print ================= step8
sql insert into tb values(1520000008002, 8002)
sql insert into tb values(1520000014002, 14002)
sql insert into tb values(1520000025002, 25002)
sql insert into tb values(1520000060000, 60000)
sql insert into tb values(1520000008002, 1520000008002)
sql insert into tb values(1520000014002, 1520000014002)
sql insert into tb values(1520000025002, 1520000025002)
sql insert into tb values(1520000060000, 1520000060000)
sql select * from tb;
print $rows
if $rows != 23 then
......@@ -142,18 +142,18 @@ print ================= step9
#sql import into tb values(now+14d, 50001)
#sql import into tb values(now+16d, 500051)
sql import into tb values(1517408000000, 7003)
sql import into tb values(1518272000000, 34003)
sql import into tb values(1519136000000, 34003)
sql import into tb values(1519568000000, 34003)
sql import into tb values(1519654400000, 50001)
sql import into tb values(1519827200000, 50001)
sql import into tb values(1520345600000, 50001)
sql import into tb values(1520691200000, 50002)
sql import into tb values(1520864000000, 50003)
sql import into tb values(1521900800000, 50004)
sql import into tb values(1523110400000, 50001)
sql import into tb values(1521382400000, 500051)
sql import into tb values(1517408000000, 1517408000000)
sql import into tb values(1518272000000, 1518272000000)
sql import into tb values(1519136000000, 1519136000000)
sql import into tb values(1519568000000, 1519568000000)
sql import into tb values(1519654400000, 1519654400000)
sql import into tb values(1519827200000, 1519827200000)
sql import into tb values(1520345600000, 1520345600000)
sql import into tb values(1520691200000, 1520691200000)
sql import into tb values(1520864000000, 1520864000000)
sql import into tb values(1521900800000, 1521900800000)
sql import into tb values(1523110400000, 1523110400000)
sql import into tb values(1521382400000, 1521382400000)
sql select * from tb;
print $rows
if $rows != 35 then
......@@ -176,7 +176,7 @@ endi
print ================= step11
#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003)
sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5)
sql select * from tb;
if $rows != 40 then
return -1
......@@ -184,8 +184,8 @@ endi
print ================= step12
#1520000000000
#sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003)
sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003)
#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11)
sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14)
sql select * from tb;
print $rows
if $rows != 49 then
......@@ -195,13 +195,13 @@ endi
print ================= step14
#1520000000000
#sql import into tb values(now-48d, 34003)
#sql import into tb values(now-38d, 50001)
#sql import into tb values(now-28d, 50001)
#sql import into tb values(now-48d, -48)
#sql import into tb values(now-38d, -38)
#sql import into tb values(now-28d, -28)
sql import into tb values(1515852800001, 34003)
sql import into tb values(1516716800000, 50001)
sql import into tb values(1517580800000, 50001)
sql import into tb values(1515852800001, -48)
sql import into tb values(1516716800000, -38)
sql import into tb values(1517580800000, -28)
sql select * from tb;
if $rows != 52 then
......
......@@ -65,7 +65,7 @@ sleep 2000
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
#run general/parser/limit1_tb.sim
run general/parser/limit1_tb.sim
run general/parser/limit1_stb.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
......@@ -21,7 +21,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db tblocks 100
sql create database $db cache 16
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int)
......
......@@ -47,19 +47,21 @@ sql select * from $stb order by ts desc limit 5
if $rows != 5 then
return -1
endi
sql select * from $stb order by ts desc limit 5 offset 1
if $rows != 5 then
return -1
endi
if $data01 != 8 then
if $data01 != 9 then
return -1
endi
if $data11 != 7 then
if $data11 != 9 then
return -1
endi
if $data41 != 4 then
if $data41 != 9 then
return -1
endi
sql select * from $stb order by ts asc limit 5
if $rows != 5 then
return -1
......@@ -67,19 +69,28 @@ endi
if $data00 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data40 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data12 != 1 then
print data12 = $data12
if $data12 != NULL then
return -1
endi
if $data24 != 2.000000000 then
if $data24 != NULL then
return -1
endi
if $data35 != 3 then
if $data35 != 0 then
return -1
endi
if $data49 != nchar4 then
if $data49 != nchar0 then
return -1
endi
......@@ -87,10 +98,18 @@ sql select * from $stb order by ts asc limit 5 offset 1
if $rows != 5 then
return -1
endi
if $data01 != 1 then
if $data01 != 0 then
return -1
endi
if $data41 != 5 then
if $data41 != 0 then
return -1
endi
if $data40 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data00 != @18-09-17 09:00:00.000@ then
return -1
endi
......@@ -98,6 +117,7 @@ sql select * from $stb limit 500 offset 1
if $rows != 99 then
return -1
endi
if $data01 != 1 then
return -1
endi
......@@ -629,6 +649,7 @@ endi
if $data09 != 7 then
return -1
endi
print $data13
if $data13 != 0.000000000 then
return -1
endi
......@@ -656,6 +677,8 @@ endi
if $data35 != 0 then
return -1
endi
print $data36
if $data36 != 0.000000000 then
return -1
endi
......@@ -675,49 +698,49 @@ if $data59 != 2 then
return -1
endi
sql select max(c2), min(c2), avg(c2), count(c2), sum(c2), spread(c2), first(c2), last(c2) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1
if $rows != 3 then
return -1
endi
if $data00 != @18-09-17 09:20:00.000@ then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data02 != 2 then
return -1
endi
if $data09 != 4 then
return -1
endi
if $data13 != 3.000000000 then
return -1
endi
if $data19 != 4 then
return -1
endi
if $data20 != @18-09-17 09:40:00.000@ then
return -1
endi
if $data24 != 1 then
return -1
endi
if $data25 != 4 then
return -1
endi
if $data26 != 0.000000000 then
return -1
endi
if $data27 != 4 then
return -1
endi
if $data28 != 4 then
return -1
endi
if $data29 != 4 then
return -1
endi
#sql select max(c2), min(c2), avg(c2), count(c2), sum(c2), spread(c2), first(c2), last(c2) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1
#if $rows != 3 then
# return -1
#endi
#if $data00 != @18-09-17 09:20:00.000@ then
# return -1
#endi
#if $data01 != 2 then
# return -1
#endi
#if $data02 != 2 then
# return -1
#endi
#if $data09 != 4 then
# return -1
#endi
#if $data13 != 3.000000000 then
# return -1
#endi
#if $data19 != 4 then
# return -1
#endi
#if $data20 != @18-09-17 09:40:00.000@ then
# return -1
#endi
#if $data24 != 1 then
# return -1
#endi
#if $data25 != 4 then
# return -1
#endi
#if $data26 != 0.000000000 then
# return -1
#endi
#if $data27 != 4 then
# return -1
#endi
#if $data28 != 4 then
# return -1
#endi
#if $data29 != 4 then
# return -1
#endi
sql select max(c2), min(c2), avg(c2), count(c2), spread(c2), first(c2), last(c2), count(ts) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1
if $rows != 6 then
......
......@@ -38,7 +38,6 @@ sleep 2000
run general/parser/lastrow.sim
sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
......@@ -46,42 +45,45 @@ run general/parser/single_row_in_tb.sim
sleep 2000
run general/parser/select_from_cache_disk.sim
sleep 2000
run general/parser/limit.sim
sleep 2000
run general/parser/fill.sim
sleep 2000
run general/parser/fill_stb.sim
sleep 2000
run general/parser/tags_dynamically_specifiy.sim
run general/parser/selectResNum.sim
sleep 2000
run general/parser/interp.sim
run general/parser/mixed_blocks.sim
sleep 2000
run general/parser/limit1.sim
sleep 2000
run general/parser/limit.sim
sleep 2000
run general/parser/limit1_tblocks100.sim
sleep 2000
run general/parser/select_across_vnodes.sim
sleep 2000
run general/parser/limit2.sim
sleep 2000
run general/parser/mixed_blocks.sim
run general/parser/tbnameIn.sim
sleep 2000
run general/parser/selectResNum.sim
run general/parser/slimit.sim
sleep 2000
run general/parser/select_across_vnodes.sim
run general/parser/slimit1.sim
sleep 2000
run general/parser/set_tag_vals.sim
run general/parser/fill.sim
sleep 2000
run general/parser/slimit.sim
run general/parser/fill_stb.sim
sleep 2000
run general/parser/slimit1.sim
run general/parser/tags_dynamically_specifiy.sim
sleep 2000
run general/parser/interp.sim
sleep 2000
run general/parser/set_tag_vals.sim
sleep 2000
run general/parser/slimit_alter_tags.sim
sleep 2000
run general/parser/stream_on_sys.sim
sleep 2000
run general/parser/stream.sim
sleep 2000
run general/parser/tbnameIn.sim
sleep 2000
run general/parser/where.sim
sleep 2000
......
......@@ -107,6 +107,7 @@ echo "monitorDebugFlag 131" >> $TAOS_CFG
echo "udebugFlag 131" >> $TAOS_CFG
echo "jnidebugFlag 131" >> $TAOS_CFG
echo "sdebugFlag 135" >> $TAOS_CFG
echo "qdebugFlag 135" >> $TAOS_CFG
echo "monitor 0" >> $TAOS_CFG
echo "monitorInterval 1" >> $TAOS_CFG
echo "http 0" >> $TAOS_CFG
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册