quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbdeshm...@apache.org
Subject incubator-quickstep git commit: Fixed bugs about float division
Date Fri, 15 Jul 2016 04:34:14 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/scheduler++ a8405445b -> eecdc5d87


Fixed bugs about float division


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

Branch: refs/heads/scheduler++
Commit: eecdc5d87ed73044e4ce45e4a76c985fbf17f091
Parents: a840544
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Thu Jul 14 23:33:14 2016 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Thu Jul 14 23:33:14 2016 -0500

----------------------------------------------------------------------
 query_execution/Learner.cpp | 10 +++++-----
 query_execution/Learner.hpp |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/eecdc5d8/query_execution/Learner.cpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.cpp b/query_execution/Learner.cpp
index 0bedb73..264e84e 100644
--- a/query_execution/Learner.cpp
+++ b/query_execution/Learner.cpp
@@ -76,7 +76,7 @@ void Learner::updateProbabilitiesForQueriesInPriorityLevel(
     return;
   }
   // Else, there are more than one queries for the given priority level.
-  std::unordered_map<std::size_t, std::size_t>
+  std::unordered_map<std::size_t, float>
       mean_workorders_per_query =
           getMeanWorkOrderTimesForQueriesInPriorityLevel(priority_level);
   const float denominator = calculateDenominator(mean_workorders_per_query);
@@ -108,16 +108,16 @@ void Learner::updateProbabilitiesOfAllPriorityLevels() {
     return;
   }
   // Compute the predicted work order execution times for all the level.
-  std::unordered_map<std::size_t, std::size_t> predicted_time_for_level;
+  std::unordered_map<std::size_t, float> predicted_time_for_level;
   std::size_t sum_active_priorities = 0;
   for (auto priority_iter = execution_stats_.begin();
        priority_iter != execution_stats_.end();
        ++priority_iter) {
-    std::size_t total_time_curr_level = 0;
+    float total_time_curr_level = 0;
     const std::size_t curr_priority_level = priority_iter->first;
     sum_active_priorities += curr_priority_level;
     // For each query, find its predicted work order execution time.
-    const std::unordered_map<std::size_t, std::size_t>
+    const std::unordered_map<std::size_t, float>
         mean_workorders_all_queries_curr_level =
             getMeanWorkOrderTimesForQueriesInPriorityLevel(
                 curr_priority_level);
@@ -138,7 +138,7 @@ void Learner::updateProbabilitiesOfAllPriorityLevels() {
   float total_num_workorders = 0;
   for (auto predicted_time_iter : predicted_time_for_level) {
     const std::size_t curr_priority_level = predicted_time_iter.first;
-    const std::size_t num_workorders_for_curr_level =
+    const float num_workorders_for_curr_level =
         (predicted_time_iter.second == 0)
             ? 0
             : static_cast<float>(curr_priority_level) /

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/eecdc5d8/query_execution/Learner.hpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.hpp b/query_execution/Learner.hpp
index 26daf6e..f61e4f9 100644
--- a/query_execution/Learner.hpp
+++ b/query_execution/Learner.hpp
@@ -467,18 +467,18 @@ class Learner {
    * @return An unordered_map in which: Key = query ID.
    *         Value = Mean time per work order for that query.
    **/
-  inline std::unordered_map<std::size_t, std::size_t>
+  inline std::unordered_map<std::size_t, float>
   getMeanWorkOrderTimesForQueriesInPriorityLevel(
       const std::size_t priority_level) {
     DCHECK(isPriorityLevelPresent(priority_level));
-    std::unordered_map<std::size_t, std::size_t> result;
+    std::unordered_map<std::size_t, float> result;
     for (auto it = execution_stats_[priority_level].begin();
          it != execution_stats_[priority_level].end();
          ++it) {
       DCHECK(it->second.get() != nullptr);
       auto query_stats = it->second->getCurrentStats();
       result[it->first] =
-          query_stats.second == 0 ? 0 : query_stats.first / query_stats.second;
+          query_stats.second == 0 ? 0 : query_stats.first / float(query_stats.second);
     }
     return result;
   }
@@ -494,7 +494,7 @@ class Learner {
    * @return The denominator to be used for probability calculations.
    **/
   inline float calculateDenominator(
-      const std::unordered_map<std::size_t, std::size_t>
+      const std::unordered_map<std::size_t, float>
           &mean_workorder_per_query) const {
     float denominator = 0;
     for (const auto &element : mean_workorder_per_query) {


Mime
View raw message