Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
9f4ce03e
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9f4ce03e
编写于
7月 01, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sort KVRow by colId
上级
2ed7cdd3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
4 deletion
+32
-4
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+7
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-2
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-0
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+16
-0
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
9f4ce03e
...
...
@@ -918,6 +918,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
char
tagVal
[
TSDB_MAX_TAGS_LEN
];
code
=
tsParseOneColumnData
(
pSchema
,
&
sToken
,
tagVal
,
pCmd
->
payload
,
&
sql
,
false
,
tinfo
.
precision
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
code
;
}
...
...
@@ -925,10 +926,14 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
SKVRow
row
=
tdGetKVRowFromBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
if
(
row
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tdSortKVRowByColIdx
(
row
);
pTag
->
dataLen
=
kvRowLen
(
row
);
memcpy
(
pTag
->
data
,
row
,
pTag
->
dataLen
);
kvRowCpy
(
pTag
->
data
,
row
);
free
(
row
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
index
=
0
;
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
,
0
,
NULL
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
9f4ce03e
...
...
@@ -5634,6 +5634,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// validate the length of binary
if
(
pList
->
a
[
i
].
pVar
.
nLen
+
VARSTR_HEADER_SIZE
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
...
@@ -5641,6 +5642,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
char
tagVal
[
TSDB_MAX_TAGS_LEN
];
ret
=
tVariantDump
(
&
(
pList
->
a
[
i
].
pVar
),
tagVal
,
pSchema
->
type
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
...
...
@@ -5648,10 +5650,14 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
}
SKVRow
row
=
tdGetKVRowFromBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
if
(
row
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tdSortKVRowByColIdx
(
row
);
pTag
->
dataLen
=
kvRowLen
(
row
);
memcpy
(
pTag
->
data
,
row
,
pTag
->
dataLen
);
kvRowCpy
(
pTag
->
data
,
row
);
free
(
row
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
// table name
if
(
tscValidateName
(
&
pInfo
->
pCreateTableInfo
->
name
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/common/inc/tdataformat.h
浏览文件 @
9f4ce03e
...
...
@@ -290,6 +290,7 @@ SKVRow tdKVRowDup(SKVRow row);
int
tdSetKVRowDataOfCol
(
SKVRow
*
orow
,
int16_t
colId
,
int8_t
type
,
void
*
value
);
int
tdEncodeKVRow
(
void
**
buf
,
SKVRow
row
);
void
*
tdDecodeKVRow
(
void
*
buf
,
SKVRow
*
row
);
void
tdSortKVRowByColIdx
(
SKVRow
row
);
static
FORCE_INLINE
int
comparTagId
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
int16_t
*
)
key1
>
((
SColIdx
*
)
key2
)
->
colId
)
{
...
...
src/common/src/tdataformat.c
浏览文件 @
9f4ce03e
...
...
@@ -515,6 +515,22 @@ SKVRow tdKVRowDup(SKVRow row) {
return
trow
;
}
static
int
compareColIdx
(
const
void
*
a
,
const
void
*
b
)
{
const
SColIdx
*
x
=
(
const
SColIdx
*
)
a
;
const
SColIdx
*
y
=
(
const
SColIdx
*
)
b
;
if
(
x
->
colId
>
y
->
colId
)
{
return
1
;
}
if
(
x
->
colId
<
y
->
colId
)
{
return
-
1
;
}
return
0
;
}
void
tdSortKVRowByColIdx
(
SKVRow
row
)
{
qsort
(
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
compareColIdx
);
}
int
tdSetKVRowDataOfCol
(
SKVRow
*
orow
,
int16_t
colId
,
int8_t
type
,
void
*
value
)
{
SColIdx
*
pColIdx
=
NULL
;
SKVRow
row
=
*
orow
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录