Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
64434678
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看板
提交
64434678
编写于
9月 25, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact more code
上级
0bd96164
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
67 addition
and
20 deletion
+67
-20
source/util/src/tcompression.c
source/util/src/tcompression.c
+67
-20
未找到文件。
source/util/src/tcompression.c
浏览文件 @
64434678
...
...
@@ -1001,38 +1001,49 @@ int32_t tsDecompressDoubleLossyImp(const char *input, int32_t compressedSize, co
*************************************************************************/
#define I64_SAFE_ADD(a, b) (((a) >= 0 && (b) <= INT64_MAX - (b)) || ((a) < 0 && (b) >= INT64_MIN - (a)))
static
int32_t
tCompBoolInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompBool
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
int32_t
tCompIntInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompInt
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
int32_t
tCompFloatInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompFloat
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
int32_t
tCompDoubleInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompDouble
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
int32_t
tCompTimestampInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompTimestamp
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
int32_t
tCompBinaryInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
static
int32_t
tCompBinary
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
);
static
struct
{
int8_t
type
;
int32_t
bytes
;
int8_t
isVarLen
;
int32_t
(
*
initFn
)(
SCompressor
*
,
int8_t
type
,
int8_t
cmprAlg
);
int32_t
(
*
cmprFn
)(
SCompressor
*
,
const
void
*
,
int32_t
nData
);
}
DATA_TYPE_INFO
[]
=
{
{
TSDB_DATA_TYPE_NULL
,
0
,
0
,
NULL
},
// TSDB_DATA_TYPE_NULL
{
TSDB_DATA_TYPE_BOOL
,
1
,
0
,
tCompBool
},
// TSDB_DATA_TYPE_BOOL
{
TSDB_DATA_TYPE_TINYINT
,
1
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_TINYINT
{
TSDB_DATA_TYPE_SMALLINT
,
2
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_SMALLINT
{
TSDB_DATA_TYPE_INT
,
4
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_INT
{
TSDB_DATA_TYPE_BIGINT
,
8
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_BIGINT
{
TSDB_DATA_TYPE_FLOAT
,
4
,
0
,
tCompFloat
},
// TSDB_DATA_TYPE_FLOAT
{
TSDB_DATA_TYPE_DOUBLE
,
8
,
0
,
tCompDouble
},
// TSDB_DATA_TYPE_DOUBLE
{
TSDB_DATA_TYPE_VARCHAR
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_VARCHAR
{
TSDB_DATA_TYPE_TIMESTAMP
,
8
,
0
,
tCompTimestamp
},
// pTSDB_DATA_TYPE_TIMESTAMP
{
TSDB_DATA_TYPE_NCHAR
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_NCHAR
{
TSDB_DATA_TYPE_UTINYINT
,
1
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_UTINYINT
{
TSDB_DATA_TYPE_USMALLINT
,
2
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_USMALLINT
{
TSDB_DATA_TYPE_UINT
,
4
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_UINT
{
TSDB_DATA_TYPE_UBIGINT
,
8
,
0
,
tCompInt
},
// TSDB_DATA_TYPE_UBIGINT
{
TSDB_DATA_TYPE_JSON
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_JSON
{
TSDB_DATA_TYPE_VARBINARY
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_VARBINARY
{
TSDB_DATA_TYPE_DECIMAL
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_DECIMAL
{
TSDB_DATA_TYPE_BLOB
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_BLOB
{
TSDB_DATA_TYPE_MEDIUMBLOB
,
1
,
1
,
tCompBinary
},
// TSDB_DATA_TYPE_MEDIUMBLOB
{.
type
=
TSDB_DATA_TYPE_NULL
,
.
bytes
=
0
,
.
isVarLen
=
0
,
.
initFn
=
NULL
,
.
cmprFn
=
NULL
},
// TSDB_DATA_TYPE_NULL
{.
type
=
TSDB_DATA_TYPE_BOOL
,
.
bytes
=
1
,
.
isVarLen
=
0
,
.
initFn
=
tCompBoolInit
,
.
cmprFn
=
tCompBool
},
{.
type
=
TSDB_DATA_TYPE_TINYINT
,
.
bytes
=
1
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_SMALLINT
,
.
bytes
=
2
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_INT
,
.
bytes
=
4
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
bytes
=
8
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_FLOAT
,
.
bytes
=
4
,
.
isVarLen
=
0
,
.
initFn
=
tCompFloatInit
,
.
cmprFn
=
tCompFloat
},
{.
type
=
TSDB_DATA_TYPE_DOUBLE
,
.
bytes
=
8
,
.
isVarLen
=
0
,
.
initFn
=
tCompDoubleInit
,
.
cmprFn
=
tCompDouble
},
{.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
bytes
=
8
,
.
isVarLen
=
0
,
.
initFn
=
tCompTimestampInit
,
.
cmprFn
=
tCompTimestamp
},
{.
type
=
TSDB_DATA_TYPE_NCHAR
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_UTINYINT
,
.
bytes
=
1
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_USMALLINT
,
.
bytes
=
2
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_UINT
,
.
bytes
=
4
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
bytes
=
8
,
.
isVarLen
=
0
,
.
initFn
=
tCompIntInit
,
.
cmprFn
=
tCompInt
},
{.
type
=
TSDB_DATA_TYPE_JSON
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_VARBINARY
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_DECIMAL
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_BLOB
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
{.
type
=
TSDB_DATA_TYPE_MEDIUMBLOB
,
.
bytes
=
1
,
.
isVarLen
=
1
,
.
initFn
=
tCompBinaryInit
,
.
cmprFn
=
tCompBinary
},
};
struct
SCompressor
{
...
...
@@ -1072,6 +1083,12 @@ struct SCompressor {
};
// Timestamp =====================================================
static
int32_t
tCompTimestampInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompSetCopyMode
(
SCompressor
*
pCmprsor
)
{
int32_t
code
=
0
;
...
...
@@ -1207,6 +1224,12 @@ static const uint8_t BIT_TO_SELECTOR[] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
};
static
int32_t
tCompIntInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompInt
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
)
{
int32_t
code
=
0
;
...
...
@@ -1314,6 +1337,12 @@ static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData)
}
// Float =====================================================
static
int32_t
tCompFloatInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompFloat
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
)
{
int32_t
code
=
0
;
...
...
@@ -1377,6 +1406,12 @@ static int32_t tCompFloat(SCompressor *pCmprsor, const void *pData, int32_t nDat
}
// Double =====================================================
static
int32_t
tCompDoubleInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompDouble
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
)
{
int32_t
code
=
0
;
...
...
@@ -1440,6 +1475,12 @@ static int32_t tCompDouble(SCompressor *pCmprsor, const void *pData, int32_t nDa
}
// Binary =====================================================
static
int32_t
tCompBinaryInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompBinary
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
)
{
int32_t
code
=
0
;
...
...
@@ -1460,6 +1501,12 @@ static int32_t tCompBinary(SCompressor *pCmprsor, const void *pData, int32_t nDa
// Bool =====================================================
static
const
uint8_t
BOOL_CMPR_TABLE
[]
=
{
0
b01
,
0
b0100
,
0
b010000
,
0
b01000000
};
static
int32_t
tCompBoolInit
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
tCompBool
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int32_t
nData
)
{
int32_t
code
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录