ArianaVillegas commented on a change in pull request #12031:
URL: https://github.com/apache/arrow/pull/12031#discussion_r774807237
##########
File path: cpp/src/arrow/compute/exec/exec_plan.cc
##########
@@ -157,11 +157,46 @@ struct ExecPlanImpl : public ExecPlan {
return std::move(Impl{nodes_}.sorted);
}
+ std::pair<NodeVector, std::vector<int>> OrderedNodes() const {
+ struct Impl {
+ const std::vector<std::unique_ptr<ExecNode>>& nodes;
+ std::unordered_set<ExecNode*> visited;
+ NodeVector sorted;
+ std::vector<int> indents;
+
+ explicit Impl(const std::vector<std::unique_ptr<ExecNode>>& nodes) :
nodes(nodes) {
+ visited.reserve(nodes.size());
+
+ for (auto it = nodes.rbegin(); it != nodes.rend(); ++it) {
+ if (visited.count(it->get()) != 0) return;
Review comment:
Yes, I think we should take care of odd cases too. I'll change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]