Updates to cost model

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

Branch: refs/heads/transitive-closure
Commit: d725bcafec86b7637ce08a24c309b2ea1981a618
Parents: a08044e
Author: Jianqiao Zhu <jianq...@cs.wisc.edu>
Authored: Fri Dec 1 17:20:25 2017 -0600
Committer: Jianqiao Zhu <jianq...@cs.wisc.edu>
Committed: Fri Dec 1 17:20:25 2017 -0600

----------------------------------------------------------------------
 query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d725bcaf/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp 
b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
index f7417b6..729a563 100644
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
+++ b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
@@ -486,7 +486,7 @@ std::size_t StarSchemaSimpleCostModel::getNumDistinctValues(
       return stat.getNumDistinctValues(rel_attr_id);
     }
   }
-  return estimateCardinalityForTableReference(table_reference);
+  return estimateCardinalityForTableReference(table_reference) * 0.5;
 }
 
 bool StarSchemaSimpleCostModel::impliesUniqueAttributes(
@@ -520,7 +520,7 @@ bool StarSchemaSimpleCostModel::impliesUniqueAttributes(
           std::static_pointer_cast<const P::TableReference>(physical_plan);
       const CatalogRelationStatistics &stat =
           table_reference->relation()->getStatistics();
-      if (stat.hasNumTuples()) {
+      if (stat.isExact() && stat.hasNumTuples()) {
         const std::size_t num_tuples = stat.getNumTuples();
         for (const auto &attr : attributes) {
           const attribute_id rel_attr_id =

Reply via email to