Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c0463e46
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看板
提交
c0463e46
编写于
11月 14, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: truncate show create table result
上级
a5b1cfc9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
80 deletion
+31
-80
include/common/tdatablock.h
include/common/tdatablock.h
+0
-1
include/libs/function/taosudf.h
include/libs/function/taosudf.h
+1
-1
include/util/types.h
include/util/types.h
+1
-7
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+0
-4
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+0
-38
source/libs/command/src/command.c
source/libs/command/src/command.c
+29
-29
未找到文件。
include/common/tdatablock.h
浏览文件 @
c0463e46
...
...
@@ -186,7 +186,6 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
int32_t
getJsonValueLen
(
const
char
*
data
);
int32_t
colDataLenAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
uint32_t
dataLen
);
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataAppendNItems
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
uint32_t
numOfRows
);
...
...
include/libs/function/taosudf.h
浏览文件 @
c0463e46
...
...
@@ -104,7 +104,7 @@ typedef int32_t (*TUdfDestroyFunc)();
} while (0)
#define udfColDataSetNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] = -1)
typedef
int16_t
VarDataLenT
;
// maxVarDataLen: 32767
typedef
uint16_t
VarDataLenT
;
// maxVarDataLen: 65535
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataVal(v) ((char *)(v) + VARSTR_HEADER_SIZE)
...
...
include/util/types.h
浏览文件 @
c0463e46
...
...
@@ -78,7 +78,7 @@ static FORCE_INLINE double taos_align_get_double(const char *pBuf) {
{ (*(double *)(x)) = (*(double *)(y)); }
// #endif
typedef
int16_t
VarDataLenT
;
// maxVarDataLen: 32767
typedef
uint16_t
VarDataLenT
;
// maxVarDataLen: 65535
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
...
...
@@ -87,12 +87,6 @@ typedef int16_t VarDataLenT; // maxVarDataLen: 32767
#define NCHAR_WIDTH_TO_BYTES(n) ((n)*TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE)
typedef
uint32_t
extVarDataLenT
;
#define EXTVARSTR_HEADER_SIZE (VARSTR_HEADER_SIZE + sizeof(extVarDataLenT))
#define extVarDataLen(v) ((*(VarDataLenT *)(v)) == -1 ? (*(extVarDataLenT*)(((VarDataLenT *)(v)) + 1)) : (*(VarDataLenT *)(v)))
#define extVarDataVal(v) ((char *)(v) + EXTVARSTR_HEADER_SIZE)
#define setExtVarDataLen(v, l) do { *(VarDataLenT *)(v) = -1; *(extVarDataLenT*)(((VarDataLenT *)(v)) + 1) = (l); } while (0)
typedef
int32_t
VarDataOffsetT
;
typedef
struct
tstr
{
...
...
source/client/src/clientImpl.c
浏览文件 @
c0463e46
...
...
@@ -1482,10 +1482,6 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
pResultInfo
->
length
[
i
]
=
varDataLen
(
pStart
);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pStart
);
if
(
-
1
==
pResultInfo
->
length
[
i
])
{
pResultInfo
->
length
[
i
]
=
extVarDataLen
(
pStart
);
pResultInfo
->
row
[
i
]
=
extVarDataVal
(
pStart
);
}
}
else
{
pResultInfo
->
row
[
i
]
=
NULL
;
pResultInfo
->
length
[
i
]
=
0
;
...
...
source/common/src/tdatablock.c
浏览文件 @
c0463e46
...
...
@@ -62,44 +62,6 @@ int32_t getJsonValueLen(const char* data) {
return
dataLen
;
}
int32_t
colDataLenAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
uint32_t
dataLen
)
{
ASSERT
(
pColumnInfoData
!=
NULL
);
int32_t
type
=
pColumnInfoData
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
if
(
pAttr
->
allocLen
<
pAttr
->
length
+
dataLen
)
{
uint32_t
newSize
=
pAttr
->
allocLen
;
if
(
newSize
<=
1
)
{
newSize
=
8
;
}
while
(
newSize
<
pAttr
->
length
+
dataLen
)
{
newSize
=
newSize
*
1
.
5
;
}
char
*
buf
=
taosMemoryRealloc
(
pColumnInfoData
->
pData
,
newSize
);
if
(
buf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pColumnInfoData
->
pData
=
buf
;
pAttr
->
allocLen
=
newSize
;
}
uint32_t
len
=
pColumnInfoData
->
varmeta
.
length
;
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
len
;
memcpy
(
pColumnInfoData
->
pData
+
len
,
pData
,
dataLen
);
pColumnInfoData
->
varmeta
.
length
+=
dataLen
;
}
else
{
memcpy
(
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
,
pData
,
pColumnInfoData
->
info
.
bytes
);
}
return
0
;
}
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
)
{
ASSERT
(
pColumnInfoData
!=
NULL
);
...
...
source/libs/command/src/command.c
浏览文件 @
c0463e46
...
...
@@ -330,7 +330,7 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
sprintf
(
type
+
strlen
(
type
),
"(%d)"
,
(
int32_t
)((
pSchema
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
));
}
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s` %s"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
,
type
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s` %s"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
,
type
);
}
}
...
...
@@ -345,14 +345,14 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) {
sprintf
(
type
+
strlen
(
type
),
"(%d)"
,
(
int32_t
)((
pSchema
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
));
}
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s` %s"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
,
type
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s` %s"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
,
type
);
}
}
void
appendTagNameFields
(
char
*
buf
,
int32_t
*
len
,
STableCfg
*
pCfg
)
{
for
(
int32_t
i
=
0
;
i
<
pCfg
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
pCfg
->
pSchemas
+
pCfg
->
numOfColumns
+
i
;
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s`"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"%s`%s`"
,
((
i
>
0
)
?
", "
:
""
),
pSchema
->
name
);
}
}
...
...
@@ -368,7 +368,7 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
if
(
tTagIsJson
(
pTag
))
{
char
*
pJson
=
parseTagDatatoJson
(
pTag
);
if
(
pJson
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"%s"
,
pJson
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"%s"
,
pJson
);
taosMemoryFree
(
pJson
);
}
...
...
@@ -386,11 +386,11 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
for
(
int32_t
i
=
0
;
i
<
pCfg
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
pCfg
->
pSchemas
+
pCfg
->
numOfColumns
+
i
;
if
(
i
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
", "
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
", "
);
}
if
(
j
>=
valueNum
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"NULL"
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"NULL"
);
continue
;
}
...
...
@@ -404,14 +404,14 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
int32_t
tlen
=
0
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
dataConverToStr
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
type
,
pTagVal
->
pData
,
pTagVal
->
nData
,
&
tlen
);
dataConverToStr
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
type
,
pTagVal
->
pData
,
pTagVal
->
nData
,
&
tlen
);
}
else
{
dataConverToStr
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
type
,
&
pTagVal
->
i64
,
tDataTypes
[
type
].
bytes
,
&
tlen
);
dataConverToStr
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
type
,
&
pTagVal
->
i64
,
tDataTypes
[
type
].
bytes
,
&
tlen
);
}
*
len
+=
tlen
;
j
++
;
}
else
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"NULL"
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"NULL"
);
}
/*
...
...
@@ -450,37 +450,37 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
void
appendTableOptions
(
char
*
buf
,
int32_t
*
len
,
SDbCfgInfo
*
pDbCfg
,
STableCfg
*
pCfg
)
{
if
(
pCfg
->
commentLen
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT '%s'"
,
pCfg
->
pComment
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT '%s'"
,
pCfg
->
pComment
);
}
else
if
(
0
==
pCfg
->
commentLen
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT ''"
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT ''"
);
}
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
pCfg
->
watermark1
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" WATERMARK %"
PRId64
"a"
,
pCfg
->
watermark1
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" WATERMARK %"
PRId64
"a"
,
pCfg
->
watermark1
);
if
(
pCfg
->
watermark2
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
watermark2
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
watermark2
);
}
}
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
pCfg
->
delay1
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" MAX_DELAY %"
PRId64
"a"
,
pCfg
->
delay1
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" MAX_DELAY %"
PRId64
"a"
,
pCfg
->
delay1
);
if
(
pCfg
->
delay2
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
delay2
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
delay2
);
}
}
int32_t
funcNum
=
taosArrayGetSize
(
pCfg
->
pFuncs
);
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
funcNum
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" ROLLUP("
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" ROLLUP("
);
for
(
int32_t
i
=
0
;
i
<
funcNum
;
++
i
)
{
char
*
pFunc
=
taosArrayGet
(
pCfg
->
pFuncs
,
i
);
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
"%s%s"
,
((
i
>
0
)
?
", "
:
""
),
pFunc
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
"%s%s"
,
((
i
>
0
)
?
", "
:
""
),
pFunc
);
}
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
")"
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
")"
);
}
if
(
pCfg
->
ttl
>
0
)
{
*
len
+=
sprintf
(
buf
+
EXT
VARSTR_HEADER_SIZE
+
*
len
,
" TTL %d"
,
pCfg
->
ttl
);
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" TTL %d"
,
pCfg
->
ttl
);
}
}
...
...
@@ -504,33 +504,33 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
int32_t
len
=
0
;
if
(
TSDB_SUPER_TABLE
==
pCfg
->
tableType
)
{
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE STABLE `%s` ("
,
tbName
);
appendColumnFields
(
buf2
,
&
len
,
pCfg
);
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
+
len
,
") TAGS ("
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
") TAGS ("
);
appendTagFields
(
buf2
,
&
len
,
pCfg
);
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
+
len
,
")"
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
")"
);
appendTableOptions
(
buf2
,
&
len
,
pDbCfg
,
pCfg
);
}
else
if
(
TSDB_CHILD_TABLE
==
pCfg
->
tableType
)
{
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` USING `%s` ("
,
tbName
,
pCfg
->
stbName
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` USING `%s` ("
,
tbName
,
pCfg
->
stbName
);
appendTagNameFields
(
buf2
,
&
len
,
pCfg
);
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
+
len
,
") TAGS ("
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
") TAGS ("
);
code
=
appendTagValues
(
buf2
,
&
len
,
pCfg
);
if
(
code
)
{
taosMemoryFree
(
buf2
);
return
code
;
}
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
+
len
,
")"
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
")"
);
appendTableOptions
(
buf2
,
&
len
,
pDbCfg
,
pCfg
);
}
else
{
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` ("
,
tbName
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` ("
,
tbName
);
appendColumnFields
(
buf2
,
&
len
,
pCfg
);
len
+=
sprintf
(
buf2
+
EXT
VARSTR_HEADER_SIZE
+
len
,
")"
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
")"
);
appendTableOptions
(
buf2
,
&
len
,
pDbCfg
,
pCfg
);
}
setExtVarDataLen
(
buf2
,
len
)
;
varDataLen
(
buf2
)
=
(
len
>
65535
)
?
65535
:
len
;
colData
LenAppend
(
pCol2
,
0
,
buf2
,
len
+
EXTVARSTR_HEADER_SIZE
);
colData
Append
(
pCol2
,
0
,
buf2
,
false
);
taosMemoryFree
(
buf2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录