This is an automated email from the ASF dual-hosted git repository. colinlee pushed a commit to branch colin_fix_config in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit 5ecec9522efb065033aadfa7f68282f8928031c3 Author: ColinLee <[email protected]> AuthorDate: Mon May 12 12:00:54 2025 +0800 add default config. --- cpp/src/common/config/config.h | 7 +++++++ cpp/src/common/db_common.h | 42 ------------------------------------------ cpp/src/common/global.cc | 26 +++++++++++++++++--------- 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/cpp/src/common/config/config.h b/cpp/src/common/config/config.h index 1b9b27d2..e18f6d9c 100644 --- a/cpp/src/common/config/config.h +++ b/cpp/src/common/config/config.h @@ -45,6 +45,13 @@ typedef struct ConfigValue { int32_t chunk_group_size_threshold_; int32_t record_count_for_next_mem_check_; bool encrypt_flag_ = false; + TSEncoding boolean_encoding_type_; + TSEncoding int32_encoding_type_; + TSEncoding int64_encoding_type_; + TSEncoding float_encoding_type_; + TSEncoding double_encoding_type_; + TSEncoding string_encoding_type_; + CompressionType default_compression_type_; } ConfigValue; extern void init_config_value(); diff --git a/cpp/src/common/db_common.h b/cpp/src/common/db_common.h index b06c8fe4..5fe8b4fa 100644 --- a/cpp/src/common/db_common.h +++ b/cpp/src/common/db_common.h @@ -100,48 +100,6 @@ FORCE_INLINE const char* get_compression_name(CompressionType type) { return s_compression_names[type]; } -FORCE_INLINE TSEncoding get_default_encoding_for_type(TSDataType type) { - if (type == common::BOOLEAN) { - return PLAIN; - } else if (type == common::INT32) { - return PLAIN; - } else if (type == common::INT64) { - return PLAIN; - } else if (type == common::FLOAT) { - return PLAIN; - } else if (type == common::DOUBLE) { - return PLAIN; - } else if (type == common::TEXT) { - return PLAIN; - } else if (type == common::STRING) { - return PLAIN; - } else { - ASSERT(false); - } - return INVALID_ENCODING; -} - -FORCE_INLINE CompressionType get_default_compression_for_type(TSDataType type) { - if (type == common::BOOLEAN) { - return UNCOMPRESSED; - } else if (type == common::INT32) { - return UNCOMPRESSED; - } else if (type == common::INT64) { - return UNCOMPRESSED; - } else if (type == common::FLOAT) { - return UNCOMPRESSED; - } else if (type == common::DOUBLE) { - return UNCOMPRESSED; - } else if (type == common::TEXT) { - return UNCOMPRESSED; - } else if (type == common::STRING) { - return UNCOMPRESSED; - } else { - ASSERT(false); - } - return INVALID_COMPRESSION; -} - enum Ordering { DESC, ASC }; template <typename T> diff --git a/cpp/src/common/global.cc b/cpp/src/common/global.cc index c8ea574c..24da98a6 100644 --- a/cpp/src/common/global.cc +++ b/cpp/src/common/global.cc @@ -44,24 +44,32 @@ void init_config_value() { g_config_value_.time_encoding_type_ = TS_2DIFF; g_config_value_.time_data_type_ = INT64; g_config_value_.time_compress_type_ = LZ4; + // Not support RLE yet. + g_config_value_.boolean_encoding_type_ = PLAIN; + g_config_value_.int32_encoding_type_ = TS_2DIFF; + g_config_value_.int64_encoding_type_ = TS_2DIFF; + g_config_value_.float_encoding_type_ = GORILLA; + g_config_value_.double_encoding_type_ = GORILLA; + // Default compression type is LZ4 + g_config_value_.default_compression_type_ = LZ4; } extern TSEncoding get_value_encoder(TSDataType data_type) { switch (data_type) { case BOOLEAN: - return TSEncoding::RLE; + return g_config_value_.boolean_encoding_type_; case INT32: - return TSEncoding::TS_2DIFF; + return g_config_value_.int32_encoding_type_; case INT64: - return TSEncoding::TS_2DIFF; + return g_config_value_.int64_encoding_type_; case FLOAT: - return TSEncoding::GORILLA; + return g_config_value_.float_encoding_type_; case DOUBLE: - return TSEncoding::GORILLA; + return g_config_value_.double_encoding_type_; case TEXT: - return TSEncoding::PLAIN; + return g_config_value_.string_encoding_type_; case STRING: - return TSEncoding::PLAIN; + return g_config_value_.string_encoding_type_; case VECTOR: break; case NULL_TYPE: @@ -75,7 +83,7 @@ extern TSEncoding get_value_encoder(TSDataType data_type) { } extern CompressionType get_default_compressor() { - return LZ4; + return g_config_value_.default_compression_type_; } void config_set_page_max_point_count(uint32_t page_max_point_count) { @@ -121,7 +129,7 @@ bool is_timestamp_column_name(const char* time_col_name) { } void cols_to_json(ByteStream* byte_stream, - std::vector<common::ColumnSchema>& ret_ts_list) { + std::vector<storage::ColumnSchema>& ret_ts_list) { // 1. append start tag byte_stream->write_buf("{\n", 2);
