quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nav...@apache.org
Subject [1/5] incubator-quickstep git commit: Update build relation estimated cardinality for ExecutionHeuristics [Forced Update!]
Date Mon, 11 Jul 2016 17:28:53 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/expt_bloom_filter 4c5b736be -> f6eeb3586 (forced update)


Update build relation estimated cardinality for ExecutionHeuristics


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

Branch: refs/heads/expt_bloom_filter
Commit: 4031fbd3795f80a4a64706e6445192bc826acfb3
Parents: 14f726e
Author: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Authored: Mon Jul 11 11:35:56 2016 -0500
Committer: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Committed: Mon Jul 11 11:35:56 2016 -0500

----------------------------------------------------------------------
 query_optimizer/CMakeLists.txt                    |  1 +
 query_optimizer/ExecutionGenerator.cpp            |  6 +++++-
 query_optimizer/ExecutionGenerator.hpp            |  2 +-
 query_optimizer/ExecutionHeuristics.hpp           | 18 ++++++++++++++----
 .../tests/ExecutionHeuristics_unittest.cpp        |  3 ++-
 5 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4031fbd3/query_optimizer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 8912414..fdc607a 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -77,6 +77,7 @@ target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
                       quickstep_queryoptimizer_QueryPlan
                       quickstep_queryoptimizer_costmodel_CostModel
                       quickstep_queryoptimizer_costmodel_SimpleCostModel
+                      quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
                       quickstep_queryoptimizer_expressions_AggregateFunction
                       quickstep_queryoptimizer_expressions_Alias
                       quickstep_queryoptimizer_expressions_AttributeReference

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4031fbd3/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index 45f5f78..c6ef241 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -55,6 +55,7 @@
 #include "query_optimizer/QueryHandle.hpp"
 #include "query_optimizer/QueryPlan.hpp"
 #include "query_optimizer/cost_model/SimpleCostModel.hpp"
+#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
 #include "query_optimizer/expressions/AggregateFunction.hpp"
 #include "query_optimizer/expressions/Alias.hpp"
 #include "query_optimizer/expressions/AttributeReference.hpp"
@@ -161,6 +162,8 @@ void ExecutionGenerator::generatePlan(const P::PhysicalPtr &physical_plan)
{
 
   cost_model_.reset(
       new cost::SimpleCostModel(top_level_physical_plan_->shared_subplans()));
+  star_schema_cost_model_.reset(
+      new cost::StarSchemaSimpleCostModel(top_level_physical_plan_->shared_subplans()));
 
   const CatalogRelation *result_relation = nullptr;
 
@@ -846,7 +849,8 @@ void ExecutionGenerator::convertHashJoin(const P::HashJoinPtr &physical_plan)
{
                                            referenced_stored_probe_relation,
                                            std::move(build_original_attribute_ids),
                                            std::move(probe_original_attribute_ids),
-                                           join_hash_table_index);
+                                           join_hash_table_index,
+                                           star_schema_cost_model_->estimateCardinality(build_physical));
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4031fbd3/query_optimizer/ExecutionGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.hpp b/query_optimizer/ExecutionGenerator.hpp
index c7fd018..3690452 100644
--- a/query_optimizer/ExecutionGenerator.hpp
+++ b/query_optimizer/ExecutionGenerator.hpp
@@ -37,7 +37,6 @@
 #include "query_optimizer/QueryHandle.hpp"
 #include "query_optimizer/QueryPlan.hpp"
 #include "query_optimizer/cost_model/CostModel.hpp"
-#include "query_optimizer/cost_model/SimpleCostModel.hpp"
 #include "query_optimizer/expressions/ExprId.hpp"
 #include "query_optimizer/expressions/NamedExpression.hpp"
 #include "query_optimizer/expressions/Predicate.hpp"
