Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
215883ea
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看板
提交
215883ea
编写于
9月 20, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code
上级
678f9da4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
163 addition
and
171 deletion
+163
-171
include/common/ttypes.h
include/common/ttypes.h
+4
-5
include/util/tcompression.h
include/util/tcompression.h
+36
-40
source/util/src/tcompression.c
source/util/src/tcompression.c
+123
-126
未找到文件。
include/common/ttypes.h
浏览文件 @
215883ea
...
...
@@ -333,10 +333,10 @@ typedef struct tDataTypeDescriptor {
char
*
name
;
int64_t
minValue
;
int64_t
maxValue
;
int32_t
(
*
compFunc
)(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
(
*
decompFunc
)(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
(
*
compFunc
)(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
(
*
decompFunc
)(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
void
(
*
statisFunc
)(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numofrow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
}
tDataTypeDescriptor
;
...
...
@@ -356,7 +356,6 @@ void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
void
*
getDataMin
(
int32_t
type
);
void
*
getDataMax
(
int32_t
type
);
#ifdef __cplusplus
}
#endif
...
...
include/util/tcompression.h
浏览文件 @
215883ea
...
...
@@ -83,46 +83,42 @@ static FORCE_INLINE int32_t tsDecompressDoubleLossy(const char *const input, int
#endif
int32_t
tsCompressTimestamp
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressTimestamp
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressFloat
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressFloat
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressDouble
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressDouble
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressString
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressString
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressBool
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressBool
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressTinyint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressTinyint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressSmallint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressSmallint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressInt
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressInt
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressBigint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsDecompressBigint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
tsCompressTimestamp
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressTimestamp
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressFloat
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressFloat
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressDouble
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressDouble
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressString
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressString
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressBool
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressBool
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressTinyint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressTinyint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressSmallint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressSmallint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressInt
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressInt
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsCompressBigint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
int32_t
tsDecompressBigint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
);
#ifdef __cplusplus
}
...
...
source/util/src/tcompression.c
浏览文件 @
215883ea
...
...
@@ -1618,27 +1618,26 @@ int32_t tCompress(SCompressor *pCmprsor, const void *pData, int64_t nData) {
* REGULAR COMPRESSION
*************************************************************************/
// Timestamp =====================================================
int32_t
tsCompressTimestamp
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressTimestampImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressTimestampImp
(
input
,
nelements
,
buffer
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressTimestamp
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressTimestampImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressTimestampImp
(
pIn
,
nEle
,
pBuf
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressTimestamp
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressTimestampImp
(
input
,
nelements
,
output
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressTimestampImp
(
buffer
,
nelements
,
output
);
int32_t
tsDecompressTimestamp
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressTimestampImp
(
pIn
,
nEle
,
pOut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressTimestampImp
(
pBuf
,
nEle
,
pOut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1646,20 +1645,20 @@ int32_t tsDecompressTimestamp(const char *const input, int32_t compressedSize, c
}
// Float =====================================================
int32_t
tsCompressFloat
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
int32_t
tsCompressFloat
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
#ifdef TD_TSZ
// lossy mode
if
(
lossyFloat
)
{
return
tsCompressFloatLossyImp
(
input
,
nelements
,
outp
ut
);
return
tsCompressFloatLossyImp
(
pIn
,
nEle
,
pO
ut
);
// lossless mode
}
else
{
#endif
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressFloatImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressFloatImp
(
input
,
nelements
,
buffer
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressFloatImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressFloatImp
(
pIn
,
nEle
,
pBuf
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1669,20 +1668,20 @@ int32_t tsCompressFloat(const char *const input, int32_t inputSize, const int32_
#endif
}
int32_t
tsDecompressFloat
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
int32_t
tsDecompressFloat
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
#ifdef TD_TSZ
if
(
HEAD_ALGO
(
input
[
0
])
==
ALGO_SZ_LOSSY
)
{
if
(
HEAD_ALGO
(
pIn
[
0
])
==
ALGO_SZ_LOSSY
)
{
// decompress lossy
return
tsDecompressFloatLossyImp
(
input
,
compressedSize
,
nelements
,
outp
ut
);
return
tsDecompressFloatLossyImp
(
pIn
,
nIn
,
nEle
,
pO
ut
);
}
else
{
#endif
// decompress lossless
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressFloatImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressFloatImp
(
buffer
,
nelements
,
outp
ut
);
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressFloatImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressFloatImp
(
pBuf
,
nEle
,
pO
ut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1693,20 +1692,20 @@ int32_t tsDecompressFloat(const char *const input, int32_t compressedSize, const
}
// Double =====================================================
int32_t
tsCompressDouble
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
int32_t
tsCompressDouble
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
#ifdef TD_TSZ
if
(
lossyDouble
)
{
// lossy mode
return
tsCompressDoubleLossyImp
(
input
,
nelements
,
outp
ut
);
return
tsCompressDoubleLossyImp
(
pIn
,
nEle
,
pO
ut
);
}
else
{
#endif
// lossless mode
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressDoubleImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressDoubleImp
(
input
,
nelements
,
buffer
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressDoubleImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressDoubleImp
(
pIn
,
nEle
,
pBuf
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1716,20 +1715,20 @@ int32_t tsCompressDouble(const char *const input, int32_t inputSize, const int32
#endif
}
int32_t
tsDecompressDouble
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
int32_t
tsDecompressDouble
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
#ifdef TD_TSZ
if
(
HEAD_ALGO
(
input
[
0
])
==
ALGO_SZ_LOSSY
)
{
// decompress lossy
return
tsDecompressDoubleLossyImp
(
input
,
compressedSize
,
nelements
,
outp
ut
);
return
tsDecompressDoubleLossyImp
(
pIn
,
nIn
,
nEle
,
pO
ut
);
}
else
{
#endif
// decompress lossless
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressDoubleImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressDoubleImp
(
buffer
,
nelements
,
outp
ut
);
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressDoubleImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressDoubleImp
(
pBuf
,
nEle
,
pO
ut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1740,37 +1739,37 @@ int32_t tsDecompressDouble(const char *const input, int32_t compressedSize, cons
}
// Binary =====================================================
int32_t
tsCompressString
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
return
tsCompressStringImp
(
input
,
inputSize
,
output
,
outputSize
);
int32_t
tsCompressString
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
return
tsCompressStringImp
(
pIn
,
nIn
,
pOut
,
nOut
);
}
int32_t
tsDecompressString
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
return
tsDecompressStringImp
(
input
,
compressedSize
,
output
,
outputSize
);
int32_t
tsDecompressString
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
return
tsDecompressStringImp
(
pIn
,
nIn
,
pOut
,
nOut
);
}
// Bool =====================================================
int32_t
tsCompressBool
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressBoolImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressBoolImp
(
input
,
nelements
,
buffer
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressBool
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressBoolImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressBoolImp
(
pIn
,
nEle
,
pBuf
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressBool
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressBoolImp
(
input
,
nelements
,
outp
ut
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressBoolImp
(
buffer
,
nelements
,
outp
ut
);
int32_t
tsDecompressBool
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressBoolImp
(
pIn
,
nEle
,
pO
ut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressBoolImp
(
pBuf
,
nEle
,
pO
ut
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1778,27 +1777,26 @@ int32_t tsDecompressBool(const char *const input, int32_t compressedSize, const
}
// Tinyint =====================================================
int32_t
tsCompressTinyint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_TINYINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
input
,
nelements
,
buffer
,
TSDB_DATA_TYPE_TINYINT
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressTinyint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_TINYINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
pIn
,
nEle
,
pBuf
,
TSDB_DATA_TYPE_TINYINT
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressTinyint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
input
,
nelements
,
output
,
TSDB_DATA_TYPE_TINYINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
buffer
,
nelements
,
output
,
TSDB_DATA_TYPE_TINYINT
);
int32_t
tsDecompressTinyint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
pIn
,
nEle
,
pOut
,
TSDB_DATA_TYPE_TINYINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
pBuf
,
nEle
,
pOut
,
TSDB_DATA_TYPE_TINYINT
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1806,27 +1804,26 @@ int32_t tsDecompressTinyint(const char *const input, int32_t compressedSize, con
}
// Smallint =====================================================
int32_t
tsCompressSmallint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_SMALLINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
input
,
nelements
,
buffer
,
TSDB_DATA_TYPE_SMALLINT
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressSmallint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_SMALLINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
pIn
,
nEle
,
pBuf
,
TSDB_DATA_TYPE_SMALLINT
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressSmallint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
input
,
nelements
,
output
,
TSDB_DATA_TYPE_SMALLINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
buffer
,
nelements
,
output
,
TSDB_DATA_TYPE_SMALLINT
);
int32_t
tsDecompressSmallint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
pIn
,
nEle
,
pOut
,
TSDB_DATA_TYPE_SMALLINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
pBuf
,
nEle
,
pOut
,
TSDB_DATA_TYPE_SMALLINT
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1834,26 +1831,26 @@ int32_t tsDecompressSmallint(const char *const input, int32_t compressedSize, co
}
// Int =====================================================
int32_t
tsCompressInt
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_INT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
input
,
nelements
,
buffer
,
TSDB_DATA_TYPE_INT
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressInt
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_INT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
pIn
,
nEle
,
pBuf
,
TSDB_DATA_TYPE_INT
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressInt
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_INT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
buffer
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_INT
);
int32_t
tsDecompressInt
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_INT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
pBuf
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_INT
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
@@ -1861,26 +1858,26 @@ int32_t tsDecompressInt(const char *const input, int32_t compressedSize, const i
}
// Bigint =====================================================
int32_t
tsCompressBigint
(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_BIGINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
input
,
nelements
,
buffer
,
TSDB_DATA_TYPE_BIGINT
);
return
tsCompressStringImp
(
buffer
,
len
,
output
,
outputSize
);
int32_t
tsCompressBigint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsCompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_BIGINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressINTImp
(
pIn
,
nEle
,
pBuf
,
TSDB_DATA_TYPE_BIGINT
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
assert
(
0
);
return
-
1
;
}
}
int32_t
tsDecompressBigint
(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
)
{
if
(
algorithm
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
input
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_BIGINT
);
}
else
if
(
algorithm
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
input
,
compressedSize
,
buffer
,
bufferSize
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
buffer
,
nelements
,
outp
ut
,
TSDB_DATA_TYPE_BIGINT
);
int32_t
tsDecompressBigint
(
void
*
pIn
,
int32_t
nIn
,
int32_t
nEle
,
void
*
pOut
,
int32_t
nOut
,
uint8_t
cmprAlg
,
void
*
pBuf
,
int32_t
nBuf
)
{
if
(
cmprAlg
==
ONE_STAGE_COMP
)
{
return
tsDecompressINTImp
(
pIn
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_BIGINT
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
if
(
tsDecompressStringImp
(
pIn
,
nIn
,
pBuf
,
nBuf
)
<
0
)
return
-
1
;
return
tsDecompressINTImp
(
pBuf
,
nEle
,
pO
ut
,
TSDB_DATA_TYPE_BIGINT
);
}
else
{
assert
(
0
);
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录