Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f49b4879
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f49b4879
编写于
9月 14, 2021
作者:
W
wpan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case issues
上级
60a996cb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
44 deletion
+61
-44
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/query/src/qFilter.c
src/query/src/qFilter.c
+12
-28
tests/pytest/query/filterOtherTypes.py
tests/pytest/query/filterOtherTypes.py
+16
-8
tests/script/general/parser/between_and.sim
tests/script/general/parser/between_and.sim
+2
-2
tests/script/general/parser/condition_query2.sim
tests/script/general/parser/condition_query2.sim
+26
-0
tests/script/general/parser/tbnameIn_query.sim
tests/script/general/parser/tbnameIn_query.sim
+4
-5
未找到文件。
src/kit/shell/src/shellEngine.c
浏览文件 @
f49b4879
...
...
@@ -569,7 +569,7 @@ static void shellPrintNChar(const char *str, int length, int width) {
while
(
pos
<
length
)
{
wchar_t
wc
;
int
bytes
=
mbtowc
(
&
wc
,
str
+
pos
,
MB_CUR_MAX
);
if
(
bytes
=
=
0
)
{
if
(
bytes
<
=
0
)
{
break
;
}
pos
+=
bytes
;
...
...
src/query/src/qFilter.c
浏览文件 @
f49b4879
...
...
@@ -937,7 +937,7 @@ int32_t filterAddUnitToGroup(SFilterGroup *group, uint16_t unitIdx) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
filterConvertSetFromBinary
(
void
**
q
,
const
char
*
buf
,
int32_t
len
,
uint32_t
tType
)
{
int32_t
filterConvertSetFromBinary
(
void
**
q
,
const
char
*
buf
,
int32_t
len
,
uint32_t
tType
,
bool
tolower
)
{
SBufferReader
br
=
tbufInitReader
(
buf
,
len
,
false
);
uint32_t
sType
=
tbufReadUint32
(
&
br
);
SHashObj
*
pObj
=
taosHashInit
(
256
,
taosGetDefaultHashFunction
(
tType
),
true
,
false
);
...
...
@@ -1113,6 +1113,7 @@ int32_t filterConvertSetFromBinary(void **q, const char *buf, int32_t len, uint3
}
t
=
varDataLen
(
tmp
);
pvar
=
varDataVal
(
tmp
);
strntolower_s
(
pvar
,
pvar
,
t
);
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
...
...
@@ -1157,7 +1158,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g
if
(
tree
->
_node
.
optr
==
TSDB_RELATION_IN
&&
(
!
IS_VAR_DATA_TYPE
(
type
)))
{
void
*
data
=
NULL
;
filterConvertSetFromBinary
((
void
**
)
&
data
,
var
->
pz
,
var
->
nLen
,
type
);
filterConvertSetFromBinary
((
void
**
)
&
data
,
var
->
pz
,
var
->
nLen
,
type
,
false
);
CHK_LRET
(
data
==
NULL
,
TSDB_CODE_QRY_APP_ERROR
,
"failed to convert in param"
);
if
(
taosHashGetSize
((
SHashObj
*
)
data
)
<=
0
)
{
...
...
@@ -1798,7 +1799,10 @@ int32_t filterInitValFieldData(SFilterInfo *info) {
}
if
(
unit
->
compare
.
optr
==
TSDB_RELATION_IN
)
{
filterConvertSetFromBinary
((
void
**
)
&
fi
->
data
,
var
->
pz
,
var
->
nLen
,
type
);
SSchema
*
sch
=
FILTER_UNIT_COL_DESC
(
info
,
unit
);
bool
tolower
=
(
sch
->
colId
==
-
1
)
?
true
:
false
;
filterConvertSetFromBinary
((
void
**
)
&
fi
->
data
,
var
->
pz
,
var
->
nLen
,
type
,
tolower
);
CHK_LRET
(
fi
->
data
==
NULL
,
TSDB_CODE_QRY_APP_ERROR
,
"failed to convert in param"
);
FILTER_SET_FLAG
(
fi
->
flag
,
FLD_DATA_IS_HASH
);
...
...
@@ -2531,8 +2535,6 @@ int32_t filterPostProcessRange(SFilterInfo *info) {
int32_t
filterGenerateComInfo
(
SFilterInfo
*
info
)
{
uint16_t
n
=
0
;
info
->
cunits
=
malloc
(
info
->
unitNum
*
sizeof
(
*
info
->
cunits
));
info
->
blkUnitRes
=
malloc
(
sizeof
(
*
info
->
blkUnitRes
)
*
info
->
unitNum
);
info
->
blkUnits
=
malloc
(
sizeof
(
*
info
->
blkUnits
)
*
(
info
->
unitNum
+
1
)
*
info
->
groupNum
);
...
...
@@ -2560,24 +2562,6 @@ int32_t filterGenerateComInfo(SFilterInfo *info) {
info
->
cunits
[
i
].
dataSize
=
FILTER_UNIT_COL_SIZE
(
info
,
unit
);
info
->
cunits
[
i
].
dataType
=
FILTER_UNIT_DATA_TYPE
(
unit
);
}
uint16_t
cgroupNum
=
info
->
groupNum
+
1
;
for
(
uint16_t
i
=
0
;
i
<
info
->
groupNum
;
++
i
)
{
cgroupNum
+=
info
->
groups
[
i
].
unitNum
;
}
info
->
cgroups
=
malloc
(
cgroupNum
*
sizeof
(
*
info
->
cgroups
));
for
(
uint16_t
i
=
0
;
i
<
info
->
groupNum
;
++
i
)
{
info
->
cgroups
[
n
++
]
=
info
->
groups
[
i
].
unitNum
;
for
(
uint16_t
m
=
0
;
m
<
info
->
groups
[
i
].
unitNum
;
++
m
)
{
info
->
cgroups
[
n
++
]
=
info
->
groups
[
i
].
unitIdxs
[
m
];
}
}
info
->
cgroups
[
n
]
=
0
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2887,7 +2871,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows,
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
uint16_t
uidx
=
info
->
groups
[
0
].
unitIdxs
[
0
];
void
*
colData
=
(
char
*
)
info
->
cunits
[
uidx
].
colData
+
info
->
cunits
[
uidx
].
dataSize
*
i
;
(
*
p
)[
i
]
=
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
);
(
*
p
)[
i
]
=
((
colData
==
NULL
)
||
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
)
);
if
((
*
p
)[
i
]
==
0
)
{
all
=
false
;
}
...
...
@@ -2910,7 +2894,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
uint16_t
uidx
=
info
->
groups
[
0
].
unitIdxs
[
0
];
void
*
colData
=
(
char
*
)
info
->
cunits
[
uidx
].
colData
+
info
->
cunits
[
uidx
].
dataSize
*
i
;
(
*
p
)[
i
]
=
!
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
);
(
*
p
)[
i
]
=
((
colData
!=
NULL
)
&&
!
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
)
);
if
((
*
p
)[
i
]
==
0
)
{
all
=
false
;
}
...
...
@@ -2938,7 +2922,7 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SDataSta
}
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
if
(
isNull
(
colData
,
info
->
cunits
[
0
].
dataType
))
{
if
(
colData
==
NULL
||
isNull
(
colData
,
info
->
cunits
[
0
].
dataType
))
{
all
=
false
;
colData
+=
dataSize
;
continue
;
...
...
@@ -2971,7 +2955,7 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SDataStat
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
uint16_t
uidx
=
info
->
groups
[
0
].
unitIdxs
[
0
];
void
*
colData
=
(
char
*
)
info
->
cunits
[
uidx
].
colData
+
info
->
cunits
[
uidx
].
dataSize
*
i
;
if
(
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
))
{
if
(
colData
==
NULL
||
isNull
(
colData
,
info
->
cunits
[
uidx
].
dataType
))
{
(
*
p
)[
i
]
=
0
;
all
=
false
;
continue
;
...
...
@@ -3015,7 +2999,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis *
//} else {
uint8_t
optr
=
cunit
->
optr
;
if
(
isNull
(
colData
,
cunit
->
dataType
))
{
if
(
colData
==
NULL
||
isNull
(
colData
,
cunit
->
dataType
))
{
(
*
p
)[
i
]
=
optr
==
TSDB_RELATION_ISNULL
?
true
:
false
;
}
else
{
if
(
optr
==
TSDB_RELATION_NOTNULL
)
{
...
...
tests/pytest/query/filterOtherTypes.py
浏览文件 @
f49b4879
...
...
@@ -80,10 +80,12 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tbcol1 like '____'"
)
# > for nchar type on column
tdSql
.
error
(
"select * from st where tbcol2 > 'taosdata'"
)
tdSql
.
query
(
"select * from st where tbcol2 > 'taosdata'"
)
tdSql
.
checkRows
(
10
)
# >= for nchar type on column
tdSql
.
error
(
"select * from st where tbcol2 >= 'taosdata'"
)
tdSql
.
query
(
"select * from st where tbcol2 >= 'taosdata'"
)
tdSql
.
checkRows
(
10
)
# = for nchar type on column
tdSql
.
query
(
"select * from st where tbcol2 = 'taosdata1'"
)
...
...
@@ -98,10 +100,12 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
# > for nchar type on column
tdSql
.
error
(
"select * from st where tbcol2 < 'taodata'"
)
tdSql
.
query
(
"select * from st where tbcol2 < 'taodata'"
)
tdSql
.
checkRows
(
0
)
# >= for nchar type on column
tdSql
.
error
(
"select * from st where tbcol2 <= 'taodata'"
)
tdSql
.
query
(
"select * from st where tbcol2 <= 'taodata'"
)
tdSql
.
checkRows
(
0
)
# % for nchar type on column case 1
tdSql
.
query
(
"select * from st where tbcol2 like '%'"
)
...
...
@@ -140,10 +144,12 @@ class TDTestCase:
tdSql
.
checkRows
(
10
)
# > for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 > '涛思数据'"
)
tdSql
.
query
(
"select * from st where tbcol3 > '涛思数据'"
)
tdSql
.
checkRows
(
10
)
# >= for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 >= '涛思数据'"
)
tdSql
.
query
(
"select * from st where tbcol3 >= '涛思数据'"
)
tdSql
.
checkRows
(
10
)
# = for binary type on column
tdSql
.
query
(
"select * from st where tbcol3 = '涛思数据1'"
)
...
...
@@ -158,10 +164,12 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
# > for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 < '涛思数据'"
)
tdSql
.
query
(
"select * from st where tbcol3 < '涛思数据'"
)
tdSql
.
checkRows
(
0
)
# >= for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 <= '涛思数据'"
)
tdSql
.
query
(
"select * from st where tbcol3 <= '涛思数据'"
)
tdSql
.
checkRows
(
0
)
# % for binary type on column case 1
tdSql
.
query
(
"select * from st where tbcol3 like '%'"
)
...
...
tests/script/general/parser/between_and.sim
浏览文件 @
f49b4879
...
...
@@ -159,7 +159,7 @@ if $data11 != 3 then
endi
sql_error select * from st2 where f7 between 2.0 and 3.0;
sql
_error
select * from st2 where f8 between 2.0 and 3.0;
sql
_error
select * from st2 where f9 between 2.0 and 3.0;
sql select * from st2 where f8 between 2.0 and 3.0;
sql select * from st2 where f9 between 2.0 and 3.0;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/general/parser/condition_query2.sim
浏览文件 @
f49b4879
...
...
@@ -655,6 +655,32 @@ if $data80 != @21-05-05 18:19:38.000@ then
return -1
endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2');
if $rows != 12 then
return -1
endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2') or tbname in ('tb5_3');
if $rows != 16 then
return -1
endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2') and tbname in ('tb5_2');
if $rows != 4 then
return -1
endi
if $data00 != @21-05-05 18:19:08.000@ then
return -1
endi
if $data10 != @21-05-05 18:19:09.000@ then
return -1
endi
if $data20 != @21-05-05 18:19:10.000@ then
return -1
endi
if $data30 != @21-05-05 18:19:11.000@ then
return -1
endi
print "tag test"
sql_error select * from stb5 where t1 match '.*';
sql_error select * from stb5 where t2 match '.*';
...
...
tests/script/general/parser/tbnameIn_query.sim
浏览文件 @
f49b4879
...
...
@@ -125,11 +125,10 @@ if $data21 != 2 then
return -1
endi
# multiple tbname in is not allowed NOW
sql_error select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
#if $rows != 4 then
# return -1
#endi
sql select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
if $rows != 0 then
return -1
endi
#if $data00 != $rowNum then
# return -1
#endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录