Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
07a02b25
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看板
提交
07a02b25
编写于
5月 05, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:add schemaless test cases
上级
26155b95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
13 deletion
+33
-13
source/client/src/clientSml.c
source/client/src/clientSml.c
+18
-5
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+10
-3
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+4
-4
source/libs/transport/src/rpcTcp.c
source/libs/transport/src/rpcTcp.c
+1
-1
未找到文件。
source/client/src/clientSml.c
浏览文件 @
07a02b25
...
...
@@ -117,8 +117,8 @@ typedef struct {
//=================================================================================================
static
uint64_t
linesSmlHandleId
=
0
;
static
const
char
*
TS
=
"ts"
;
static
const
char
*
TAG
=
"tagNone"
;
static
const
char
*
TS
=
"
_
ts"
;
static
const
char
*
TAG
=
"
_
tagNone"
;
//=================================================================================================
...
...
@@ -350,13 +350,26 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
int
n
=
sprintf
(
result
,
"create stable %s ("
,
action
->
createSTable
.
sTableName
);
char
*
pos
=
result
+
n
;
int
freeBytes
=
capacity
-
n
;
size_t
size
=
taosHashGetSize
(
action
->
createSTable
.
fields
);
SArray
*
cols
=
taosArrayInit
(
size
,
POINTER_BYTES
);
SSmlKv
**
kv
=
taosHashIterate
(
action
->
createSTable
.
fields
,
NULL
);
while
(
kv
){
smlBuildColumnDescription
(
*
kv
,
pos
,
freeBytes
,
&
outBytes
);
if
(
strncmp
((
*
kv
)
->
key
,
TS
,
strlen
(
TS
))
==
0
&&
(
*
kv
)
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
){
taosArrayInsert
(
cols
,
0
,
kv
);
}
else
{
taosArrayPush
(
cols
,
kv
);
}
kv
=
taosHashIterate
(
action
->
createSTable
.
fields
,
kv
);
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
i
++
){
SSmlKv
*
kvNew
=
taosArrayGetP
(
cols
,
i
);
smlBuildColumnDescription
(
kvNew
,
pos
,
freeBytes
,
&
outBytes
);
pos
+=
outBytes
;
freeBytes
-=
outBytes
;
*
pos
=
','
;
++
pos
;
--
freeBytes
;
kv
=
taosHashIterate
(
action
->
createSTable
.
fields
,
kv
);
}
taosArrayDestroy
(
cols
);
--
pos
;
++
freeBytes
;
outBytes
=
snprintf
(
pos
,
freeBytes
,
") tags ("
);
...
...
@@ -419,7 +432,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
&
pTableMeta
);
if
(
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
)
{
if
(
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
code
==
TSDB_CODE_MND_INVALID_STB
)
{
SSchemaAction
schemaAction
=
{
0
};
schemaAction
.
action
=
SCHEMA_ACTION_CREATE_STABLE
;
memcpy
(
schemaAction
.
createSTable
.
sTableName
,
superTable
,
superTableLen
);
...
...
source/client/test/smlTest.cpp
浏览文件 @
07a02b25
...
...
@@ -456,6 +456,12 @@ TEST(testCase, smlParseLine_Test) {
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
taos
,
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists sml_db"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"use sml_db"
);
taos_free_result
(
pRes
);
SRequestObj
*
request
=
createRequest
(
taos
,
NULL
,
NULL
,
TSDB_SQL_INSERT
);
ASSERT_NE
(
request
,
NULL
);
...
...
@@ -467,9 +473,10 @@ TEST(testCase, smlParseLine_Test) {
"readings,name=truck_1,fleet=South,driver=Albert,model=F-150,device_version=v1.5 load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=72.45258,longitude=68.83761,elevation=255,velocity=0,heading=181,grade=0,fuel_consumption=25 1451606400000000000"
,
"readings,name=truck_2,fleet=North,driver=Derek,model=F-150,device_version=v1.5 load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=24.5208,longitude=28.09377,elevation=428,velocity=0,heading=304,grade=0,fuel_consumption=25 1451606400000000000"
};
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
smlParseLine
(
info
,
sql
[
i
]);
}
smlInsertLines
(
info
,
sql
,
3
);
// for (int i = 0; i < 3; i++) {
// smlParseLine(info, sql[i]);
// }
}
// TEST(testCase, smlParseTS_Test) {
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
07a02b25
...
...
@@ -1624,10 +1624,6 @@ static int32_t smlParseTags(SArray *cols, SKVRowBuilder *tagsBuilder, SParsedDat
int32_t
smlBindData
(
void
*
handle
,
SArray
*
tags
,
SArray
*
colsFormat
,
SHashObj
*
colsHash
,
SArray
*
cols
,
bool
format
,
STableMeta
*
pTableMeta
,
char
*
msgBuf
,
int16_t
msgBufLen
)
{
SMsgBuf
pBuf
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
int32_t
rowNum
=
taosArrayGetSize
(
cols
);
if
(
rowNum
<=
0
)
{
return
buildInvalidOperationMsg
(
&
pBuf
,
"cols size <= 0"
);
}
SSmlExecHandle
*
smlHandle
=
(
SSmlExecHandle
*
)
handle
;
SSchema
*
pTagsSchema
=
getTableTagSchema
(
pTableMeta
);
...
...
@@ -1679,6 +1675,10 @@ int32_t smlBindData(void *handle, SArray *tags, SArray *colsFormat, SHashObj *co
initRowBuilder
(
&
pDataBlock
->
rowBuilder
,
pDataBlock
->
pTableMeta
->
sversion
,
&
pDataBlock
->
boundColumnInfo
);
int32_t
rowNum
=
format
?
taosArrayGetSize
(
colsFormat
)
:
taosArrayGetSize
(
cols
);
if
(
rowNum
<=
0
)
{
return
buildInvalidOperationMsg
(
&
pBuf
,
"cols size <= 0"
);
}
ret
=
allocateMemForSize
(
pDataBlock
,
extendedRowSize
*
rowNum
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
buildInvalidOperationMsg
(
&
pBuf
,
"allocate memory error"
);
...
...
source/libs/transport/src/rpcTcp.c
浏览文件 @
07a02b25
...
...
@@ -21,7 +21,7 @@
#include "taoserror.h"
#include "tutil.h"
#ifndef USE_UV
#ifndef USE
f
_UV
typedef
struct
SFdObj
{
void
*
signature
;
TdSocketPtr
pSocket
;
// TCP socket FD
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录