Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
173794dc
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
173794dc
编写于
11月 30, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
merge 3.0
上级
9e39ffc8
1d7a4044
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
111 addition
and
78 deletion
+111
-78
cmake/cmake.platform
cmake/cmake.platform
+2
-0
cmake/taostools_CMakeLists.txt.in
cmake/taostools_CMakeLists.txt.in
+1
-1
include/client/taos.h
include/client/taos.h
+10
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-1
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-1
include/os/os.h
include/os/os.h
+2
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+34
-62
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+7
-0
source/libs/parser/inc/parInsertUtil.h
source/libs/parser/inc/parInsertUtil.h
+1
-1
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+4
-4
source/libs/parser/src/parInsertSql.c
source/libs/parser/src/parInsertSql.c
+2
-1
source/libs/parser/src/parInsertStmt.c
source/libs/parser/src/parInsertStmt.c
+1
-1
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+2
-2
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+2
-0
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+41
-4
未找到文件。
cmake/cmake.platform
浏览文件 @
173794dc
...
...
@@ -82,10 +82,12 @@ IF ("${CPUTYPE}" STREQUAL "")
MESSAGE(STATUS "Current platform is amd64")
SET(PLATFORM_ARCH_STR "amd64")
SET(TD_INTEL_64 TRUE)
ADD_DEFINITIONS("-D_TD_X86_")
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
MESSAGE(STATUS "Current platform is x86")
SET(PLATFORM_ARCH_STR "i386")
SET(TD_INTEL_32 TRUE)
ADD_DEFINITIONS("-D_TD_X86_")
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
MESSAGE(STATUS "Current platform is aarch32")
SET(PLATFORM_ARCH_STR "arm")
...
...
cmake/taostools_CMakeLists.txt.in
浏览文件 @
173794dc
...
...
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG
9f587e9
GIT_TAG
d19e82c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
...
...
include/client/taos.h
浏览文件 @
173794dc
...
...
@@ -218,6 +218,9 @@ DLL_EXPORT int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_
DLL_EXPORT
int
taos_get_table_vgId
(
TAOS
*
taos
,
const
char
*
db
,
const
char
*
table
,
int
*
vgId
);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
/* --------------------------schemaless INTERFACE------------------------------- */
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int64_t
reqid
);
...
...
@@ -225,6 +228,13 @@ DLL_EXPORT TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len
int
precision
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_raw_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int64_t
reqid
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_ttl
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_ttl_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
,
int64_t
reqid
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_raw_ttl
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert_raw_ttl_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
,
int64_t
reqid
);
/* --------------------------TMQ INTERFACE------------------------------- */
...
...
include/libs/nodes/querynodes.h
浏览文件 @
173794dc
...
...
@@ -106,7 +106,7 @@ typedef struct SValueNode {
char
*
p
;
}
datum
;
int64_t
typeData
;
char
unit
;
int8_t
unit
;
}
SValueNode
;
typedef
struct
SLeftValueNode
{
...
...
include/libs/parser/parser.h
浏览文件 @
173794dc
...
...
@@ -108,7 +108,7 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char*
void
*
smlInitHandle
(
SQuery
*
pQuery
);
void
smlDestroyHandle
(
void
*
pHandle
);
int32_t
smlBindData
(
void
*
handle
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
bool
format
,
STableMeta
*
pTableMeta
,
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
char
*
msgBuf
,
int16_t
msgBufLen
);
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
int32_t
ttl
,
char
*
msgBuf
,
int16_t
msgBufLen
);
int32_t
smlBuildOutput
(
void
*
handle
,
SHashObj
*
pVgHash
);
int32_t
rewriteToVnodeModifyOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
);
...
...
include/os/os.h
浏览文件 @
173794dc
...
...
@@ -48,8 +48,10 @@ extern "C" {
#else
#include <argp.h>
#include <sys/prctl.h>
#if defined(_TD_X86_)
#include <cpuid.h>
#endif
#endif
#else
#ifndef __func__
...
...
source/client/src/clientSml.c
浏览文件 @
173794dc
...
...
@@ -162,7 +162,9 @@ typedef struct {
SMLProtocolType
protocol
;
int8_t
precision
;
bool
dataFormat
;
// true means that the name and order of keys in each line are the same(only for influx protocol)
bool
dataFormat
;
// true means that the name and order of keys in each line are the same(only for influx protocol)
bool
isRawLine
;
int32_t
ttl
;
SHashObj
*
childTables
;
SHashObj
*
superTables
;
...
...
@@ -863,6 +865,7 @@ static int32_t smlParseTS(SSmlHandle *info, const char *data, int32_t len, SArra
}
else
{
ASSERT
(
0
);
}
uDebug
(
"SML:0x%"
PRIx64
" smlParseTS:%"
PRId64
,
info
->
id
,
ts
);
if
(
ts
==
-
1
)
return
TSDB_CODE_INVALID_TIMESTAMP
;
...
...
@@ -2063,7 +2066,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, cJSON *root, SSmlTableInfo *
static
int32_t
smlParseInfluxLine
(
SSmlHandle
*
info
,
const
char
*
sql
,
const
int
len
)
{
SSmlLineInfo
elements
=
{
0
};
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxLine sql
"
,
info
->
id
);
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxLine sql
:%s"
,
info
->
id
,
(
info
->
isRawLine
?
"rawdata"
:
sql
)
);
int
ret
=
smlParseInfluxString
(
sql
,
sql
+
len
,
&
elements
,
&
info
->
msgBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -2323,7 +2326,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
code
=
smlBindData
(
info
->
exec
,
tableData
->
tags
,
(
*
pMeta
)
->
cols
,
tableData
->
cols
,
info
->
dataFormat
,
(
*
pMeta
)
->
tableMeta
,
tableData
->
childTableName
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
,
info
->
msgBuf
.
buf
,
info
->
msgBuf
.
len
);
info
->
ttl
,
info
->
msgBuf
.
buf
,
info
->
msgBuf
.
len
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlBindData failed"
,
info
->
id
);
return
code
;
...
...
@@ -2514,7 +2517,7 @@ static void smlInsertCallback(void *param, void *res, int32_t code) {
}
TAOS_RES
*
taos_schemaless_insert_inner
(
SRequestObj
*
request
,
char
*
lines
[],
char
*
rawLine
,
char
*
rawLineEnd
,
int
numLines
,
int
protocol
,
int
precision
)
{
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
int
batchs
=
0
;
STscObj
*
pTscObj
=
request
->
pTscObj
;
...
...
@@ -2575,6 +2578,9 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
goto
end
;
}
info
->
isRawLine
=
(
rawLine
==
NULL
);
info
->
ttl
=
ttl
;
int32_t
perBatch
=
LINE_BATCH
;
if
(
numLines
>
perBatch
)
{
...
...
@@ -2637,13 +2643,14 @@ end:
* @return TAOS_RES
*/
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
)
{
TAOS_RES
*
taos_schemaless_insert_ttl_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
,
int64_t
reqid
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
0
);
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
!
request
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
...
...
@@ -2656,40 +2663,29 @@ TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int pr
return
(
TAOS_RES
*
)
request
;
}
return
taos_schemaless_insert_inner
(
request
,
lines
,
NULL
,
NULL
,
numLines
,
protocol
,
precision
);
return
taos_schemaless_insert_inner
(
request
,
lines
,
NULL
,
NULL
,
numLines
,
protocol
,
precision
,
ttl
);
}
TAOS_RES
*
taos_schemaless_insert_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
!
request
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
}
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
0
);
}
if
(
!
lines
)
{
SSmlMsgBuf
msg
=
{
ERROR_MSG_BUF_DEFAULT_SIZE
,
request
->
msgBuf
};
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
msg
,
"lines is null"
,
NULL
);
return
(
TAOS_RES
*
)
request
;
}
TAOS_RES
*
taos_schemaless_insert_ttl
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
ttl
,
0
);
}
return
taos_schemaless_insert_inner
(
request
,
lines
,
NULL
,
NULL
,
numLines
,
protocol
,
precision
);
TAOS_RES
*
taos_schemaless_insert_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
}
TAOS_RES
*
taos_schemaless_insert_raw
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
)
{
TAOS_RES
*
taos_schemaless_insert_raw
_ttl_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
,
int64_t
reqid
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
0
);
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
!
request
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
...
...
@@ -2714,40 +2710,16 @@ TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *
tmp
=
lines
+
i
+
1
;
}
}
return
taos_schemaless_insert_inner
(
request
,
NULL
,
lines
,
lines
+
len
,
numLines
,
protocol
,
precision
);
return
taos_schemaless_insert_inner
(
request
,
NULL
,
lines
,
lines
+
len
,
numLines
,
protocol
,
precision
,
ttl
);
}
TAOS_RES
*
taos_schemaless_insert_raw_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
SRequestObj
*
request
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
reqid
);
if
(
!
request
)
{
uError
(
"SML:taos_schemaless_insert error request is null"
);
return
NULL
;
}
if
(
!
lines
||
len
<=
0
)
{
SSmlMsgBuf
msg
=
{
ERROR_MSG_BUF_DEFAULT_SIZE
,
request
->
msgBuf
};
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
msg
,
"lines is null"
,
NULL
);
return
(
TAOS_RES
*
)
request
;
}
TAOS_RES
*
taos_schemaless_insert_raw_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
}
TAOS_RES
*
taos_schemaless_insert_raw_ttl
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
ttl
,
0
);
}
int
numLines
=
0
;
*
totalRows
=
0
;
char
*
tmp
=
lines
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
if
(
lines
[
i
]
==
'\n'
||
i
==
len
-
1
)
{
numLines
++
;
if
(
tmp
[
0
]
!=
'#'
||
protocol
!=
TSDB_SML_LINE_PROTOCOL
)
{
// ignore comment
(
*
totalRows
)
++
;
}
tmp
=
lines
+
i
+
1
;
}
}
return
taos_schemaless_insert_inner
(
request
,
NULL
,
lines
,
lines
+
len
,
numLines
,
protocol
,
precision
);
TAOS_RES
*
taos_schemaless_insert_raw
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
0
);
}
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
173794dc
...
...
@@ -2952,6 +2952,7 @@ static const char* jkValueDuration = "Duration";
static
const
char
*
jkValueTranslate
=
"Translate"
;
static
const
char
*
jkValueNotReserved
=
"NotReserved"
;
static
const
char
*
jkValueIsNull
=
"IsNull"
;
static
const
char
*
jkValueUnit
=
"Unit"
;
static
const
char
*
jkValueDatum
=
"Datum"
;
static
int32_t
datumToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
...
...
@@ -3041,6 +3042,9 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddBoolToObject
(
pJson
,
jkValueIsNull
,
pNode
->
isNull
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkValueUnit
,
pNode
->
unit
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
pNode
->
translate
&&
!
pNode
->
isNull
)
{
code
=
datumToJson
(
pNode
,
pJson
);
}
...
...
@@ -3191,6 +3195,9 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetBoolValue
(
pJson
,
jkValueIsNull
,
&
pNode
->
isNull
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetTinyIntValue
(
pJson
,
jkValueUnit
,
&
pNode
->
unit
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
pNode
->
translate
&&
!
pNode
->
isNull
)
{
code
=
jsonToDatum
(
pJson
,
pNode
);
}
...
...
source/libs/parser/inc/parInsertUtil.h
浏览文件 @
173794dc
...
...
@@ -135,7 +135,7 @@ int32_t insAllocateMemForSize(STableDataBlocks *pDataBlock, int32_t allSize);
int32_t
insCreateSName
(
SName
*
pName
,
struct
SToken
*
pTableName
,
int32_t
acctId
,
const
char
*
dbName
,
SMsgBuf
*
pMsgBuf
);
int32_t
insFindCol
(
struct
SToken
*
pColname
,
int32_t
start
,
int32_t
end
,
SSchema
*
pSchema
);
void
insBuildCreateTbReq
(
SVCreateTbReq
*
pTbReq
,
const
char
*
tname
,
STag
*
pTag
,
int64_t
suid
,
const
char
*
sname
,
SArray
*
tagName
,
uint8_t
tagNum
);
SArray
*
tagName
,
uint8_t
tagNum
,
int32_t
ttl
);
int32_t
insMemRowAppend
(
SMsgBuf
*
pMsgBuf
,
const
void
*
value
,
int32_t
len
,
void
*
param
);
int32_t
insCheckTimestamp
(
STableDataBlocks
*
pDataBlocks
,
const
char
*
start
);
int32_t
insBuildOutput
(
SHashObj
*
pVgroupsHashObj
,
SArray
*
pVgDataBlocks
,
SArray
**
pDataBlocks
);
...
...
source/libs/parser/src/parInsertSml.c
浏览文件 @
173794dc
...
...
@@ -208,7 +208,7 @@ end:
}
int32_t
smlBindData
(
void
*
handle
,
SArray
*
tags
,
SArray
*
colsSchema
,
SArray
*
cols
,
bool
format
,
STableMeta
*
pTableMeta
,
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
char
*
msgBuf
,
int16_t
msgBufLen
)
{
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
int32_t
ttl
,
char
*
msgBuf
,
int16_t
msgBufLen
)
{
SMsgBuf
pBuf
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
SSmlExecHandle
*
smlHandle
=
(
SSmlExecHandle
*
)
handle
;
...
...
@@ -229,7 +229,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
}
insBuildCreateTbReq
(
&
smlHandle
->
tableExecHandle
.
createTblReq
,
tableName
,
pTag
,
pTableMeta
->
suid
,
NULL
,
tagName
,
pTableMeta
->
tableInfo
.
numOfTags
);
pTableMeta
->
tableInfo
.
numOfTags
,
ttl
);
taosArrayDestroy
(
tagName
);
smlHandle
->
tableExecHandle
.
createTblReq
.
ctb
.
stbName
=
taosMemoryMalloc
(
sTableNameLen
+
1
);
...
...
@@ -303,9 +303,9 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
if
(
kv
)
{
int32_t
colLen
=
kv
->
length
;
if
(
pColSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
// uError
("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
uDebug
(
"SML:data before:%"
PRId64
", precision:%d"
,
kv
->
i
,
pTableMeta
->
tableInfo
.
precision
);
kv
->
i
=
convertTimePrecision
(
kv
->
i
,
TSDB_TIME_PRECISION_NANO
,
pTableMeta
->
tableInfo
.
precision
);
// uError
("SML:data after:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
uDebug
(
"SML:data after:%"
PRId64
", precision:%d"
,
kv
->
i
,
pTableMeta
->
tableInfo
.
precision
);
}
if
(
IS_VAR_DATA_TYPE
(
kv
->
type
))
{
...
...
source/libs/parser/src/parInsertSql.c
浏览文件 @
173794dc
...
...
@@ -529,7 +529,8 @@ static int32_t buildCreateTbReq(SVnodeModifOpStmt* pStmt, STag* pTag, SArray* pT
return
TSDB_CODE_OUT_OF_MEMORY
;
}
insBuildCreateTbReq
(
pStmt
->
pCreateTblReq
,
pStmt
->
targetTableName
.
tname
,
pTag
,
pStmt
->
pTableMeta
->
suid
,
pStmt
->
usingTableName
.
tname
,
pTagName
,
pStmt
->
pTableMeta
->
tableInfo
.
numOfTags
);
pStmt
->
usingTableName
.
tname
,
pTagName
,
pStmt
->
pTableMeta
->
tableInfo
.
numOfTags
,
TSDB_DEFAULT_TABLE_TTL
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/parser/src/parInsertStmt.c
浏览文件 @
173794dc
...
...
@@ -137,7 +137,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
}
SVCreateTbReq
tbReq
=
{
0
};
insBuildCreateTbReq
(
&
tbReq
,
tName
,
pTag
,
suid
,
sTableName
,
tagName
,
pDataBlock
->
pTableMeta
->
tableInfo
.
numOfTags
);
insBuildCreateTbReq
(
&
tbReq
,
tName
,
pTag
,
suid
,
sTableName
,
tagName
,
pDataBlock
->
pTableMeta
->
tableInfo
.
numOfTags
,
TSDB_DEFAULT_TABLE_TTL
);
code
=
insBuildCreateTbMsg
(
pDataBlock
,
&
tbReq
);
tdDestroySVCreateTbReq
(
&
tbReq
);
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
173794dc
...
...
@@ -850,7 +850,7 @@ int32_t insFindCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchem
}
void
insBuildCreateTbReq
(
SVCreateTbReq
*
pTbReq
,
const
char
*
tname
,
STag
*
pTag
,
int64_t
suid
,
const
char
*
sname
,
SArray
*
tagName
,
uint8_t
tagNum
)
{
SArray
*
tagName
,
uint8_t
tagNum
,
int32_t
ttl
)
{
pTbReq
->
type
=
TD_CHILD_TABLE
;
pTbReq
->
name
=
strdup
(
tname
);
pTbReq
->
ctb
.
suid
=
suid
;
...
...
@@ -858,7 +858,7 @@ void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, i
if
(
sname
)
pTbReq
->
ctb
.
stbName
=
strdup
(
sname
);
pTbReq
->
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
pTbReq
->
ctb
.
tagName
=
taosArrayDup
(
tagName
,
NULL
);
pTbReq
->
ttl
=
TSDB_DEFAULT_TABLE_TTL
;
pTbReq
->
ttl
=
ttl
;
pTbReq
->
commentLen
=
-
1
;
return
;
...
...
source/os/src/osSysinfo.c
浏览文件 @
173794dc
...
...
@@ -481,6 +481,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) {
#elif defined(_TD_DARWIN_64)
#else
#ifdef _TD_X86_
// Since the compiler is not support avx/avx2 instructions, the global variables always need to be
// set to be false
#if __AVX__ || __AVX2__
...
...
@@ -504,6 +505,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) {
// Ref to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756
__cpuid_fix
(
7u
,
eax
,
ebx
,
ecx
,
edx
);
*
avx2
=
(
char
)
((
ebx
&
bit_AVX2
)
==
bit_AVX2
);
#endif // _TD_X86_
#endif
return
0
;
...
...
utils/test/c/sml_test.c
浏览文件 @
173794dc
...
...
@@ -1084,22 +1084,55 @@ int sml_19221_Test() {
return
code
;
}
int
sml_time_Test
()
{
int
sml_ts2164_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"meters,location=la,groupid=ca current=11.8,voltage=221,phase=0.27"
,
"meters,location=la,groupid=ca current=11.8,voltage=221,phase=0.27"
,
"meters,location=la,groupid=cb current=11.8,voltage=221,phase=0.27"
,
};
pRes
=
taos_query
(
taos
,
"use line_test"
);
taos_free_result
(
pRes
);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
code
=
taos_errno
(
pRes
);
taos_free_result
(
pRes
);
taos_close
(
taos
);
return
code
;
}
int
sml_ttl_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists sml_db schemaless 1"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=
'2022-02-02 10:22:22' 16260068336
39000000"
,
"meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=
\"
2022-02-0210:22:22
\"
16260068337
39000000"
,
};
pRes
=
taos_query
(
taos
,
"use sml_db"
);
taos_free_result
(
pRes
);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
pRes
=
taos_schemaless_insert_ttl
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
,
20
);
printf
(
"%s result1:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"select `ttl` from information_schema.ins_tables where table_name='t_be97833a0e1f523fcdaeb6291d6fdf27'"
);
printf
(
"%s result2:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
TAOS_ROW
row
=
taos_fetch_row
(
pRes
);
int32_t
ttl
=
*
(
int32_t
*
)
row
[
0
];
ASSERT
(
ttl
==
20
);
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
code
=
taos_errno
(
pRes
);
taos_free_result
(
pRes
);
taos_close
(
taos
);
...
...
@@ -1109,6 +1142,10 @@ int sml_time_Test() {
int
main
(
int
argc
,
char
*
argv
[])
{
int
ret
=
0
;
ret
=
sml_ttl_Test
();
ASSERT
(
!
ret
);
ret
=
sml_ts2164_Test
();
ASSERT
(
!
ret
);
ret
=
smlProcess_influx_Test
();
ASSERT
(
!
ret
);
ret
=
smlProcess_telnet_Test
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录