Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f139195f
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看板
提交
f139195f
编写于
12月 06, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance test for math str function
上级
0306a534
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
212 addition
and
161 deletion
+212
-161
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+46
-0
tests/script/general/compute/math_str_func.sim
tests/script/general/compute/math_str_func.sim
+1
-1
tests/script/general/compute/math_str_query1.sim
tests/script/general/compute/math_str_query1.sim
+53
-160
tests/script/general/compute/math_str_query2.sim
tests/script/general/compute/math_str_query2.sim
+111
-0
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
f139195f
...
...
@@ -717,4 +717,5 @@ int32_t getMaximumIdleDurationSec();
void
doInvokeUdf
(
SUdfInfo
*
pUdfInfo
,
SQLFunctionCtx
*
pCtx
,
int32_t
idx
,
int32_t
type
);
int32_t
getColumnDataFromId
(
void
*
param
,
int32_t
id
,
void
**
data
);
void
qInfoLogSSDataBlock
(
SSDataBlock
*
block
);
#endif // TDENGINE_QEXECUTOR_H
src/query/src/qExecutor.c
浏览文件 @
f139195f
...
...
@@ -9373,3 +9373,49 @@ void freeQueryAttr(SQueryAttr* pQueryAttr) {
}
}
void
qInfoLogSSDataBlock
(
SSDataBlock
*
block
)
{
if
(
block
==
NULL
)
{
qInfo
(
"SSDataBlock : NULL"
);
return
;
}
qInfo
(
"SSDataBlock rows:%d, cols:%d, tid:%d, uid:%"
PRId64
", skey:%"
PRId64
", ekey:%"
PRId64
,
block
->
info
.
rows
,
block
->
info
.
numOfCols
,
block
->
info
.
tid
,
block
->
info
.
uid
,
block
->
info
.
window
.
skey
,
block
->
info
.
window
.
ekey
);
if
(
block
->
pBlockStatis
!=
NULL
)
{
qInfo
(
"SSDataBlock statics: null %d, max %"
PRId64
", min %"
PRId64
", colId %d, maxIndex %d, minIndex %d, colId %d, sum %"
PRId64
,
block
->
pBlockStatis
->
numOfNull
,
block
->
pBlockStatis
->
max
,
block
->
pBlockStatis
->
min
,
block
->
pBlockStatis
->
colId
,
block
->
pBlockStatis
->
maxIndex
,
block
->
pBlockStatis
->
minIndex
,
block
->
pBlockStatis
->
colId
,
block
->
pBlockStatis
->
sum
);
}
for
(
int
i
=
0
;
i
<
block
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
infoData
=
taosArrayGet
(
block
->
pDataBlock
,
i
);
qInfo
(
"column %d, bytes %d, colId %d, type %d"
,
i
,
infoData
->
info
.
bytes
,
infoData
->
info
.
colId
,
infoData
->
info
.
type
);
for
(
int
j
=
0
;
j
<
block
->
info
.
rows
;
++
j
)
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
infoData
->
info
.
type
))
{
int64_t
v
;
GET_TYPED_DATA
(
v
,
int64_t
,
infoData
->
info
.
type
,
infoData
->
pData
+
j
*
infoData
->
info
.
bytes
);
qInfo
(
"%d, %"
PRId64
,
j
,
v
);
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
infoData
->
info
.
type
))
{
uint64_t
v
;
GET_TYPED_DATA
(
v
,
uint64_t
,
infoData
->
info
.
type
,
infoData
->
pData
+
j
*
infoData
->
info
.
bytes
);
qInfo
(
"%d, %"
PRIu64
,
j
,
v
);
}
else
if
(
IS_FLOAT_TYPE
(
infoData
->
info
.
type
))
{
double
v
;
GET_TYPED_DATA
(
v
,
double
,
infoData
->
info
.
type
,
infoData
->
pData
+
j
*
infoData
->
info
.
bytes
);
qInfo
(
"%d, %lf"
,
j
,
v
);
}
else
if
(
infoData
->
info
.
type
==
TSDB_DATA_TYPE_BOOL
)
{
bool
v
;
GET_TYPED_DATA
(
v
,
bool
,
infoData
->
info
.
type
,
infoData
->
pData
+
j
*
infoData
->
info
.
bytes
);
qInfo
(
"%d, %s"
,
j
,
v
?
"true"
:
"false"
);
}
else
if
(
infoData
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
int64_t
v
;
GET_TYPED_DATA
(
v
,
int64_t
,
infoData
->
info
.
type
,
infoData
->
pData
+
j
*
infoData
->
info
.
bytes
);
qInfo
(
"%d, %"
PRId64
,
j
,
v
);
}
else
{
qInfo
(
"can not print binary or nchar"
);
}
}
}
}
tests/script/general/compute/math_str_func.sim
浏览文件 @
f139195f
...
...
@@ -99,7 +99,7 @@ sql insert into tba1 values ('2021-11-11 09:00:28',true, 9,9,9,9,9,9,"999","9999
sql insert into tba1 values ('2021-11-11 09:00:29',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);
run general/compute/math_str_query1.sim
#
run general/compute/math_str_query2.sim
run general/compute/math_str_query2.sim
#run general/compute/math_str_query3.sim
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
...
...
tests/script/general/compute/math_str_query1.sim
浏览文件 @
f139195f
...
...
@@ -28,6 +28,7 @@ print execute sql select sqrt(c1 + c2) from tb1;
sql_error select sqrt(c1 + c2) from tb1;
print execute sql select sqrt(13) from tb1;
sql select sqrt(13) from tb1;
print $data00
if $data00 != @3.605551275@ then
return -1
endi
...
...
@@ -595,58 +596,58 @@ if $data80 != @1.414213562@ then
return -1
endi
endi
print execute sql select sqrt(c4),t1 from stb1 order by ts desc;
#sql select sqrt(c4),t1
from stb1 order by ts desc;
#
if $data00 != @2.645751311@ then
#
if $data00 != @-nan@ then
#
return -1
#
endi
#
endi
#
if $data01 != @2@ then
#
if $data01 != @1@ then
#endi
# return -1
#
endi
#
if $data20 != @2.449489743@ then
#
if $data20 != @46340.950001052@ then
#
return -1
#
endi
#
endi
#
if $data21 != @2@ then
#
if $data21 != @1@ then
#
return -1
#
endi
#
endi
#
if $data40 != @2.236067977@ then
#
if $data40 != @2.000000000@ then
#
return -1
#
endi
#
endi
#
if $data41 != @2@ then
#
if $data41 != @1@ then
#
return -1
#
endi
#
endi
#
if $data60 != @2.000000000@ then
#
if $data60 != NULL then
#
return -1
#
endi
#
endi
#
if $data61 != @2@ then
#
if $data61 != @1@ then
#
return -1
#
endi
#
endi
#
if $data80 != @1.414213562@ then
#
if $data80 != @1.414213562@ then
#
return -1
#
endi
#
endi
#
if $data81 != @2@ then
#
if $data81 != @1@ then
#
return -1
#
endi
#
endi
print execute sql select sqrt(c4),t1
,c4
from stb1 order by ts desc;
sql select sqrt(c4),t1,c4
from stb1 order by ts desc;
if $data00 != @2.645751311@ then
if $data00 != @-nan@ then
return -1
endi
endi
if $data01 != @2@ then
if $data01 != @1@ then
return -1
endi
endi
if $data20 != @2.449489743@ then
if $data20 != @46340.950001052@ then
return -1
endi
endi
if $data21 != @2@ then
if $data21 != @1@ then
return -1
endi
endi
if $data40 != @2.236067977@ then
if $data40 != @2.000000000@ then
return -1
endi
endi
if $data41 != @2@ then
if $data41 != @1@ then
return -1
endi
endi
if $data60 != @2.000000000@ then
if $data60 != NULL then
return -1
endi
endi
if $data61 != @2@ then
if $data61 != @1@ then
return -1
endi
endi
if $data80 != @1.414213562@ then
if $data80 != @1.414213562@ then
return -1
endi
endi
if $data81 != @2@ then
if $data81 != @1@ then
return -1
endi
endi
print execute sql select sqrt(c3),tbname from stb1;
sql select sqrt(c3),tbname from stb1;
if $data00 != @1.000000000@ then
...
...
@@ -1073,111 +1074,3 @@ endi
if $data90 != @1.732050808@ then
return -1
endi
print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
#sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data01 != @1.000000000@ then
# return -1
#endi
#if $data10 != NULL then
# return -1
#endi
#if $data11 != @1.414213562@ then
# return -1
#endi
#if $data20 != @1.414213562@ then
# return -1
#endi
#if $data21 != @1.732050808@ then
# return -1
#endi
#if $data30 != NULL then
# return -1
#endi
#if $data31 != @2.000000000@ then
# return -1
#endi
#if $data40 != @2.000000000@ then
# return -1
#endi
#if $data41 != @2.236067977@ then
# return -1
#endi
#if $data50 != @46340.950001052@ then
# return -1
#endi
#if $data51 != @2.449489743@ then
# return -1
#endi
#if $data60 != @-nan@ then
# return -1
#endi
#if $data61 != @2.645751311@ then
# return -1
#endi
#print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
#sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data10 != NULL then
# return -1
#endi
#if $data20 != @1.414213562@ then
# return -1
#endi
#if $data30 != NULL then
# return -1
#endi
#if $data40 != @2.000000000@ then
# return -1
#endi
#if $data50 != @46340.950001052@ then
# return -1
#endi
#if $data60 != @-nan@ then
# return -1
#endi
#if $data70 != @1.000000000@ then
# return -1
#endi
#if $data80 != @1.414213562@ then
# return -1
#endi
#if $data90 != @1.414213562@ then
# return -1
#endi
#print execute sql select sqrt(c2) from stba;
#sql select sqrt(c2) from stba;
#if $data00 != @1.000000000@ then
# return -1
#endi
#if $data10 != @1.414213562@ then
# return -1
#endi
#if $data20 != @1.732050808@ then
# return -1
#endi
#if $data30 != @2.000000000@ then
# return -1
#endi
#if $data40 != @2.236067977@ then
# return -1
#endi
#if $data50 != @2.449489743@ then
# return -1
#endi
#if $data60 != @2.645751311@ then
# return -1
#endi
#if $data70 != @2.828427125@ then
# return -1
#endi
#if $data80 != @3.000000000@ then
# return -1
#endi
#if $data90 != @0.000000000@ then
# return -1
#endi
tests/script/general/compute/math_str_query2.sim
0 → 100644
浏览文件 @
f139195f
sleep 100
sql connect
sql use db;
print execute sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
sql select sqrt(stb1.c4),sqrt(stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts;
if $data00 != @1.000000000@ then
return -1
endi
if $data01 != @1.000000000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @1.414213562@ then
return -1
endi
if $data20 != @1.414213562@ then
return -1
endi
if $data21 != @1.732050808@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @2.000000000@ then
return -1
endi
if $data40 != @2.000000000@ then
return -1
endi
if $data41 != @2.236067977@ then
return -1
endi
if $data50 != @46340.950001052@ then
return -1
endi
if $data51 != @2.449489743@ then
return -1
endi
if $data60 != @-nan@ then
return -1
endi
if $data61 != @2.645751311@ then
return -1
endi
print execute sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
sql select sqrt(c4) as a from stb1 union all select sqrt(c5) as a from stba;
if $data00 != @1.000000000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data20 != @1.414213562@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data40 != @2.000000000@ then
return -1
endi
if $data50 != @46340.950001052@ then
return -1
endi
if $data60 != @-nan@ then
return -1
endi
if $data70 != @1.000000000@ then
return -1
endi
if $data80 != @1.414213562@ then
return -1
endi
if $data90 != @1.414213562@ then
return -1
endi
print execute sql select sqrt(c2) from stba;
sql select sqrt(c2) from stba;
if $data00 != @1.000000000@ then
return -1
endi
if $data10 != @1.414213562@ then
return -1
endi
if $data20 != @1.732050808@ then
return -1
endi
if $data30 != @2.000000000@ then
return -1
endi
if $data40 != @2.236067977@ then
return -1
endi
if $data50 != @2.449489743@ then
return -1
endi
if $data60 != @2.645751311@ then
return -1
endi
if $data70 != @2.828427125@ then
return -1
endi
if $data80 != @3.000000000@ then
return -1
endi
if $data90 != @0.000000000@ then
return -1
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录