Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
521e5163
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
521e5163
编写于
8月 05, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add sample udf cases and compile outside of tdengine
上级
a51fd6d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
9 deletion
+16
-9
tests/script/sh/bit_and.c
tests/script/sh/bit_and.c
+4
-0
tests/script/sh/compile_udf.sh
tests/script/sh/compile_udf.sh
+2
-2
tests/script/sh/sqr_sum.c
tests/script/sh/sqr_sum.c
+1
-1
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+9
-6
未找到文件。
tests/script/sh/bit_and.c
浏览文件 @
521e5163
...
...
@@ -37,6 +37,10 @@ DLL_EXPORT int32_t bit_and(SUdfDataBlock* block, SUdfColumn *resultCol) {
resultData
->
numOfRows
=
block
->
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
resultData
->
numOfRows
;
++
i
)
{
if
(
udfColDataIsNull
(
block
->
udfCols
[
0
],
i
))
{
udfColDataSetNull
(
resultCol
,
i
);
continue
;
}
int32_t
result
=
*
(
int32_t
*
)
udfColDataGetData
(
block
->
udfCols
[
0
],
i
);
int
j
=
1
;
for
(;
j
<
block
->
numOfCols
;
++
j
)
{
...
...
tests/script/sh/compile_udf.sh
100644 → 100755
浏览文件 @
521e5163
...
...
@@ -3,8 +3,8 @@ set +e
rm
-rf
/tmp/udf/libbitand.so /tmp/udf/libsqrsum.so
mkdir
-p
/tmp/udf
echo
"compile udf bit_and and sqr_sum"
gcc
-fPIC
-shared
bit_and.c
-o
/tmp/udf/libbitand.so
gcc
-fPIC
-shared
sqr_sum.c
-o
/tmp/udf/libsqrsum.so
gcc
-fPIC
-shared
sh/
bit_and.c
-o
/tmp/udf/libbitand.so
gcc
-fPIC
-shared
s
h/s
qr_sum.c
-o
/tmp/udf/libsqrsum.so
echo
"debug show /tmp/udf/*.so"
ls
/tmp/udf/
*
.so
tests/script/sh/sqr_sum.c
浏览文件 @
521e5163
...
...
@@ -67,7 +67,7 @@ DLL_EXPORT int32_t sqr_sum(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInt
return
0
;
}
DLL_EXPORT
int32_t
sqr_finish
(
SUdfInterBuf
*
buf
,
SUdfInterBuf
*
resultData
)
{
DLL_EXPORT
int32_t
sqr_
sum_
finish
(
SUdfInterBuf
*
buf
,
SUdfInterBuf
*
resultData
)
{
if
(
buf
->
numOfResult
==
0
)
{
resultData
->
numOfResult
=
0
;
return
0
;
...
...
tests/script/tsim/query/udf.sim
浏览文件 @
521e5163
...
...
@@ -122,22 +122,25 @@ print $rows , $data00 , $data01
if $rows != 1 then
return -1
endi
if $data00 != 1
76.000000000
then
if $data00 != 1
.414213562
then
return -1
endi
if $data01 != 1
52.420471066
then
if $data01 != 1
.414213562
then
return -1
endi
sql select sqr_sum(f2) from udf.t2 group by 1-bit_and(f1);
print $rows , $data00 , $data10
if $rows !=
2
then
sql select sqr_sum(f2) from udf.t2 group by 1-bit_and(f1
, f2) order by 1-bit_and(f1,f2
);
print $rows , $data00 , $data10
, $data20
if $rows !=
3
then
return -1
endi
if $data00 != 2.000000000 then
return -1
endi
if $data10 != 12.083045974 then
if $data10 != 9.055385138 then
return -1
endi
if $data20 != 8.000000000 then
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录