提交 b1d4179d 编写于 作者: H Haojun Liao

[td-225] fix bugs in projection query

上级 20cf90ba
......@@ -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;
......
此差异已折叠。
......@@ -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;
}
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册