-
Notifications
You must be signed in to change notification settings - Fork 83
feat(clp-s)!: Use core clp parsing and search code in clp-s; Bump archive version to 0.4.0. #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
d0637da
a67f996
6fd85dc
b1b2325
069f9d7
c72107f
30d673a
8cd9af2
e8c3e28
53c6933
43052af
26cd059
514ecdd
d594d67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,13 @@ | ||
| #include "ColumnWriter.hpp" | ||
|
|
||
| #include <cstdint> | ||
| #include <variant> | ||
|
|
||
| #include "../clp/Defs.h" | ||
| #include "../clp/EncodedVariableInterpreter.hpp" | ||
| #include "ParsedMessage.hpp" | ||
| #include "ZstdCompressor.hpp" | ||
|
|
||
| namespace clp_s { | ||
| size_t Int64ColumnWriter::add_value(ParsedMessage::variable_t& value) { | ||
| m_values.push_back(std::get<int64_t>(value)); | ||
|
|
@@ -49,15 +57,16 @@ void BooleanColumnWriter::store(ZstdCompressor& compressor) { | |
| } | ||
|
|
||
| size_t ClpStringColumnWriter::add_value(ParsedMessage::variable_t& value) { | ||
| std::string string_var = std::get<std::string>(value); | ||
| uint64_t id; | ||
| uint64_t offset = m_encoded_vars.size(); | ||
| VariableEncoder::encode_and_add_to_dictionary( | ||
| string_var, | ||
| uint64_t offset{m_encoded_vars.size()}; | ||
| m_temp_var_dict_ids.clear(); | ||
|
||
| clp::EncodedVariableInterpreter::encode_and_add_to_dictionary( | ||
| std::get<std::string>(value), | ||
| m_logtype_entry, | ||
| *m_var_dict, | ||
| m_encoded_vars | ||
| m_encoded_vars, | ||
| m_temp_var_dict_ids | ||
| ); | ||
| clp::logtype_dictionary_id_t id{}; | ||
| m_log_dict->add_entry(m_logtype_entry, id); | ||
| auto encoded_id = encode_log_dict_id(id, offset); | ||
| m_logtypes.push_back(encoded_id); | ||
|
|
@@ -74,15 +83,14 @@ void ClpStringColumnWriter::store(ZstdCompressor& compressor) { | |
| } | ||
|
|
||
| size_t VariableStringColumnWriter::add_value(ParsedMessage::variable_t& value) { | ||
| std::string string_var = std::get<std::string>(value); | ||
| uint64_t id; | ||
| m_var_dict->add_entry(string_var, id); | ||
| clp::variable_dictionary_id_t id{}; | ||
| m_var_dict->add_entry(std::get<std::string>(value), id); | ||
| m_variables.push_back(id); | ||
| return sizeof(int64_t); | ||
| return sizeof(clp::variable_dictionary_id_t); | ||
| } | ||
|
|
||
| void VariableStringColumnWriter::store(ZstdCompressor& compressor) { | ||
| size_t size = m_variables.size() * sizeof(int64_t); | ||
| size_t size = m_variables.size() * sizeof(clp::variable_dictionary_id_t); | ||
|
||
| compressor.write(reinterpret_cast<char const*>(m_variables.data()), size); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,11 @@ | |
| #include <utility> | ||
| #include <variant> | ||
|
|
||
| #include "../clp/Defs.h" | ||
| #include "DictionaryWriter.hpp" | ||
| #include "FileWriter.hpp" | ||
| #include "ParsedMessage.hpp" | ||
| #include "TimestampDictionaryWriter.hpp" | ||
| #include "VariableEncoder.hpp" | ||
| #include "ZstdCompressor.hpp" | ||
|
|
||
| namespace clp_s { | ||
|
|
@@ -141,15 +141,15 @@ class ClpStringColumnWriter : public BaseColumnWriter { | |
| * @param encoded_id | ||
| * @return the encoded log dict id | ||
| */ | ||
| static int64_t get_encoded_log_dict_id(uint64_t encoded_id) { | ||
| return (int64_t)encoded_id & cLogDictIdMask; | ||
| static clp::logtype_dictionary_id_t get_encoded_log_dict_id(uint64_t encoded_id) { | ||
| return static_cast<clp::logtype_dictionary_id_t>(encoded_id & cLogDictIdMask); | ||
| } | ||
|
|
||
| /** | ||
| * @param encoded_id | ||
| * @return The encoded offset | ||
| */ | ||
| static int64_t get_encoded_offset(uint64_t encoded_id) { | ||
| static uint64_t get_encoded_offset(uint64_t encoded_id) { | ||
| return ((int64_t)encoded_id & cOffsetMask) >> cOffsetBitPosition; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
@@ -160,8 +160,8 @@ class ClpStringColumnWriter : public BaseColumnWriter { | |
| * @param offset | ||
| * @return The encoded log dict id | ||
| */ | ||
| static int64_t encode_log_dict_id(uint64_t id, uint64_t offset) { | ||
| return ((int64_t)id) | ((int64_t)offset) << cOffsetBitPosition; | ||
| static uint64_t encode_log_dict_id(clp::logtype_dictionary_id_t id, uint64_t offset) { | ||
| return static_cast<uint64_t>(id) | (offset << cOffsetBitPosition); | ||
haiqi96 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| static constexpr int cOffsetBitPosition = 24; | ||
|
|
@@ -174,6 +174,7 @@ class ClpStringColumnWriter : public BaseColumnWriter { | |
|
|
||
| std::vector<int64_t> m_logtypes; | ||
|
||
| std::vector<int64_t> m_encoded_vars; | ||
|
||
| std::vector<clp::variable_dictionary_id_t> m_temp_var_dict_ids; | ||
| }; | ||
|
|
||
| class VariableStringColumnWriter : public BaseColumnWriter { | ||
|
|
@@ -193,7 +194,7 @@ class VariableStringColumnWriter : public BaseColumnWriter { | |
|
|
||
| private: | ||
| std::shared_ptr<VariableDictionaryWriter> m_var_dict; | ||
| std::vector<int64_t> m_variables; | ||
| std::vector<clp::variable_dictionary_id_t> m_variables; | ||
|
||
| }; | ||
|
|
||
| class DateStringColumnWriter : public BaseColumnWriter { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's alphabetically reorder these two