Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
24e899f8
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
24e899f8
编写于
9月 27, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
bba04212
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
35 deletion
+14
-35
source/util/src/tcompression.c
source/util/src/tcompression.c
+14
-35
未找到文件。
source/util/src/tcompression.c
浏览文件 @
24e899f8
...
...
@@ -1032,12 +1032,7 @@ static struct {
int32_t
(
*
cmprFn
)(
SCompressor
*
,
const
void
*
,
int32_t
nData
);
int32_t
(
*
endFn
)(
SCompressor
*
,
const
uint8_t
**
,
int32_t
*
);
}
DATA_TYPE_INFO
[]
=
{
{.
type
=
TSDB_DATA_TYPE_NULL
,
.
bytes
=
0
,
.
isVarLen
=
0
,
.
startFn
=
NULL
,
.
cmprFn
=
NULL
,
.
endFn
=
NULL
},
// TSDB_DATA_TYPE_NULL
{.
type
=
TSDB_DATA_TYPE_NULL
,
.
bytes
=
0
,
.
isVarLen
=
0
,
.
startFn
=
NULL
,
.
cmprFn
=
NULL
,
.
endFn
=
NULL
},
{.
type
=
TSDB_DATA_TYPE_BOOL
,
.
bytes
=
1
,
.
isVarLen
=
0
,
...
...
@@ -1394,7 +1389,13 @@ static int32_t tCompIntStart(SCompressor *pCmprsor, int8_t type, int8_t cmprAlg)
static
int32_t
tCompIntSwitchToCopy
(
SCompressor
*
pCmprsor
)
{
int32_t
code
=
0
;
// ASSERT(0);
if
(
pCmprsor
->
nVal
==
0
)
goto
_exit
;
// todo
_exit:
pCmprsor
->
pBuf
[
0
]
=
1
;
return
code
;
}
...
...
@@ -1404,29 +1405,8 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
ASSERT
(
nData
==
DATA_TYPE_INFO
[
pCmprsor
->
type
].
bytes
);
if
(
pCmprsor
->
aBuf
[
0
][
0
]
==
0
)
{
int64_t
val
;
switch
(
pCmprsor
->
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
val
=
*
(
int8_t
*
)
pData
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
val
=
*
(
int16_t
*
)
pData
;
break
;
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
val
=
*
(
int32_t
*
)
pData
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
val
=
*
(
int64_t
*
)
pData
;
break
;
default:
ASSERT
(
0
);
break
;
}
int64_t
val
=
0
;
memcpy
(
&
val
,
pData
,
nData
);
// little-endian only
if
(
!
I64_SAFE_ADD
(
val
,
-
pCmprsor
->
i_prev
))
{
code
=
tCompIntSwitchToCopy
(
pCmprsor
);
...
...
@@ -1445,16 +1425,16 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
int8_t
nBit
=
(
vZigzag
)
?
(
64
-
BUILDIN_CLZL
(
vZigzag
))
:
0
;
pCmprsor
->
i_prev
=
val
;
while
(
1
)
{
for
(;;
)
{
int32_t
nEle
=
(
pCmprsor
->
i_end
+
241
-
pCmprsor
->
i_start
)
%
241
;
if
(
nEle
+
1
<=
SELECTOR_TO_ELEMS
[
pCmprsor
->
i_selector
]
&&
nEle
+
1
<=
SELECTOR_TO_ELEMS
[
BIT_TO_SELECTOR
[
nBit
]])
{
if
(
pCmprsor
->
i_selector
<
BIT_TO_SELECTOR
[
nBit
])
{
pCmprsor
->
i_selector
=
BIT_TO_SELECTOR
[
nBit
];
}
pCmprsor
->
i_end
=
(
pCmprsor
->
i_end
+
1
)
%
241
;
pCmprsor
->
i_aZigzag
[
pCmprsor
->
i_end
]
=
vZigzag
;
pCmprsor
->
i_aBitN
[
pCmprsor
->
i_end
]
=
nBit
;
pCmprsor
->
i_end
=
(
pCmprsor
->
i_end
+
1
)
%
241
;
break
;
}
else
{
while
(
nEle
<
SELECTOR_TO_ELEMS
[
pCmprsor
->
i_selector
])
{
...
...
@@ -1462,9 +1442,8 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
}
nEle
=
SELECTOR_TO_ELEMS
[
pCmprsor
->
i_selector
];
if
(
pCmprsor
->
autoAlloc
)
{
code
=
tRealloc
(
&
pCmprsor
->
pBuf
,
pCmprsor
->
nBuf
+
sizeof
(
uint64_t
));
if
(
code
)
return
code
;
if
(
pCmprsor
->
autoAlloc
&&
(
code
=
tRealloc
(
&
pCmprsor
->
pBuf
,
pCmprsor
->
nBuf
+
sizeof
(
uint64_t
))))
{
return
code
;
}
uint64_t
*
bp
=
(
uint64_t
*
)(
pCmprsor
->
pBuf
+
pCmprsor
->
nBuf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录