Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions components/core/src/clp_s/search/Projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ void Projection::resolve_column(

auto cur_node_id = tree->get_object_subtree_node_id_for_namespace(column->get_namespace());
if (-1 == cur_node_id) {
m_ordered_matching_nodes.emplace_back(std::vector<int32_t>{});
return;
}
std::vector<int32_t> matching_nodes_for_column;
auto it = column->descriptor_begin();
while (it != column->descriptor_end()) {
bool matched_any{false};
Expand All @@ -77,6 +79,7 @@ void Projection::resolve_column(
matched_any = true;
if (last_token && column->matches_type(node_to_literal_type(child_node.get_type()))) {
m_matching_nodes.insert(child_node_id);
matching_nodes_for_column.emplace_back(child_node_id);
} else if (false == last_token) {
cur_node_id = child_node_id;
break;
Expand All @@ -87,5 +90,6 @@ void Projection::resolve_column(
break;
}
}
m_ordered_matching_nodes.emplace_back(std::move(matching_nodes_for_column));
}
} // namespace clp_s::search
9 changes: 9 additions & 0 deletions components/core/src/clp_s/search/Projection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class Projection {
|| m_matching_nodes.contains(node_id);
}

/**
* Gets the matching nodes for each column. The matching nodes for each column are provided in
* the same order as `add_column` was invoked.
*/
auto get_ordered_matching_nodes() const -> std::vector<std::vector<int32_t>> const& {
return m_ordered_matching_nodes;
}

private:
/**
* Resolves an individual column as described by the `resolve_columns` method.
Expand All @@ -75,6 +83,7 @@ class Projection {

std::vector<std::shared_ptr<ColumnDescriptor>> m_selected_columns;
absl::flat_hash_set<int32_t> m_matching_nodes;
std::vector<std::vector<int32_t>> m_ordered_matching_nodes;
ProjectionMode m_projection_mode{ProjectionMode::ReturnAllColumns};
};
} // namespace clp_s::search
Expand Down
Loading