You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by hb...@apache.org on 2016/07/08 19:00:58 UTC
incubator-quickstep git commit: Prevent divide by zero.
Repository: incubator-quickstep
Updated Branches:
refs/heads/scheduler++ ebaf0f765 -> 03c35b92f
Prevent divide by zero.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/03c35b92
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/03c35b92
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/03c35b92
Branch: refs/heads/scheduler++
Commit: 03c35b92fe3e5ccb6ff3737de048d4d68de0df54
Parents: ebaf0f7
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Fri Jul 8 14:00:26 2016 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Fri Jul 8 14:00:26 2016 -0500
----------------------------------------------------------------------
query_execution/Learner.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/03c35b92/query_execution/Learner.cpp
----------------------------------------------------------------------
diff --git a/query_execution/Learner.cpp b/query_execution/Learner.cpp
index 496ac9e..1908f5a 100644
--- a/query_execution/Learner.cpp
+++ b/query_execution/Learner.cpp
@@ -316,9 +316,13 @@ void Learner::printPredictedWorkOrderTimes() {
auto query_stats = stats->getCurrentStats();
output += std::to_string(qid_priority_pair.first);
output += ",";
- const float mean_workorder_time =
- query_stats.first / static_cast<float>(query_stats.second);
- output += std::to_string(mean_workorder_time);
+ if (query_stats.second != 0) {
+ const float mean_workorder_time =
+ query_stats.first / static_cast<float>(query_stats.second);
+ output += std::to_string(mean_workorder_time);
+ } else {
+ output += std::to_string(0.0);
+ }
output += ",";
}
if (!output.empty()) {