Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
85aca0c2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
85aca0c2
编写于
9月 11, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
td-1245: replace taosAddNatualInterval with taosTimeAdd
上级
76d40739
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
12 addition
and
58 deletion
+12
-58
src/client/src/tscStream.c
src/client/src/tscStream.c
+1
-5
src/common/inc/tname.h
src/common/inc/tname.h
+0
-1
src/common/src/tname.c
src/common/src/tname.c
+0
-27
src/os/src/detail/osTime.c
src/os/src/detail/osTime.c
+1
-1
src/query/src/qFill.c
src/query/src/qFill.c
+10
-24
未找到文件。
src/client/src/tscStream.c
浏览文件 @
85aca0c2
...
...
@@ -246,11 +246,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
}
if
(
!
pStream
->
isProject
)
{
if
(
pStream
->
intervalTimeUnit
==
'y'
||
pStream
->
intervalTimeUnit
==
'n'
)
{
pStream
->
stime
=
taosAddNatualInterval
(
pStream
->
stime
,
pStream
->
slidingTime
,
pStream
->
slidingTimeUnit
,
pStream
->
precision
);
}
else
{
pStream
->
stime
+=
pStream
->
slidingTime
;
}
pStream
->
stime
=
taosTimeAdd
(
pStream
->
stime
,
pStream
->
slidingTime
,
pStream
->
slidingTimeUnit
,
pStream
->
precision
);
}
// actually only one row is returned. this following is not necessary
taos_fetch_rows_a
(
res
,
tscProcessStreamRetrieveResult
,
pStream
);
...
...
src/common/inc/tname.h
浏览文件 @
85aca0c2
...
...
@@ -35,7 +35,6 @@ bool tscValidateTableNameLength(size_t len);
SColumnFilterInfo
*
tscFilterInfoClone
(
const
SColumnFilterInfo
*
src
,
int32_t
numOfFilters
);
int64_t
taosAddNatualInterval
(
int64_t
key
,
int64_t
intervalTime
,
char
timeUnit
,
int16_t
precision
);
int32_t
taosCountNatualInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
intervalTime
,
char
timeUnit
,
int16_t
precision
);
int64_t
taosGetIntervalStartTimestamp
(
int64_t
startTime
,
int64_t
slidingTime
,
int64_t
intervalTime
,
char
timeUnit
,
int16_t
precision
);
...
...
src/common/src/tname.c
浏览文件 @
85aca0c2
...
...
@@ -99,33 +99,6 @@ SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numO
return
pFilter
;
}
int64_t
taosAddNatualInterval
(
int64_t
key
,
int64_t
intervalTime
,
char
timeUnit
,
int16_t
precision
)
{
key
/=
1000
;
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
key
/=
1000
;
}
struct
tm
tm
;
time_t
t
=
(
time_t
)
key
;
localtime_r
(
&
t
,
&
tm
);
if
(
timeUnit
==
'y'
)
{
intervalTime
*=
12
;
}
int
mon
=
(
int
)(
tm
.
tm_year
*
12
+
tm
.
tm_mon
+
intervalTime
);
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_mon
=
mon
%
12
;
key
=
mktime
(
&
tm
)
*
1000L
;
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
key
*=
1000L
;
}
return
key
;
}
int32_t
taosCountNatualInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
intervalTime
,
char
timeUnit
,
int16_t
precision
)
{
skey
/=
1000
;
ekey
/=
1000
;
...
...
src/os/src/detail/osTime.c
浏览文件 @
85aca0c2
...
...
@@ -496,7 +496,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
}
}
return
taosTimeAdd
(
start
,
pInterval
->
offset
,
pInterval
->
interval
Unit
,
precision
);
return
taosTimeAdd
(
start
,
pInterval
->
offset
,
pInterval
->
offset
Unit
,
precision
);
}
// internal function, when program is paused in debugger,
...
...
src/query/src/qFill.c
浏览文件 @
85aca0c2
...
...
@@ -108,21 +108,15 @@ void* taosDestoryFillInfo(SFillInfo* pFillInfo) {
return
NULL
;
}
static
TSKEY
taosGetRevisedEndKey
(
TSKEY
ekey
,
int32_t
order
,
int64_t
timeInterval
,
int8_t
slidingTimeUnit
,
int8_t
precision
)
{
if
(
order
==
TSDB_ORDER_ASC
)
{
return
ekey
;
}
else
{
return
taosGetIntervalStartTimestamp
(
ekey
,
timeInterval
,
timeInterval
,
slidingTimeUnit
,
precision
);
}
}
void
taosFillSetStartInfo
(
SFillInfo
*
pFillInfo
,
int32_t
numOfRows
,
TSKEY
endKey
)
{
if
(
pFillInfo
->
fillType
==
TSDB_FILL_NONE
)
{
return
;
}
pFillInfo
->
endKey
=
taosGetRevisedEndKey
(
endKey
,
pFillInfo
->
order
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
endKey
=
endKey
;
if
(
pFillInfo
->
order
!=
TSDB_ORDER_ASC
)
{
pFillInfo
->
endKey
=
taosTimeTruncate
(
endKey
,
&
pFillInfo
->
interval
,
pFillInfo
->
precision
);
}
pFillInfo
->
rowIdx
=
0
;
pFillInfo
->
numOfRows
=
numOfRows
;
...
...
@@ -172,8 +166,10 @@ int64_t getFilledNumOfRes(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows
int32_t
numOfRows
=
taosNumOfRemainRows
(
pFillInfo
);
TSKEY
ekey1
=
taosGetRevisedEndKey
(
ekey
,
pFillInfo
->
order
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
TSKEY
ekey1
=
ekey
;
if
(
pFillInfo
->
order
!=
TSDB_ORDER_ASC
)
{
pFillInfo
->
endKey
=
taosTimeTruncate
(
ekey
,
&
pFillInfo
->
interval
,
pFillInfo
->
precision
);
}
int64_t
numOfRes
=
-
1
;
if
(
numOfRows
>
0
)
{
// still fill gap within current data block, not generating data after the result set.
...
...
@@ -374,12 +370,7 @@ static void doFillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* nu
setTagsValue
(
pFillInfo
,
data
,
*
num
);
}
// TODO natual sliding time
if
(
pFillInfo
->
interval
.
slidingUnit
!=
'n'
&&
pFillInfo
->
interval
.
slidingUnit
!=
'y'
)
{
pFillInfo
->
start
+=
(
pFillInfo
->
interval
.
sliding
*
step
);
}
else
{
pFillInfo
->
start
=
taosAddNatualInterval
(
pFillInfo
->
start
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
}
pFillInfo
->
start
=
taosTimeAdd
(
pFillInfo
->
start
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
numOfCurrent
++
;
(
*
num
)
+=
1
;
...
...
@@ -486,12 +477,7 @@ int32_t generateDataBlockImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t nu
// set the tag value for final result
setTagsValue
(
pFillInfo
,
data
,
num
);
// TODO natual sliding time
if
(
pFillInfo
->
interval
.
slidingUnit
!=
'n'
&&
pFillInfo
->
interval
.
slidingUnit
!=
'y'
)
{
pFillInfo
->
start
+=
(
pFillInfo
->
interval
.
sliding
*
step
);
}
else
{
pFillInfo
->
start
=
taosAddNatualInterval
(
pFillInfo
->
start
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
}
pFillInfo
->
start
=
taosTimeAdd
(
pFillInfo
->
start
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
rowIdx
+=
1
;
pFillInfo
->
numOfCurrent
+=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录