From 2100967be797d72d8e1e1596bca47a25e9033565 Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Thu, 9 Jan 2025 13:59:45 -0500 Subject: [PATCH 1/4] Fix... --- .../src/clp/streaming_archive/reader/File.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/core/src/clp/streaming_archive/reader/File.cpp b/components/core/src/clp/streaming_archive/reader/File.cpp index 7de4ccbec..8a8b28bc9 100644 --- a/components/core/src/clp/streaming_archive/reader/File.cpp +++ b/components/core/src/clp/streaming_archive/reader/File.cpp @@ -251,15 +251,22 @@ bool File::find_message_in_time_range( SubQuery const* File::find_message_matching_query(Query const& query, Message& msg) { SubQuery const* matching_sub_query = nullptr; + while (m_msgs_ix < m_num_messages && nullptr == matching_sub_query) { - auto logtype_id = m_logtypes[m_msgs_ix]; + auto const curr_msg_ix{m_msgs_ix}; + auto logtype_id = m_logtypes[curr_msg_ix]; // Get number of variables in logtype auto const& logtype_dictionary_entry = m_archive_logtype_dict->get_entry(logtype_id); auto const num_vars = logtype_dictionary_entry.get_num_variables(); - + auto const var_begin_ix{m_variables_ix}; auto const vars_end_ix{m_variables_ix + num_vars}; - auto const timestamp{m_timestamps[m_msgs_ix]}; + + // Advance indices + ++m_msgs_ix; + m_variables_ix = vars_end_ix; + + auto const timestamp{m_timestamps[curr_msg_ix]}; if (false == query.timestamp_is_in_search_time_range(timestamp)) { continue; } @@ -270,7 +277,7 @@ SubQuery const* File::find_message_matching_query(Query const& query, Message& m } msg.clear_vars(); - for (auto vars_ix{m_variables_ix}; vars_ix < vars_end_ix; ++vars_ix) { + for (auto vars_ix{var_begin_ix}; vars_ix < vars_end_ix; ++vars_ix) { msg.add_var(m_variables[vars_ix]); } if (false == sub_query->matches_vars(msg.get_vars())) { @@ -279,14 +286,10 @@ SubQuery const* File::find_message_matching_query(Query const& query, Message& m msg.set_logtype_id(logtype_id); msg.set_timestamp(timestamp); - msg.set_msg_ix(m_begin_message_ix, m_msgs_ix); + msg.set_msg_ix(m_begin_message_ix, curr_msg_ix); matching_sub_query = sub_query; break; } - - // Advance indices - ++m_msgs_ix; - m_variables_ix += num_vars; } return matching_sub_query; From 82a2dc59a747b8e0dace331573f47030fc8c2c4e Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Thu, 9 Jan 2025 14:07:12 -0500 Subject: [PATCH 2/4] Remove empty line --- components/core/src/clp/streaming_archive/reader/File.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/components/core/src/clp/streaming_archive/reader/File.cpp b/components/core/src/clp/streaming_archive/reader/File.cpp index 8a8b28bc9..2b62776f4 100644 --- a/components/core/src/clp/streaming_archive/reader/File.cpp +++ b/components/core/src/clp/streaming_archive/reader/File.cpp @@ -251,7 +251,6 @@ bool File::find_message_in_time_range( SubQuery const* File::find_message_matching_query(Query const& query, Message& msg) { SubQuery const* matching_sub_query = nullptr; - while (m_msgs_ix < m_num_messages && nullptr == matching_sub_query) { auto const curr_msg_ix{m_msgs_ix}; auto logtype_id = m_logtypes[curr_msg_ix]; From 82cc3490779d93aca1b099c738c3f8b5ba33d618 Mon Sep 17 00:00:00 2001 From: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:31:32 -0500 Subject: [PATCH 3/4] Update components/core/src/clp/streaming_archive/reader/File.cpp Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com> --- components/core/src/clp/streaming_archive/reader/File.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/core/src/clp/streaming_archive/reader/File.cpp b/components/core/src/clp/streaming_archive/reader/File.cpp index 2b62776f4..24f2ec605 100644 --- a/components/core/src/clp/streaming_archive/reader/File.cpp +++ b/components/core/src/clp/streaming_archive/reader/File.cpp @@ -258,6 +258,7 @@ SubQuery const* File::find_message_matching_query(Query const& query, Message& m // Get number of variables in logtype auto const& logtype_dictionary_entry = m_archive_logtype_dict->get_entry(logtype_id); auto const num_vars = logtype_dictionary_entry.get_num_variables(); + auto const var_begin_ix{m_variables_ix}; auto const vars_end_ix{m_variables_ix + num_vars}; From d54c2dc02976bf11b936a4258a39cdcf29d661cf Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Thu, 9 Jan 2025 15:43:34 -0500 Subject: [PATCH 4/4] Fix variable naming --- components/core/src/clp/streaming_archive/reader/File.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/core/src/clp/streaming_archive/reader/File.cpp b/components/core/src/clp/streaming_archive/reader/File.cpp index 24f2ec605..e3b2e6d41 100644 --- a/components/core/src/clp/streaming_archive/reader/File.cpp +++ b/components/core/src/clp/streaming_archive/reader/File.cpp @@ -259,7 +259,7 @@ SubQuery const* File::find_message_matching_query(Query const& query, Message& m auto const& logtype_dictionary_entry = m_archive_logtype_dict->get_entry(logtype_id); auto const num_vars = logtype_dictionary_entry.get_num_variables(); - auto const var_begin_ix{m_variables_ix}; + auto const vars_begin_ix{m_variables_ix}; auto const vars_end_ix{m_variables_ix + num_vars}; // Advance indices @@ -277,7 +277,7 @@ SubQuery const* File::find_message_matching_query(Query const& query, Message& m } msg.clear_vars(); - for (auto vars_ix{var_begin_ix}; vars_ix < vars_end_ix; ++vars_ix) { + for (auto vars_ix{vars_begin_ix}; vars_ix < vars_end_ix; ++vars_ix) { msg.add_var(m_variables[vars_ix]); } if (false == sub_query->matches_vars(msg.get_vars())) {