Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
99b424b1
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看板
提交
99b424b1
编写于
5月 18, 2023
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add test case
上级
4db88e8f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
81 addition
and
4 deletion
+81
-4
tests/script/output.txt
tests/script/output.txt
+6
-0
tests/script/sh/l2norm2.c
tests/script/sh/l2norm2.c
+71
-0
tests/script/tsim/parser/join_manyblocks.sim
tests/script/tsim/parser/join_manyblocks.sim
+4
-4
未找到文件。
tests/script/output.txt
0 → 100644
浏览文件 @
99b424b1
[03/30 08:08:52.140115] ERROR: failed to connect native (null):6030, code: 0x8000000b, reason: Unable to establish connection
[03/30 08:08:52.140136] ERROR: insert test process failed
[03/30 08:09:02.860424] ERROR: failed to connect native (null):6030, code: 0x8000000b, reason: Unable to establish connection
[03/30 08:09:02.860445] ERROR: insert test process failed
[03/30 08:10:57.082603] ERROR: failed to connect native (null):6030, code: 0x8000000b, reason: Unable to establish connection
[03/30 08:10:57.082626] ERROR: insert test process failed
tests/script/sh/l2norm2.c
0 → 100644
浏览文件 @
99b424b1
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "taosudf.h"
DLL_EXPORT
int32_t
l2norm2_init
()
{
return
0
;
}
DLL_EXPORT
int32_t
l2norm2_destroy
()
{
return
0
;
}
DLL_EXPORT
int32_t
l2norm2_start
(
SUdfInterBuf
*
buf
)
{
*
(
int64_t
*
)(
buf
->
buf
)
=
0
;
buf
->
bufLen
=
sizeof
(
double
);
buf
->
numOfResult
=
1
;
return
0
;
}
DLL_EXPORT
int32_t
l2norm2
(
SUdfDataBlock
*
block
,
SUdfInterBuf
*
interBuf
,
SUdfInterBuf
*
newInterBuf
)
{
double
sumSquares
=
*
(
double
*
)
interBuf
->
buf
;
int8_t
numNotNull
=
0
;
for
(
int32_t
i
=
0
;
i
<
block
->
numOfCols
;
++
i
)
{
SUdfColumn
*
col
=
block
->
udfCols
[
i
];
if
(
!
(
col
->
colMeta
.
type
==
TSDB_DATA_TYPE_INT
||
col
->
colMeta
.
type
==
TSDB_DATA_TYPE_DOUBLE
))
{
return
TSDB_CODE_UDF_INVALID_INPUT
;
}
}
for
(
int32_t
i
=
0
;
i
<
block
->
numOfCols
;
++
i
)
{
for
(
int32_t
j
=
0
;
j
<
block
->
numOfRows
;
++
j
)
{
SUdfColumn
*
col
=
block
->
udfCols
[
i
];
if
(
udfColDataIsNull
(
col
,
j
))
{
continue
;
}
switch
(
col
->
colMeta
.
type
)
{
case
TSDB_DATA_TYPE_INT
:
{
char
*
cell
=
udfColDataGetData
(
col
,
j
);
int32_t
num
=
*
(
int32_t
*
)
cell
;
sumSquares
+=
(
double
)
num
*
num
;
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
char
*
cell
=
udfColDataGetData
(
col
,
j
);
double
num
=
*
(
double
*
)
cell
;
sumSquares
+=
num
*
num
;
break
;
}
default:
break
;
}
++
numNotNull
;
}
}
*
(
double
*
)(
newInterBuf
->
buf
)
=
sumSquares
;
newInterBuf
->
bufLen
=
sizeof
(
double
);
newInterBuf
->
numOfResult
=
1
;
return
0
;
}
DLL_EXPORT
int32_t
l2norm2_finish
(
SUdfInterBuf
*
buf
,
SUdfInterBuf
*
resultData
)
{
double
sumSquares
=
*
(
double
*
)(
buf
->
buf
);
*
(
double
*
)(
resultData
->
buf
)
=
sumSquares
;
resultData
->
bufLen
=
sizeof
(
double
);
resultData
->
numOfResult
=
1
;
return
0
;
}
tests/script/tsim/parser/join_manyblocks.sim
浏览文件 @
99b424b1
...
...
@@ -6,8 +6,8 @@ sql connect
$dbPrefix = join_m_db
$tbPrefix = join_tb
$mtPrefix = join_mt
$tbNum =
3
$rowNum = 200
0
$tbNum =
20
$rowNum = 200
$totalNum = $tbNum * $rowNum
print =============== join_manyBlocks.sim
...
...
@@ -78,8 +78,8 @@ print ==============> td-3313
sql select join_mt0.ts,join_mt0.ts,join_mt0.t1 from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1;
print $row
if $row !=
6
000 then
print expect
6
000, actual: $row
if $row !=
4
000 then
print expect
4
000, actual: $row
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录