add compress dict
This commit is contained in:
parent
09a04ed0a4
commit
bc98978b33
|
@ -534,13 +534,22 @@ struct SSchema {
|
||||||
char name[TSDB_COL_NAME_LEN];
|
char name[TSDB_COL_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// compress flag
|
||||||
|
|
||||||
|
// |----l1 compAlg----|-----l2 compAlg---|---level--|
|
||||||
|
// |------8bit--------|------16bit-------|---8bit---|
|
||||||
|
|
||||||
|
#define COMPRESS_L1_TYPE(type) ((type)&0xFF)
|
||||||
|
#define COMPRESS_L2_TYPE(type) (((type) >> 8) & 0xFFFF)
|
||||||
|
#define COMPRESS_L2_TYPE_LEVEL(type) (((type) >> 24) & 0xFF)
|
||||||
|
|
||||||
struct SSchema2 {
|
struct SSchema2 {
|
||||||
int8_t type;
|
int8_t type;
|
||||||
int8_t flags;
|
int8_t flags;
|
||||||
col_id_t colId;
|
col_id_t colId;
|
||||||
int32_t bytes;
|
int32_t bytes;
|
||||||
char name[TSDB_COL_NAME_LEN];
|
char name[TSDB_COL_NAME_LEN];
|
||||||
char alias[TSDB_COL_NAME_LEN];
|
uint32_t compress;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -58,15 +58,17 @@ extern "C" {
|
||||||
#ifdef TD_TSZ
|
#ifdef TD_TSZ
|
||||||
extern bool lossyFloat;
|
extern bool lossyFloat;
|
||||||
extern bool lossyDouble;
|
extern bool lossyDouble;
|
||||||
int32_t tsCompressInit(char* lossyColumns, float fPrecision, double dPrecision, uint32_t maxIntervals, uint32_t intervals,
|
int32_t tsCompressInit(char *lossyColumns, float fPrecision, double dPrecision, uint32_t maxIntervals,
|
||||||
int32_t ifAdtFse, const char* compressor);
|
uint32_t intervals, int32_t ifAdtFse, const char *compressor);
|
||||||
|
|
||||||
void tsCompressExit();
|
void tsCompressExit();
|
||||||
|
|
||||||
int32_t tsCompressFloatLossyImp(const char *const input, const int32_t nelements, char *const output);
|
int32_t tsCompressFloatLossyImp(const char *const input, const int32_t nelements, char *const output);
|
||||||
int32_t tsDecompressFloatLossyImp(const char *const input, int32_t compressedSize, const int32_t nelements, char *const output);
|
int32_t tsDecompressFloatLossyImp(const char *const input, int32_t compressedSize, const int32_t nelements,
|
||||||
|
char *const output);
|
||||||
int32_t tsCompressDoubleLossyImp(const char *const input, const int32_t nelements, char *const output);
|
int32_t tsCompressDoubleLossyImp(const char *const input, const int32_t nelements, char *const output);
|
||||||
int32_t tsDecompressDoubleLossyImp(const char *const input, int32_t compressedSize, const int32_t nelements, char *const output);
|
int32_t tsDecompressDoubleLossyImp(const char *const input, int32_t compressedSize, const int32_t nelements,
|
||||||
|
char *const output);
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tsCompressFloatLossy(const char *const input, int32_t inputSize, const int32_t nelements,
|
static FORCE_INLINE int32_t tsCompressFloatLossy(const char *const input, int32_t inputSize, const int32_t nelements,
|
||||||
char *const output, int32_t outputSize, char algorithm,
|
char *const output, int32_t outputSize, char algorithm,
|
||||||
|
@ -139,7 +141,8 @@ int32_t getWordLength(char type);
|
||||||
int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, char *const output, const char type);
|
int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, char *const output, const char type);
|
||||||
int32_t tsDecompressFloatImplAvx512(const char *const input, const int32_t nelements, char *const output);
|
int32_t tsDecompressFloatImplAvx512(const char *const input, const int32_t nelements, char *const output);
|
||||||
int32_t tsDecompressFloatImplAvx2(const char *const input, const int32_t nelements, char *const output);
|
int32_t tsDecompressFloatImplAvx2(const char *const input, const int32_t nelements, char *const output);
|
||||||
int32_t tsDecompressTimestampAvx512(const char* const input, const int32_t nelements, char *const output, bool bigEndian);
|
int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output,
|
||||||
|
bool bigEndian);
|
||||||
int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelements, char *const output, bool bigEndian);
|
int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelements, char *const output, bool bigEndian);
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -153,6 +156,29 @@ int32_t tCompressStart(SCompressor *pCmprsor, int8_t type, int8_t cmprAlg);
|
||||||
int32_t tCompressEnd(SCompressor *pCmprsor, const uint8_t **ppOut, int32_t *nOut, int32_t *nOrigin);
|
int32_t tCompressEnd(SCompressor *pCmprsor, const uint8_t **ppOut, int32_t *nOut, int32_t *nOrigin);
|
||||||
int32_t tCompress(SCompressor *pCmprsor, const void *pData, int64_t nData);
|
int32_t tCompress(SCompressor *pCmprsor, const void *pData, int64_t nData);
|
||||||
|
|
||||||
|
|
||||||
|
typedef int32_t (*__data_compress_init)(char *lossyColumns, float fPrecision, double dPrecision, uint32_t maxIntervals,
|
||||||
|
uint32_t intervals, int32_t ifAdtFse, const char *compressor);
|
||||||
|
typedef int32_t (*__data_compress_l1_fn_t)(const char *const input, const int32_t nelements, char *const output,
|
||||||
|
const char type);
|
||||||
|
typedef int32_t (*__data_decompress_l1_fn_t)(const char *const input, const int32_t nelements, char *const output,
|
||||||
|
const char type);
|
||||||
|
|
||||||
|
typedef int32_t (*__data_compress_l2_fn_t)(const char *const input, const int32_t nelements, char *const output,
|
||||||
|
const char type);
|
||||||
|
typedef int32_t (*__data_decompress_l2_fn_t)(const char *const input, const int32_t nelements, char *const output,
|
||||||
|
const char type);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int8_t type;
|
||||||
|
int8_t level;
|
||||||
|
__data_compress_init initFn;
|
||||||
|
__data_compress_l1_fn_t l1CompFn;
|
||||||
|
__data_decompress_l1_fn_t l1DeCompFn;
|
||||||
|
__data_compress_l2_fn_t l2CompFn;
|
||||||
|
__data_decompress_l2_fn_t l2DeCompFn;
|
||||||
|
} TCompressPara;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,6 +54,11 @@
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TCompressPara compressDict = {
|
||||||
|
{},
|
||||||
|
}
|
||||||
#ifdef TD_TSZ
|
#ifdef TD_TSZ
|
||||||
#include "td_sz.h"
|
#include "td_sz.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,9 +73,10 @@ static const int32_t TEST_NUMBER = 1;
|
||||||
bool lossyFloat = false;
|
bool lossyFloat = false;
|
||||||
bool lossyDouble = false;
|
bool lossyDouble = false;
|
||||||
|
|
||||||
|
|
||||||
// init call
|
// init call
|
||||||
int32_t tsCompressInit(char* lossyColumns, float fPrecision, double dPrecision, uint32_t maxIntervals, uint32_t intervals,
|
int32_t tsCompressInit(char *lossyColumns, float fPrecision, double dPrecision, uint32_t maxIntervals,
|
||||||
int32_t ifAdtFse, const char* compressor) {
|
uint32_t intervals, int32_t ifAdtFse, const char *compressor) {
|
||||||
// config
|
// config
|
||||||
lossyFloat = strstr(lossyColumns, "float") != NULL;
|
lossyFloat = strstr(lossyColumns, "float") != NULL;
|
||||||
lossyDouble = strstr(lossyColumns, "double") != NULL;
|
lossyDouble = strstr(lossyColumns, "double") != NULL;
|
||||||
|
|
Loading…
Reference in New Issue