You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by zu...@apache.org on 2016/05/30 22:47:20 UTC

[12/32] incubator-quickstep git commit: Fix bug in the SMA code (#223)

Fix bug in the SMA code (#223)

* Fix bug in the SMA code so that the SMA predicate evaluation is only
applied if at least one of the operands in the predicate is a
static value.


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

Branch: refs/heads/master
Commit: 1fa81a8bd2efc7e7638fb0952c422c20dd9ce2fa
Parents: ba25b13
Author: Jignesh Patel <pa...@users.noreply.github.com>
Authored: Mon May 16 12:04:32 2016 -0500
Committer: Zuyu Zhang <zz...@pivotal.io>
Committed: Mon May 30 15:47:27 2016 -0700

----------------------------------------------------------------------
 storage/SMAIndexSubBlock.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1fa81a8b/storage/SMAIndexSubBlock.cpp
----------------------------------------------------------------------
diff --git a/storage/SMAIndexSubBlock.cpp b/storage/SMAIndexSubBlock.cpp
index 2a0e4f9..aa9bc54 100644
--- a/storage/SMAIndexSubBlock.cpp
+++ b/storage/SMAIndexSubBlock.cpp
@@ -621,9 +621,14 @@ Selectivity SMAIndexSubBlock::getSelectivityForPredicate(const ComparisonPredica
 predicate_cost_t SMAIndexSubBlock::estimatePredicateEvaluationCost(
     const ComparisonPredicate &predicate) const {
   DCHECK(initialized_);
-  Selectivity selectivity = getSelectivityForPredicate(predicate);
-  if (selectivity == Selectivity::kAll || selectivity == Selectivity::kNone) {
-    return predicate_cost::kConstantTime;
+
+  // Check that at least one of the operands has a static value.
+  if (predicate.getLeftOperand().hasStaticValue() ||
+      predicate.getRightOperand().hasStaticValue()) {
+    Selectivity selectivity = getSelectivityForPredicate(predicate);
+    if (selectivity == Selectivity::kAll || selectivity == Selectivity::kNone) {
+      return predicate_cost::kConstantTime;
+    }
   }
   return predicate_cost::kInfinite;
 }