Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d77979ba
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
未验证
提交
d77979ba
编写于
6月 12, 2022
作者:
H
Haojun Liao
提交者:
GitHub
6月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13747 from taosdata/feature/3_liaohj
fix(query): add more check for timestamp in converting.
上级
b9db0ea6
c2e8aa96
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
11 deletion
+13
-11
source/common/src/ttime.c
source/common/src/ttime.c
+11
-11
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+2
-0
未找到文件。
source/common/src/ttime.c
浏览文件 @
d77979ba
...
...
@@ -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
)
&&
(
*
str
!=
'.'
))
||
!
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
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
return
-
1
;
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
d77979ba
...
...
@@ -4186,6 +4186,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
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录