Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65e4e0e6
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看板
提交
65e4e0e6
编写于
10月 10, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10532]<enhance>: schemaless add hour/minute support
上级
8b342156
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
8 deletion
+36
-8
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+2
-0
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+32
-7
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+1
-0
tests/pytest/insert/line_insert.py
tests/pytest/insert/line_insert.py
+1
-1
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
65e4e0e6
...
...
@@ -44,6 +44,8 @@ typedef struct {
typedef
enum
{
SML_TIME_STAMP_NOW
,
SML_TIME_STAMP_HOURS
,
SML_TIME_STAMP_MINUTES
,
SML_TIME_STAMP_SECONDS
,
SML_TIME_STAMP_MILLI_SECONDS
,
SML_TIME_STAMP_MICRO_SECONDS
,
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
65e4e0e6
...
...
@@ -1731,6 +1731,14 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
*
ts
=
taosGetTimestampNs
();
break
;
}
case
SML_TIME_STAMP_HOURS
:
{
*
ts
=
(
int64_t
)(
*
ts
*
3600
*
1e9
);
break
;
}
case
SML_TIME_STAMP_MINUTES
:
{
*
ts
=
(
int64_t
)(
*
ts
*
60
*
1e9
);
break
;
}
case
SML_TIME_STAMP_SECONDS
:
{
*
ts
=
(
int64_t
)(
*
ts
*
1e9
);
break
;
...
...
@@ -2241,17 +2249,34 @@ int32_t convertPrecisionStrType(char* precision, SMLTimeStampType *tsType) {
*
tsType
=
SML_TIME_STAMP_NOT_CONFIGURED
;
return
TSDB_CODE_SUCCESS
;
}
if
(
strcmp
(
precision
,
"μ"
)
==
0
)
{
*
tsType
=
SML_TIME_STAMP_MICRO_SECONDS
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
len
=
(
int32_t
)
strlen
(
precision
);
if
(
len
==
1
&&
precision
[
0
]
==
's'
)
{
*
tsType
=
SML_TIME_STAMP_SECONDS
;
if
(
len
==
1
)
{
switch
(
precision
[
0
])
{
case
'u'
:
*
tsType
=
SML_TIME_STAMP_MICRO_SECONDS
;
break
;
case
's'
:
*
tsType
=
SML_TIME_STAMP_SECONDS
;
break
;
case
'm'
:
*
tsType
=
SML_TIME_STAMP_MINUTES
;
break
;
case
'h'
:
*
tsType
=
SML_TIME_STAMP_HOURS
;
break
;
default:
return
TSDB_CODE_TSC_INVALID_PRECISION_TYPE
;
}
}
else
if
(
len
==
2
&&
precision
[
1
]
==
's'
)
{
switch
(
precision
[
0
])
{
case
'm'
:
*
tsType
=
SML_TIME_STAMP_MILLI_SECONDS
;
break
;
case
'u'
:
*
tsType
=
SML_TIME_STAMP_MICRO_SECONDS
;
break
;
case
'n'
:
*
tsType
=
SML_TIME_STAMP_NANO_SECONDS
;
break
;
...
...
@@ -2286,12 +2311,12 @@ int32_t convertPrecisionStrType(char* precision, SMLTimeStampType *tsType) {
*
*/
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
char
*
p
recision
)
{
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
char
*
timeP
recision
)
{
int
code
;
SMLTimeStampType
tsType
;
if
(
protocol
==
SML_LINE_PROTOCOL
)
{
code
=
convertPrecisionStrType
(
p
recision
,
&
tsType
);
code
=
convertPrecisionStrType
(
timeP
recision
,
&
tsType
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/connector/python/taos/cinterface.py
浏览文件 @
65e4e0e6
...
...
@@ -823,6 +823,7 @@ def taos_schemaless_insert(connection, lines, protocol, precision):
lines
=
(
c_char_p
(
line
.
encode
(
"utf-8"
))
for
line
in
lines
)
lines_type
=
ctypes
.
c_char_p
*
num_of_lines
p_lines
=
lines_type
(
*
lines
)
precision
=
c_char_p
(
precision
.
encode
(
"utf-8"
))
errno
=
_libtaos
.
taos_schemaless_insert
(
connection
,
p_lines
,
num_of_lines
,
protocol
,
precision
)
if
errno
!=
0
:
raise
SchemalessError
(
"schemaless insert error"
,
errno
)
...
...
tests/pytest/insert/line_insert.py
浏览文件 @
65e4e0e6
...
...
@@ -74,7 +74,7 @@ class TDTestCase:
tdSql
.
checkData
(
2
,
2
,
14
)
self
.
_conn
.
schemaless_insert
([
"sth,t1=4i64,t2=5f64,t4=5f64,ID=
\"
childtable
\"
c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933641"
,
"sth,t1=4i64,t2=5f64,t4=5f64,ID=
childtable
c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933641"
,
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933654"
],
0
,
"ms"
)
tdSql
.
execute
(
'reset query cache'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录