Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 24 additions & 31 deletions components/core/src/clp/streaming_archive/reader/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,39 +257,32 @@ 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 vars_ix_end{m_variables_ix + num_vars};
Comment thread
LinZhihao-723 marked this conversation as resolved.
Resolved
Comment thread
LinZhihao-723 marked this conversation as resolved.
Resolved
if (vars_ix_end > m_num_variables) {
// Logtypes not in sync with variables, so stop search
return nullptr;
}
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
auto const timestamp{m_timestamps[m_msgs_ix]};
if (false == query.timestamp_is_in_search_time_range(timestamp)) {
continue;
}

for (auto sub_query : query.get_relevant_sub_queries()) {
// Check if logtype matches search
if (sub_query->matches_logtype(logtype_id)) {
// Check if timestamp matches
auto timestamp = m_timestamps[m_msgs_ix];
if (query.timestamp_is_in_search_time_range(timestamp)) {
// Get variables
if (m_variables_ix + num_vars > m_num_variables) {
// Logtypes not in sync with variables, so stop search
return nullptr;
}

msg.clear_vars();
auto vars_ix = m_variables_ix;
for (size_t i = 0; i < num_vars; ++i) {
auto var = m_variables[vars_ix];
++vars_ix;
msg.add_var(var);
}

// Check if variables match
if (sub_query->matches_vars(msg.get_vars())) {
// Message matches completely, so set remaining properties
msg.set_logtype_id(logtype_id);
msg.set_timestamp(timestamp);
msg.set_message_number(m_msgs_ix);

matching_sub_query = sub_query;
break;
}
}
for (auto const* sub_query : query.get_relevant_sub_queries()) {
if (false == sub_query->matches_logtype(logtype_id)) {
continue;
}
msg.clear_vars();
Comment thread
LinZhihao-723 marked this conversation as resolved.
Resolved
for (auto vars_ix{m_variables_ix}; vars_ix < vars_ix_end; ++vars_ix) {
msg.add_var(m_variables[vars_ix]);
}
if (false == sub_query->matches_vars(msg.get_vars())) {
continue;
}
msg.set_logtype_id(logtype_id);
Comment thread
LinZhihao-723 marked this conversation as resolved.
Resolved
msg.set_timestamp(timestamp);
msg.set_message_number(m_msgs_ix);
matching_sub_query = sub_query;
break;
}

// Advance indices
Expand Down