Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
864d07e1
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
864d07e1
编写于
8月 07, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:[TD-24559]support geomety type in schemaless
上级
7ae36630
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
14 deletion
+49
-14
source/client/CMakeLists.txt
source/client/CMakeLists.txt
+2
-2
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+1
-0
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+31
-6
source/client/test/CMakeLists.txt
source/client/test/CMakeLists.txt
+1
-1
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-1
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+11
-3
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+1
-1
未找到文件。
source/client/CMakeLists.txt
浏览文件 @
864d07e1
...
@@ -16,7 +16,7 @@ target_include_directories(
...
@@ -16,7 +16,7 @@ target_include_directories(
target_link_libraries
(
target_link_libraries
(
taos
taos
INTERFACE api
INTERFACE api
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
geometry
)
)
if
(
TD_DARWIN_ARM64
)
if
(
TD_DARWIN_ARM64
)
...
@@ -57,7 +57,7 @@ target_include_directories(
...
@@ -57,7 +57,7 @@ target_include_directories(
target_link_libraries
(
target_link_libraries
(
taos_static
taos_static
INTERFACE api
INTERFACE api
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
geometry
)
)
if
(
${
BUILD_TEST
}
)
if
(
${
BUILD_TEST
}
)
...
...
source/client/inc/clientSml.h
浏览文件 @
864d07e1
...
@@ -33,6 +33,7 @@ extern "C" {
...
@@ -33,6 +33,7 @@ extern "C" {
#include "ttime.h"
#include "ttime.h"
#include "ttypes.h"
#include "ttypes.h"
#include "cJSON.h"
#include "cJSON.h"
#include "geosWrapper.h"
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
...
...
source/client/src/clientSml.c
浏览文件 @
864d07e1
...
@@ -1191,6 +1191,7 @@ void freeSSmlKv(void *data) {
...
@@ -1191,6 +1191,7 @@ void freeSSmlKv(void *data) {
SSmlKv
*
kv
=
(
SSmlKv
*
)
data
;
SSmlKv
*
kv
=
(
SSmlKv
*
)
data
;
if
(
kv
->
keyEscaped
)
taosMemoryFree
((
void
*
)(
kv
->
key
));
if
(
kv
->
keyEscaped
)
taosMemoryFree
((
void
*
)(
kv
->
key
));
if
(
kv
->
valueEscaped
)
taosMemoryFree
((
void
*
)(
kv
->
value
));
if
(
kv
->
valueEscaped
)
taosMemoryFree
((
void
*
)(
kv
->
value
));
if
(
kv
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
geosFreeBuffer
((
void
*
)(
kv
->
value
));
}
}
void
smlDestroyInfo
(
SSmlHandle
*
info
)
{
void
smlDestroyInfo
(
SSmlHandle
*
info
)
{
...
...
source/client/src/clientSmlLine.c
浏览文件 @
864d07e1
...
@@ -102,6 +102,30 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
...
@@ -102,6 +102,30 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
return
TSDB_CODE_TSC_INVALID_VALUE
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
}
if
(
pVal
->
value
[
0
]
==
'g'
||
pVal
->
value
[
0
]
==
'G'
)
{
// geometry
if
(
pVal
->
value
[
1
]
==
'"'
&&
pVal
->
value
[
pVal
->
length
-
1
]
==
'"'
&&
pVal
->
length
>=
sizeof
(
"POINT"
)
+
3
)
{
int32_t
code
=
initCtxGeomFromText
();
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
char
*
tmp
=
taosMemoryCalloc
(
pVal
->
length
,
1
);
memcmp
(
tmp
,
pVal
->
value
+
2
,
pVal
->
length
-
3
);
code
=
doGeomFromText
(
tmp
,
(
unsigned
char
**
)
&
pVal
->
value
,
&
pVal
->
length
);
taosMemoryFree
(
tmp
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pVal
->
type
=
TSDB_DATA_TYPE_GEOMETRY
;
if
(
pVal
->
length
>
TSDB_MAX_BINARY_LEN
-
VARSTR_HEADER_SIZE
)
{
geosFreeBuffer
((
void
*
)(
pVal
->
value
));
return
TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN
;
}
return
TSDB_CODE_SUCCESS
;
}
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
if
(
pVal
->
value
[
0
]
==
't'
||
pVal
->
value
[
0
]
==
'T'
)
{
if
(
pVal
->
value
[
0
]
==
't'
||
pVal
->
value
[
0
]
==
'T'
)
{
if
(
pVal
->
length
==
1
||
if
(
pVal
->
length
==
1
||
(
pVal
->
length
==
4
&&
(
pVal
->
value
[
1
]
==
'r'
||
pVal
->
value
[
1
]
==
'R'
)
&&
(
pVal
->
length
==
4
&&
(
pVal
->
value
[
1
]
==
'r'
||
pVal
->
value
[
1
]
==
'R'
)
&&
...
@@ -390,7 +414,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
...
@@ -390,7 +414,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
};
SSmlKv
kv
=
{.
key
=
tag
->
name
,
.
keyLen
=
strlen
(
tag
->
name
),
.
type
=
tag
->
type
};
if
(
tag
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
tag
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
kv
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
;
kv
.
length
=
(
tag
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
;
}
else
if
(
tag
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
tag
->
type
==
TSDB_DATA_TYPE_BINARY
||
tag
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
{
kv
.
length
=
tag
->
bytes
-
VARSTR_HEADER_SIZE
;
kv
.
length
=
tag
->
bytes
-
VARSTR_HEADER_SIZE
;
}
}
taosArrayPush
((
*
tmp
)
->
cols
,
&
kv
);
taosArrayPush
((
*
tmp
)
->
cols
,
&
kv
);
...
@@ -663,14 +687,15 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
...
@@ -663,14 +687,15 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
if
(
info
->
dataFormat
)
{
if
(
info
->
dataFormat
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format true, ts:%"
PRId64
,
info
->
id
,
ts
);
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format true, ts:%"
PRId64
,
info
->
id
,
ts
);
ret
=
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
ret
=
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
if
(
ret
!
=
TSDB_CODE_SUCCESS
)
{
if
(
ret
=
=
TSDB_CODE_SUCCESS
)
{
ret
urn
ret
;
ret
=
smlBuildRow
(
info
->
currTableDataCtx
)
;
}
}
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
if
(
unlikely
(
ret
!=
TSDB_CODE_SUCCESS
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlBuildCol error"
,
NULL
);
return
ret
;
return
ret
;
}
}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
}
else
{
}
else
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format false, ts:%"
PRId64
,
info
->
id
,
ts
);
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format false, ts:%"
PRId64
,
info
->
id
,
ts
);
taosArraySet
(
elements
->
colArray
,
0
,
&
kv
);
taosArraySet
(
elements
->
colArray
,
0
,
&
kv
);
...
...
source/client/test/CMakeLists.txt
浏览文件 @
864d07e1
...
@@ -20,7 +20,7 @@ TARGET_LINK_LIBRARIES(
...
@@ -20,7 +20,7 @@ TARGET_LINK_LIBRARIES(
ADD_EXECUTABLE
(
smlTest smlTest.cpp
)
ADD_EXECUTABLE
(
smlTest smlTest.cpp
)
TARGET_LINK_LIBRARIES
(
TARGET_LINK_LIBRARIES
(
smlTest
smlTest
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom
geometry
)
)
TARGET_INCLUDE_DIRECTORIES
(
TARGET_INCLUDE_DIRECTORIES
(
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
864d07e1
...
@@ -489,7 +489,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -489,7 +489,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
SMqVgEp
*
pVgEp
=
taosArrayGetP
(
pConsumerEpNew
->
vgs
,
i
);
SMqVgEp
*
pVgEp
=
taosArrayGetP
(
pConsumerEpNew
->
vgs
,
i
);
if
(
pVgEp
->
vgId
==
d1
->
vgId
){
if
(
pVgEp
->
vgId
==
d1
->
vgId
){
jump
=
true
;
jump
=
true
;
mInfo
(
"pSub->offsetRows jump, because consumer id:%"
PRIx64
" and vgId:%d not change"
,
pConsumerEp
->
consumerId
,
pVgEp
->
vgId
);
mInfo
(
"pSub->offsetRows jump, because consumer id:
0x
%"
PRIx64
" and vgId:%d not change"
,
pConsumerEp
->
consumerId
,
pVgEp
->
vgId
);
break
;
break
;
}
}
}
}
...
...
source/libs/parser/src/parInsertSml.c
浏览文件 @
864d07e1
...
@@ -22,7 +22,7 @@ static void clearColValArray(SArray* pCols) {
...
@@ -22,7 +22,7 @@ static void clearColValArray(SArray* pCols) {
int32_t
num
=
taosArrayGetSize
(
pCols
);
int32_t
num
=
taosArrayGetSize
(
pCols
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SColVal
*
pCol
=
taosArrayGet
(
pCols
,
i
);
SColVal
*
pCol
=
taosArrayGet
(
pCols
,
i
);
if
(
TSDB_DATA_TYPE_NCHAR
==
pCol
->
type
)
{
if
(
TSDB_DATA_TYPE_NCHAR
==
pCol
->
type
||
TSDB_DATA_TYPE_GEOMETRY
==
pCol
->
type
)
{
taosMemoryFreeClear
(
pCol
->
value
.
pData
);
taosMemoryFreeClear
(
pCol
->
value
.
pData
);
}
}
pCol
->
flag
=
CV_FLAG_NONE
;
pCol
->
flag
=
CV_FLAG_NONE
;
...
@@ -237,9 +237,13 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
...
@@ -237,9 +237,13 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
}
}
pVal
->
value
.
pData
=
pUcs4
;
pVal
->
value
.
pData
=
pUcs4
;
pVal
->
value
.
nData
=
len
;
pVal
->
value
.
nData
=
len
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
||
kv
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
{
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
pData
=
(
uint8_t
*
)
kv
->
value
;
pVal
->
value
.
pData
=
(
uint8_t
*
)
kv
->
value
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
{
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
pData
=
taosMemoryMalloc
(
kv
->
length
);
memcpy
(
pVal
->
value
.
pData
,
(
uint8_t
*
)
kv
->
value
,
kv
->
length
);
}
else
{
}
else
{
memcpy
(
&
pVal
->
value
.
val
,
&
(
kv
->
value
),
kv
->
length
);
memcpy
(
&
pVal
->
value
.
val
,
&
(
kv
->
value
),
kv
->
length
);
}
}
...
@@ -364,9 +368,13 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
...
@@ -364,9 +368,13 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
}
}
pVal
->
value
.
pData
=
pUcs4
;
pVal
->
value
.
pData
=
pUcs4
;
pVal
->
value
.
nData
=
len
;
pVal
->
value
.
nData
=
len
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
||
kv
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
{
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
pData
=
(
uint8_t
*
)
kv
->
value
;
pVal
->
value
.
pData
=
(
uint8_t
*
)
kv
->
value
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_GEOMETRY
)
{
pVal
->
value
.
nData
=
kv
->
length
;
pVal
->
value
.
pData
=
taosMemoryMalloc
(
kv
->
length
);
memcpy
(
pVal
->
value
.
pData
,
(
uint8_t
*
)
kv
->
value
,
kv
->
length
);
}
else
{
}
else
{
memcpy
(
&
pVal
->
value
.
val
,
&
(
kv
->
value
),
kv
->
length
);
memcpy
(
&
pVal
->
value
.
val
,
&
(
kv
->
value
),
kv
->
length
);
}
}
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
864d07e1
...
@@ -333,7 +333,7 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
...
@@ -333,7 +333,7 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
static
void
destroyColVal
(
void
*
p
)
{
static
void
destroyColVal
(
void
*
p
)
{
SColVal
*
pVal
=
p
;
SColVal
*
pVal
=
p
;
if
(
TSDB_DATA_TYPE_NCHAR
==
pVal
->
type
)
{
if
(
TSDB_DATA_TYPE_NCHAR
==
pVal
->
type
||
TSDB_DATA_TYPE_GEOMETRY
==
pVal
->
type
)
{
taosMemoryFree
(
pVal
->
value
.
pData
);
taosMemoryFree
(
pVal
->
value
.
pData
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录