Fixed the check failure if a query does not have profiling info.
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index d8e3c5c..bf65699 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -406,9 +406,11 @@
foreman.printWorkOrderProfilingResults(query_id, stdout);
}
if (quickstep::FLAGS_visualize_execution_dag) {
- const auto &profiling_stats =
+ const auto *profiling_stats =
foreman.getWorkOrderProfilingResults(query_id);
- dag_visualizer->bindProfilingStats(profiling_stats);
+ if (profiling_stats) {
+ dag_visualizer->bindProfilingStats(*profiling_stats);
+ }
std::cerr << "\n" << dag_visualizer->toDOT() << "\n";
}
} catch (const std::exception &e) {
diff --git a/query_execution/ForemanBase.hpp b/query_execution/ForemanBase.hpp
index ee6c7ce..60434a3 100644
--- a/query_execution/ForemanBase.hpp
+++ b/query_execution/ForemanBase.hpp
@@ -84,9 +84,11 @@
* @param query_id The ID of the query for which the results are to be printed.
* @return A vector of records, each being a single profiling entry.
**/
- const std::vector<WorkOrderTimeEntry>& getWorkOrderProfilingResults(
+ const std::vector<WorkOrderTimeEntry>* getWorkOrderProfilingResults(
const std::size_t query_id) const {
- return policy_enforcer_->getProfilingResults(query_id);
+ return policy_enforcer_->hasProfilingResults(query_id)
+ ? &(policy_enforcer_->getProfilingResults(query_id))
+ : nullptr;
}
/**