Fixed the check failure if a query does not have profiling info.

Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/b1aab009
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/b1aab009
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/b1aab009

Branch: refs/heads/fix-compare-aggregate
Commit: b1aab0096ac67a623d860c1b70a6c558ea2ad450
Parents: 9dc9dfb
Author: Zuyu Zhang <z...@cs.wisc.edu>
Authored: Thu Aug 3 14:43:56 2017 -0500
Committer: Zuyu Zhang <z...@cs.wisc.edu>
Committed: Thu Aug 3 14:43:56 2017 -0500

----------------------------------------------------------------------
 cli/QuickstepCli.cpp            | 6 ++++--
 query_execution/ForemanBase.hpp | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b1aab009/cli/QuickstepCli.cpp
----------------------------------------------------------------------
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 @@ int main(int argc, char* argv[]) {
             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) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b1aab009/query_execution/ForemanBase.hpp
----------------------------------------------------------------------
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 @@ class ForemanBase : public Thread {
    * @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;
   }
 
   /**

Reply via email to