quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbdeshm...@apache.org
Subject [15/20] incubator-quickstep git commit: Bug fixed in Query Manager
Date Sat, 02 Jul 2016 23:17:51 GMT
Bug fixed in Query Manager

- Added a method to print probabilities.


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

Branch: refs/heads/scheduler++
Commit: 38bafe0dd34edddf278fad8cc613589635c8e358
Parents: 2d2c284
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Thu Jun 30 23:40:25 2016 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Sat Jul 2 18:16:30 2016 -0500

----------------------------------------------------------------------
 query_execution/Learner.cpp          | 18 ++++++++++++++++++
 query_execution/Learner.hpp          |  2 ++
 query_execution/ProbabilityStore.hpp | 12 ++++++++++++
 query_execution/QueryManager.cpp     |  7 ++++---
 4 files changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/38bafe0d/query_execution/Learner.cpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.cpp b/query_execution/Learner.cpp
index 183d688..3c6f42b 100644
--- a/query_execution/Learner.cpp
+++ b/query_execution/Learner.cpp
@@ -61,6 +61,7 @@ void Learner::addCompletionFeedback(
   }
   updateProbabilitiesForQueriesInPriorityLevel(priority_level, query_id);
   updateProbabilitiesOfAllPriorityLevels();
+  printProbabilitiesForPriorityLevel(priority_level);
 }
 
 void Learner::updateProbabilitiesForQueriesInPriorityLevel(
@@ -268,4 +269,21 @@ void Learner::checkAndRemovePriorityLevel(const std::size_t priority_level)
{
   }
 }
 
+void Learner::printProbabilitiesForPriorityLevel(const std::size_t priority_level) {
+  DCHECK(isPriorityLevelPresent(priority_level));
+  if (hasFeedbackFromAllQueriesInPriorityLevel(priority_level)) {
+    DCHECK(current_probabilities_.at(priority_level) != nullptr);
+    const auto it = current_probabilities_.find(priority_level);
+    if (it->second->getNumObjects() > 0) {
+      it->second->printIndividualProbabilities();
+    }
+  } else {
+    DCHECK(default_probabilities_.at(priority_level) != nullptr);
+    const auto it = default_probabilities_.find(priority_level);
+    if (it->second->getNumObjects() > 0) {
+      it->second->printIndividualProbabilities();
+    }
+  }
+}
+
 }  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/38bafe0d/query_execution/Learner.hpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.hpp b/query_execution/Learner.hpp
index 024dc9b..6cea325 100644
--- a/query_execution/Learner.hpp
+++ b/query_execution/Learner.hpp
@@ -470,6 +470,8 @@ class Learner {
     return true;
   }
 
+  void printProbabilitiesForPriorityLevel(const std::size_t priority_level);
+
   // Key = Priority level, value = A vector of pairs.
   // Each pair:
   // 1st element: Query ID.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/38bafe0d/query_execution/ProbabilityStore.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ProbabilityStore.hpp b/query_execution/ProbabilityStore.hpp
index 4ae085e..bcb2c0d 100644
--- a/query_execution/ProbabilityStore.hpp
+++ b/query_execution/ProbabilityStore.hpp
@@ -21,6 +21,7 @@
 #include <algorithm>
 #include <cstddef>
 #include <random>
+#include <string>
 #include <unordered_map>
 #include <utility>
 #include <vector>
@@ -234,6 +235,17 @@ class ProbabilityStore {
     return getPropertyForProbability(chosen_probability);
   }
 
+  void printIndividualProbabilities() const {
+    std::string result = "";
+    for (auto prob_pair : individual_probabilities_) {
+      result += std::to_string(prob_pair.first);
+      result += ":";
+      result += std::to_string(prob_pair.second.second);
+      result += "|";
+    }
+    LOG(INFO) << result;
+  }
+
  private:
   class ProbabilityInfo {
    public:

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/38bafe0d/query_execution/QueryManager.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManager.cpp b/query_execution/QueryManager.cpp
index d20b592..3be5ee4 100644
--- a/query_execution/QueryManager.cpp
+++ b/query_execution/QueryManager.cpp
@@ -238,16 +238,17 @@ QueryManager::QueryStatusCode QueryManager::processMessage(
       LOG(FATAL) << "Unknown message type found in QueryManager";
   }
 
+  QueryStatusCode result = QueryStatusCode::kNone;
   if (query_exec_state_->hasExecutionFinished(op_index)) {
-    return QueryStatusCode::kOperatorExecuted;
+    result = QueryStatusCode::kOperatorExecuted;
   }
 
   // As kQueryExecuted takes precedence over kOperatorExecuted, we check again.
   if (query_exec_state_->hasQueryExecutionFinished()) {
-    return QueryStatusCode::kQueryExecuted;
+    result = QueryStatusCode::kQueryExecuted;
   }
 
-  return QueryStatusCode::kNone;
+  return result;
 }
 
 void QueryManager::processFeedbackMessage(


Mime
View raw message