Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
855c7da9
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
855c7da9
编写于
3月 11, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-207]<fix>(query):doCompare fixed
上级
37bda43b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
41 deletion
+17
-41
src/util/src/tcompare.c
src/util/src/tcompare.c
+5
-29
tests/develop-test/2-query/function_mode.py
tests/develop-test/2-query/function_mode.py
+5
-5
tests/develop-test/2-query/function_tail.py
tests/develop-test/2-query/function_tail.py
+5
-5
tests/pytest/query/filterOtherTypes.py
tests/pytest/query/filterOtherTypes.py
+2
-2
未找到文件。
src/util/src/tcompare.c
浏览文件 @
855c7da9
...
...
@@ -750,7 +750,8 @@ int32_t jsonCompareUnit(const char* f1, const char* f2, bool* canReturn){
}
}
int32_t
doCompare
(
const
char
*
f1
,
const
char
*
f2
,
int32_t
type
,
size_t
size
)
{
int32_t
doCompare
(
const
char
*
f1
,
const
char
*
f2
,
int32_t
type
,
size_t
size
)
{
if
(
type
==
TSDB_DATA_TYPE_JSON
){
bool
canReturn
=
true
;
int32_t
result
=
jsonCompareUnit
(
f1
,
f2
,
&
canReturn
);
...
...
@@ -771,33 +772,8 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_NCHAR
:{
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
int32_t
ret
=
memcmp
((
wchar_t
*
)
t1
,
(
wchar_t
*
)
t2
,
t2
->
len
);
if
(
ret
==
0
)
{
return
ret
;
}
return
(
ret
<
0
)
?
-
1
:
1
;
}
default:
{
// todo refactor
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
else
{
int32_t
ret
=
strncmp
(
t1
->
data
,
t2
->
data
,
t1
->
len
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
ret
<
0
?
-
1
:
1
;
}
}
}
case
TSDB_DATA_TYPE_NCHAR
:
return
compareLenPrefixedWStr
(
f1
,
f2
);
default:
// BINARY AND NULL AND SO ON
return
compareLenPrefixedStr
(
f1
,
f2
);
}
}
tests/develop-test/2-query/function_mode.py
浏览文件 @
855c7da9
...
...
@@ -117,15 +117,15 @@ class TDTestCase:
tdSql
.
execute
(
'insert into D002 values("2021-11-17 20:31:31", 1, 3276, true, NULL, 3.32322, 4.982392323, "你好吗", "sdf", 333)'
)
tdSql
.
query
(
'select mode(num) from d002 group by dbinary'
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
3276
)
tdSql
.
checkData
(
1
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
3276
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
'select mode(dfloat) from d002 group by dbinary'
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
1
,
0
,
None
)
tdSql
.
query
(
'select mode(dchar) from d002 group by dbinary'
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"你好吗"
)
tdSql
.
checkData
(
1
,
0
,
"试试"
)
tdSql
.
checkData
(
1
,
0
,
"你好吗"
)
tdSql
.
checkData
(
0
,
0
,
"试试"
)
tdSql
.
query
(
'select mode(dchar) from smode group by dchar'
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
'select mode(dbool) from smode group by dchar'
)
...
...
tests/develop-test/2-query/function_tail.py
浏览文件 @
855c7da9
...
...
@@ -116,10 +116,10 @@ class TDTestCase:
#group by column
tdSql
.
query
(
'select tail(dtiny,2) from tail2 group by dnchar'
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkData
(
0
,
0
,
"2021-10-15 00:31:33"
)
tdSql
.
checkData
(
0
,
1
,
23
)
tdSql
.
checkData
(
2
,
0
,
"2021-12-24 00:31:34"
)
tdSql
.
checkData
(
2
,
1
,
None
)
tdSql
.
checkData
(
2
,
0
,
"2021-10-15 00:31:33"
)
tdSql
.
checkData
(
2
,
1
,
23
)
tdSql
.
checkData
(
1
,
0
,
"2021-12-24 00:31:34"
)
tdSql
.
checkData
(
1
,
1
,
None
)
tdSql
.
checkData
(
4
,
0
,
"2022-01-01 08:00:07"
)
tdSql
.
checkData
(
4
,
1
,
25
)
tdSql
.
query
(
'select tail(dtiny,2,1) from tail2 group by dnchar'
)
...
...
@@ -130,7 +130,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
123
)
tdSql
.
checkData
(
2
,
0
,
"2021-10-17 00:31:31"
)
tdSql
.
checkData
(
2
,
1
,
253
)
tdSql
.
checkData
(
4
,
0
,
"2022-01-01 08:00:07"
)
tdSql
.
checkData
(
6
,
0
,
"2022-01-01 08:00:07"
)
tdSql
.
checkData
(
6
,
1
,
25
)
tdSql
.
query
(
'select tail(dtiny,2,1) from stail group by dnchar'
)
tdSql
.
checkRows
(
5
)
...
...
tests/pytest/query/filterOtherTypes.py
浏览文件 @
855c7da9
...
...
@@ -303,11 +303,11 @@ class TDTestCase:
tdSql
.
checkRows
(
10
)
# > for binary type on tag
tdSql
.
query
(
"select * from st where tagcol3
>
'表'"
)
tdSql
.
query
(
"select * from st where tagcol3
<
'表'"
)
tdSql
.
checkRows
(
10
)
# >= for binary type on tag
tdSql
.
query
(
"select * from st where tagcol3
>
= '表'"
)
tdSql
.
query
(
"select * from st where tagcol3
<
= '表'"
)
tdSql
.
checkRows
(
10
)
# = for binary type on tag
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录