Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d31eee30
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看板
提交
d31eee30
编写于
8月 11, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5623]<feature>: add server code for decompressing col data
上级
1a3cf2e5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
10 deletion
+54
-10
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+33
-6
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+20
-4
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
d31eee30
...
...
@@ -303,6 +303,7 @@ typedef struct {
int16_t
numOfCols
;
int16_t
precision
;
bool
completed
;
bool
compressed
;
int32_t
code
;
int32_t
numOfGroups
;
SResRec
*
pGroupRec
;
...
...
src/client/src/tscServer.c
浏览文件 @
d31eee30
...
...
@@ -2678,6 +2678,27 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
return
0
;
}
static
void
decompressQueryColData
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
char
*
data
,
int8_t
compressed
)
{
int32_t
decompLen
=
0
;
int32_t
numOfCols
=
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
numOfCols
-
1
);
int16_t
offset
=
tscFieldInfoGetOffset
(
pQueryInfo
,
numOfCols
-
1
);
char
*
outputBuf
=
tcalloc
(
pRes
->
numOfRows
,
(
pField
->
bytes
+
offset
));
char
*
p
=
outputBuf
;
int32_t
bufOffset
=
0
,
compSize
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
bufOffset
=
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
;
int32_t
flen
=
(
*
(
tDataTypes
[
pInfo
->
field
.
type
].
decompFunc
))(
data
,
compSize
,
pRes
->
numOfRows
,
p
,
bufOffset
,
compressed
,
NULL
,
0
);
p
+=
flen
;
decompLen
+=
flen
;
}
tfree
(
outputBuf
);
}
int
tscProcessRetrieveRspFromNode
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
@@ -2690,18 +2711,24 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
return
pRes
->
code
;
}
pRes
->
numOfRows
=
htonl
(
pRetrieve
->
numOfRows
);
pRes
->
precision
=
htons
(
pRetrieve
->
precision
);
pRes
->
offset
=
htobe64
(
pRetrieve
->
offset
);
pRes
->
useconds
=
htobe64
(
pRetrieve
->
useconds
);
pRes
->
completed
=
(
pRetrieve
->
completed
==
1
);
pRes
->
data
=
pRetrieve
->
data
;
pRes
->
numOfRows
=
htonl
(
pRetrieve
->
numOfRows
);
pRes
->
precision
=
htons
(
pRetrieve
->
precision
);
pRes
->
offset
=
htobe64
(
pRetrieve
->
offset
);
pRes
->
useconds
=
htobe64
(
pRetrieve
->
useconds
);
pRes
->
completed
=
(
pRetrieve
->
completed
==
1
);
pRes
->
compressed
=
(
pRetrieve
->
compressed
==
1
);
pRes
->
data
=
pRetrieve
->
data
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
if
(
tscCreateResPointerInfo
(
pRes
,
pQueryInfo
)
!=
TSDB_CODE_SUCCESS
)
{
return
pRes
->
code
;
}
//Decompress col data if compressed from server
if
(
pRes
->
compressed
)
{
decompressQueryColData
(
pRes
,
pQueryInfo
,
pRes
->
data
,
pRes
->
compressed
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
((
pCmd
->
command
==
TSDB_SQL_RETRIEVE
)
||
((
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
)
||
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
))
&&
...
...
src/query/src/qExecutor.c
浏览文件 @
d31eee30
...
...
@@ -4207,21 +4207,30 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
SSDataBlock
*
pRes
=
pRuntimeEnv
->
outputBuf
;
int32_t
*
compSizes
=
NULL
;
int32_t
numOfCols
=
pQueryAttr
->
pExpr2
?
pQueryAttr
->
numOfExpr2
:
pQueryAttr
->
numOfOutput
;
if
(
compressed
)
{
compSizes
=
tmalloc
(
numOfCols
);
}
if
(
pQueryAttr
->
pExpr2
==
NULL
)
{
for
(
int32_t
col
=
0
;
col
<
pQueryAttr
->
numOfOutput
;
++
col
)
{
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
col
);
if
(
compressed
)
{
*
compLen
+=
compressQueryColData
(
pColRes
,
pRes
->
info
.
rows
,
data
,
compressed
);
compSizes
[
col
]
=
compressQueryColData
(
pColRes
,
pRes
->
info
.
rows
,
data
,
compressed
);
*
compLen
+=
compSizes
[
col
];
}
else
{
memmove
(
data
,
pColRes
->
pData
,
pColRes
->
info
.
bytes
*
pRes
->
info
.
rows
);
data
+=
pColRes
->
info
.
bytes
*
pRes
->
info
.
rows
;
}
}
}
else
{
for
(
int32_t
col
=
0
;
col
<
pQueryAttr
->
numOfExpr2
;
++
col
)
{
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
col
);
if
(
compressed
)
{
*
compLen
+=
compressQueryColData
(
pColRes
,
numOfRows
,
data
,
compressed
);
compSizes
[
col
]
=
compressQueryColData
(
pColRes
,
numOfRows
,
data
,
compressed
);
*
compLen
+=
compSizes
[
col
];
}
else
{
memmove
(
data
,
pColRes
->
pData
,
pColRes
->
info
.
bytes
*
numOfRows
);
data
+=
pColRes
->
info
.
bytes
*
numOfRows
;
...
...
@@ -4229,6 +4238,13 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
}
}
if
(
compressed
)
{
memmove
(
data
,
(
char
*
)
compSizes
,
numOfCols
*
sizeof
(
int32_t
));
data
+=
numOfCols
*
sizeof
(
int32_t
);
tfree
(
compSizes
);
}
int32_t
numOfTables
=
(
int32_t
)
taosHashGetSize
(
pRuntimeEnv
->
pTableRetrieveTsMap
);
*
(
int32_t
*
)
data
=
htonl
(
numOfTables
);
data
+=
sizeof
(
int32_t
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录