@@ -415,6 +414,7 @@ class ExecutionGenerator {
    * @brief The cost model to use for creating the execution plan.
    */
   std::unique_ptr<cost::CostModel> cost_model_;
+  std::unique_ptr<cost::CostModel> star_schema_cost_model_;
 
   physical::TopLevelPlanPtr top_level_physical_plan_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4031fbd3/query_optimizer/ExecutionHeuristics.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionHeuristics.hpp b/query_optimizer/ExecutionHeuristics.hpp
index c43d591..2106a1b 100644
--- a/query_optimizer/ExecutionHeuristics.hpp
+++ b/query_optimizer/ExecutionHeuristics.hpp
@@ -67,14 +67,16 @@ class ExecutionHeuristics {
                  const CatalogRelation *referenced_stored_probe_relation,
                  std::vector<attribute_id> &&build_attributes,
                  std::vector<attribute_id> &&probe_attributes,
-                 const QueryContext::join_hash_table_id join_hash_table_id)
+                 const QueryContext::join_hash_table_id join_hash_table_id,
+                 const std::size_t estimated_build_relation_cardinality)
         : build_operator_index_(build_operator_index),
           join_operator_index_(join_operator_index),
           referenced_stored_build_relation_(referenced_stored_build_relation),
           referenced_stored_probe_relation_(referenced_stored_probe_relation),
           build_attributes_(std::move(build_attributes)),
           probe_attributes_(std::move(probe_attributes)),
-          join_hash_table_id_(join_hash_table_id) {
+          join_hash_table_id_(join_hash_table_id),
+          estimated_build_relation_cardinality_(estimated_build_relation_cardinality) {
     }
 
     const QueryPlan::DAGNodeIndex build_operator_index_;
@@ -84,6 +86,7 @@ class ExecutionHeuristics {
     const std::vector<attribute_id> build_attributes_;
     const std::vector<attribute_id> probe_attributes_;
     const QueryContext::join_hash_table_id join_hash_table_id_;
+    const std::size_t estimated_build_relation_cardinality_;
   };
 
 
@@ -111,14 +114,16 @@ class ExecutionHeuristics {
                               const CatalogRelation *referenced_stored_probe_relation,
                               std::vector<attribute_id> &&build_attributes,
                               std::vector<attribute_id> &&probe_attributes,
-                              const QueryContext::join_hash_table_id join_hash_table_id)
{
+                              const QueryContext::join_hash_table_id join_hash_table_id,
+                              const std::size_t estimated_build_relation_cardinality) {
     hash_joins_.push_back(HashJoinInfo(build_operator_index,
                                        join_operator_index,
                                        referenced_stored_build_relation,
                                        referenced_stored_probe_relation,
                                        std::move(build_attributes),
                                        std::move(probe_attributes),
-                                       join_hash_table_id));
+                                       join_hash_table_id,
+                                       estimated_build_relation_cardinality));
   }
 
   /**
@@ -141,8 +146,13 @@ class ExecutionHeuristics {
   void setBloomFilterProperties(serialization::BloomFilter *bloom_filter_proto,
                                 const CatalogRelation *relation);
 
+  std::size_t estimated_build_relation_cardinality() const {
+    return estimated_build_relation_cardinality_;
+  }
+
  private:
   std::vector<HashJoinInfo> hash_joins_;
+  std::size_t estimated_build_relation_cardinality_;
 
   DISALLOW_COPY_AND_ASSIGN(ExecutionHeuristics);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4031fbd3/query_optimizer/tests/ExecutionHeuristics_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/ExecutionHeuristics_unittest.cpp b/query_optimizer/tests/ExecutionHeuristics_unittest.cpp
index 815c13e..ac0adea 100644
--- a/query_optimizer/tests/ExecutionHeuristics_unittest.cpp
+++ b/query_optimizer/tests/ExecutionHeuristics_unittest.cpp
@@ -70,7 +70,8 @@ class ExecutionHeuristicsTest : public ::testing::Test {
                                           probe_relation,
                                           std::move(build_attribute_ids),
                                           std::move(probe_attribute_ids),
-                                          join_hash_table_id);
+                                          join_hash_table_id,
+                                          build_relation->estimateTupleCardinality());
   }
 
   QueryPlan::DAGNodeIndex createDummyBuildHashOperator(QueryPlan *query_plan,


Mime
View raw message