Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fc7887e6
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
fc7887e6
编写于
7月 20, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): update the sim.
上级
df58a9bb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
31 deletion
+7
-31
include/common/ttime.h
include/common/ttime.h
+0
-1
source/common/src/ttime.c
source/common/src/ttime.c
+0
-26
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+1
-1
tests/script/tsim/scalar/scalar.sim
tests/script/tsim/scalar/scalar.sim
+6
-3
未找到文件。
include/common/ttime.h
浏览文件 @
fc7887e6
...
...
@@ -73,7 +73,6 @@ static FORCE_INLINE int64_t taosGetTimestampToday(int32_t precision) {
}
int64_t
taosTimeAdd
(
int64_t
t
,
int64_t
duration
,
char
unit
,
int32_t
precision
);
int64_t
taosTimeSub
(
int64_t
t
,
int64_t
duration
,
char
unit
,
int32_t
precision
);
int64_t
taosTimeTruncate
(
int64_t
t
,
const
SInterval
*
pInterval
,
int32_t
precision
);
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
);
...
...
source/common/src/ttime.c
浏览文件 @
fc7887e6
...
...
@@ -712,32 +712,6 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) {
return
(
int64_t
)(
taosMktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
)
+
fraction
);
}
int64_t
taosTimeSub
(
int64_t
t
,
int64_t
duration
,
char
unit
,
int32_t
precision
)
{
if
(
duration
==
0
)
{
return
t
;
}
if
(
unit
!=
'n'
&&
unit
!=
'y'
)
{
return
t
-
duration
;
}
// The following code handles the y/n time duration
int64_t
numOfMonth
=
duration
;
if
(
unit
==
'y'
)
{
numOfMonth
*=
12
;
}
struct
tm
tm
;
time_t
tt
=
(
time_t
)(
t
/
TSDB_TICK_PER_SECOND
(
precision
));
taosLocalTime
(
&
tt
,
&
tm
);
int32_t
mon
=
tm
.
tm_year
*
12
+
tm
.
tm_mon
-
(
int32_t
)
numOfMonth
;
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_mon
=
mon
%
12
;
return
(
int64_t
)(
taosMktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
));
}
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
)
{
if
(
ekey
<
skey
)
{
int64_t
tmp
=
ekey
;
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
fc7887e6
...
...
@@ -1195,7 +1195,7 @@ static void vectorMathTsSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pR
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
}
*
output
=
taosTime
Sub
(
getVectorBigintValueFnLeft
(
pLeftCol
->
pData
,
i
),
getVectorBigintValueFnRight
(
pRightCol
->
pData
,
0
),
*
output
=
taosTime
Add
(
getVectorBigintValueFnLeft
(
pLeftCol
->
pData
,
i
),
-
getVectorBigintValueFnRight
(
pRightCol
->
pData
,
0
),
pRightCol
->
info
.
scale
,
pRightCol
->
info
.
precision
);
}
...
...
tests/script/tsim/scalar/scalar.sim
浏览文件 @
fc7887e6
...
...
@@ -43,7 +43,8 @@ sql select cast(1 as timestamp)+1n;
if $rows != 1 then
return -1
endi
if $data00 != @70-02-01 08:00:00.000@ then
if $data00 != @70-02-01 08:00:00.001@ then
print expect 70-02-01 08:00:00.001, actual: $data00
return -1
endi
...
...
@@ -52,11 +53,13 @@ if $rows != 1 then
return -1
endi
sql select cast(1 as timestamp)-1y;
# there is an *bug* in print timestamp that smaller than 0, so let's try value that is greater than 0.
sql select cast(1 as timestamp)+1y;
if $rows != 1 then
return -1
endi
if $data00 != @69-01-01 08:00:00.000@ then
if $data00 != @71-01-01 08:00:00.001@ then
print expect 71-01-01 08:00:00.001 , actual: $data00
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录