Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f5dacec3
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看板
提交
f5dacec3
编写于
6月 12, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): add more check for timestamp in converting.
上级
36462cdc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
13 deletion
+15
-13
source/common/src/ttime.c
source/common/src/ttime.c
+11
-11
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+4
-2
未找到文件。
source/common/src/ttime.c
浏览文件 @
f5dacec3
...
...
@@ -76,22 +76,22 @@ void deltaToUtcInitOnce() {
static
int64_t
parseFraction
(
char
*
str
,
char
**
end
,
int32_t
timePrec
);
static
int32_t
parseTimeWithTz
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
,
char
delim
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int
64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int
64_t
*
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int
32_t
len
,
int64_t
*
u
time
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int
32_t
len
,
int64_t
*
u
time
,
int32_t
timePrec
);
static
char
*
forwardToTimeStringEnd
(
char
*
str
);
static
bool
checkTzPresent
(
const
char
*
str
,
int32_t
len
);
static
int32_t
(
*
parseLocaltimeFp
[])(
char
*
timestr
,
int
64_t
*
time
,
int32_t
timePrec
)
=
{
parseLocaltime
,
static
int32_t
(
*
parseLocaltimeFp
[])(
char
*
timestr
,
int
32_t
len
,
int64_t
*
u
time
,
int32_t
timePrec
)
=
{
parseLocaltime
,
parseLocaltimeDst
};
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
u
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
/* parse datatime string in with tz */
if
(
strnchr
(
timestr
,
'T'
,
len
,
false
)
!=
NULL
)
{
return
parseTimeWithTz
(
timestr
,
time
,
timePrec
,
'T'
);
return
parseTimeWithTz
(
timestr
,
u
time
,
timePrec
,
'T'
);
}
else
if
(
checkTzPresent
(
timestr
,
len
))
{
return
parseTimeWithTz
(
timestr
,
time
,
timePrec
,
0
);
return
parseTimeWithTz
(
timestr
,
u
time
,
timePrec
,
0
);
}
else
{
return
(
*
parseLocaltimeFp
[
day_light
])((
char
*
)
timestr
,
time
,
timePrec
);
return
(
*
parseLocaltimeFp
[
day_light
])((
char
*
)
timestr
,
len
,
u
time
,
timePrec
);
}
}
...
...
@@ -333,12 +333,12 @@ static FORCE_INLINE bool validateTm(struct tm* pTm) {
return
true
;
}
int32_t
parseLocaltime
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
int32_t
parseLocaltime
(
char
*
timestr
,
int
32_t
len
,
int
64_t
*
time
,
int32_t
timePrec
)
{
*
time
=
0
;
struct
tm
tm
=
{
0
};
char
*
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
if
(
str
==
NULL
||
!
validateTm
(
&
tm
))
{
if
(
str
==
NULL
||
((
str
-
timestr
)
<
len
)
||
!
validateTm
(
&
tm
))
{
return
-
1
;
}
...
...
@@ -367,13 +367,13 @@ int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec) {
return
0
;
}
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
)
{
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int
32_t
len
,
int
64_t
*
time
,
int32_t
timePrec
)
{
*
time
=
0
;
struct
tm
tm
=
{
0
};
tm
.
tm_isdst
=
-
1
;
char
*
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
if
(
str
==
NULL
||
!
validateTm
(
&
tm
))
{
if
(
str
==
NULL
||
((
str
-
timestr
)
<
len
)
||
!
validateTm
(
&
tm
))
{
return
-
1
;
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
f5dacec3
...
...
@@ -4188,6 +4188,8 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
SColumnInfoData
*
pInputCol
=
pInput
->
pData
[
0
];
SColumnInfoData
*
pOutput
=
(
SColumnInfoData
*
)
pCtx
->
pOutput
;
int32_t
alreadySampled
=
pInfo
->
numSampled
;
int32_t
startOffset
=
pCtx
->
offset
;
for
(
int32_t
i
=
pInput
->
startRowIndex
;
i
<
pInput
->
numOfRows
+
pInput
->
startRowIndex
;
i
+=
1
)
{
if
(
colDataIsNull_s
(
pInputCol
,
i
))
{
...
...
@@ -4199,13 +4201,13 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
doReservoirSample
(
pInfo
,
data
,
tsList
[
i
],
i
);
}
for
(
int32_t
i
=
0
;
i
<
pInfo
->
numSampled
;
++
i
)
{
for
(
int32_t
i
=
alreadySampled
;
i
<
pInfo
->
numSampled
;
++
i
)
{
int32_t
pos
=
startOffset
+
i
;
colDataAppend
(
pOutput
,
pos
,
pInfo
->
data
+
i
*
pInfo
->
colBytes
,
false
);
//TODO: handle ts output
}
return
pInfo
->
numSampled
;
return
pInfo
->
numSampled
-
alreadySampled
;
}
bool
getTailFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录