Repository: incubator-quickstep
Updated Branches:
  refs/heads/lip-refactor d4be71eea -> 51f020ecc


Updates


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

Branch: refs/heads/lip-refactor
Commit: 51f020eccce9e017ef0b95125640c0f3626a31a1
Parents: d4be71e
Author: Jianqiao Zhu <jianq...@cs.wisc.edu>
Authored: Tue Sep 20 17:50:52 2016 -0500
Committer: Jianqiao Zhu <jianq...@cs.wisc.edu>
Committed: Tue Sep 20 17:50:52 2016 -0500

----------------------------------------------------------------------
 query_optimizer/CMakeLists.txt                 |  6 ++-
 query_optimizer/LIPFilterGenerator.cpp         | 56 +++++++++++++++++++--
 query_optimizer/LIPFilterGenerator.hpp         |  7 ++-
 utility/lip_filter/CMakeLists.txt              |  6 +--
 utility/lip_filter/LIPFilter.proto             | 10 ++--
 utility/lip_filter/LIPFilterAdaptiveProber.hpp |  2 +-
 utility/lip_filter/LIPFilterBuilder.hpp        |  2 +-
 utility/lip_filter/LIPFilterDeploymentInfo.hpp |  3 +-
 8 files changed, 73 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/query_optimizer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 0cdfe34..4013e3e 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -156,7 +156,7 @@ endif()
 target_link_libraries(quickstep_queryoptimizer_LIPFilterGenerator
                       glog
                       quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogTypeDefs
+                      quickstep_catalog_CatalogTypedefs
                       quickstep_queryexecution_QueryContext
                       quickstep_queryexecution_QueryContext_proto
                       quickstep_queryoptimizer_QueryPlan
@@ -164,7 +164,9 @@ 
target_link_libraries(quickstep_queryoptimizer_LIPFilterGenerator
                       quickstep_queryoptimizer_physical_HashJoin
                       quickstep_queryoptimizer_physical_LIPFilterConfiguration
                       quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_Selection)
+                      quickstep_queryoptimizer_physical_Selection
+                      quickstep_utility_lipfilter_LIPFilter
+                      quickstep_utility_lipfilter_LIPFilter_proto)
 target_link_libraries(quickstep_queryoptimizer_LogicalGenerator
                       glog
                       quickstep_parser_ParseStatement

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/query_optimizer/LIPFilterGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LIPFilterGenerator.cpp 
b/query_optimizer/LIPFilterGenerator.cpp
index 823bd69..abde004 100644
--- a/query_optimizer/LIPFilterGenerator.cpp
+++ b/query_optimizer/LIPFilterGenerator.cpp
@@ -19,8 +19,16 @@
 
 #include "query_optimizer/LIPFilterGenerator.hpp"
 
+#include <map>
+#include <utility>
+
 #include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogTypeDefs.hpp"
+#include "catalog/CatalogTypedefs.hpp"
+#include "query_execution/QueryContext.pb.h"
+#include "utility/lip_filter/LIPFilter.hpp"
+#include "utility/lip_filter/LIPFilter.pb.h"
+
+#include "glog/logging.h"
 
 namespace quickstep {
 namespace optimizer {
@@ -37,7 +45,7 @@ void LIPFilterGenerator::registerAttributeMap(
     auto &map_entry = attribute_map_[node];
     for (const auto &info : build_it->second) {
       E::ExprId attr_id = info.build_attribute->id();
-      map_entry.emplace(attr_id, 
attribute_substitution_map.at(attr_id)->getID());
+      map_entry.emplace(attr_id, attribute_substitution_map.at(attr_id));
     }
   }
   const auto &probe_infos = lip_filter_configuration_->getProbeInfo();
@@ -46,7 +54,49 @@ void LIPFilterGenerator::registerAttributeMap(
     auto &map_entry = attribute_map_[node];
     for (const auto &info : probe_it->second) {
       E::ExprId attr_id = info.probe_attribute->id();
-      map_entry.emplace(attr_id, 
attribute_substitution_map.at(attr_id)->getID());
+      map_entry.emplace(attr_id, attribute_substitution_map.at(attr_id));
+    }
+  }
+}
+
+void LIPFilterGenerator::deployLIPFilters(QueryPlan *execution_plan,
+                                          serialization::QueryContext 
*query_context_proto) const {
+  std::map<std::pair<E::ExprId, P::PhysicalPtr>,
+           std::pair<QueryContext::lip_filter_id, QueryPlan::DAGNodeIndex>> 
lip_filter_builder_map;
+  for (const auto &builder : lip_filter_configuration_->getBuildInfo()) {
+    const P::PhysicalPtr &builder_node = builder.first;
+    const auto &builder_attribute_map = attribute_map_.at(builder_node);
+    for (const auto &info : builder.second) {
+      const QueryContext::lip_filter_id lip_filter_id = 
query_context_proto->lip_filters_size();
+      serialization::LIPFilter *lip_filter_proto = 
query_context_proto->add_lip_filters();
+
+      switch (info.filter_type) {
+        case LIPFilterType::kSingleIdentityHashFilter:
+          lip_filter_proto->set_lip_filter_type(
+              serialization::LIPFilterType::SINGLE_IDENTITY_HASH_FILTER);
+          lip_filter_proto->SetExtension(
+              serialization::SingleIdentityHashFilter::num_bits, 
info.filter_size);
+          break;
+        default:
+          LOG(FATAL) << "Unsupported LIPFilter type";
+          break;
+      }
+
+      lip_filter_builder_map.emplace(
+          std::make_pair(info.build_attribute->id(), builder_node),
+          std::make_pair(lip_filter_id, 
builder_op_index_map_.at(builder_node)));
+
+      auto *lip_filter_deployment_info_proto =
+          query_context_proto->add_lip_filter_deployment_infos();
+      
lip_filter_deployment_info_proto->set_action_type(serialization::LIPFilterActionType::BUILD);
+      lip_filter_deployment_info_proto->set_lip_filter_id(lip_filter_id);
+
+      const CatalogAttribute *target_attr = 
builder_attribute_map.at(info.build_attribute->id());
+      lip_filter_deployment_info_proto->set_attribute_id(target_attr->getID());
+      
lip_filter_deployment_info_proto->mutable_attribute_type()->CopyFrom(target_attr->getProto());
+
+      std::cerr << "Build " << info.build_attribute->toString()
+                << " @" << builder_node << "\n";
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/query_optimizer/LIPFilterGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LIPFilterGenerator.hpp 
b/query_optimizer/LIPFilterGenerator.hpp
index 09f5ac5..5b74757 100644
--- a/query_optimizer/LIPFilterGenerator.hpp
+++ b/query_optimizer/LIPFilterGenerator.hpp
@@ -23,7 +23,7 @@
 #include <map>
 #include <unordered_map>
 
-#include "catalog/CatalogTypeDefs.hpp"
+#include "catalog/CatalogTypedefs.hpp"
 #include "query_execution/QueryContext.hpp"
 #include "query_execution/QueryContext.pb.h"
 #include "query_optimizer/QueryPlan.hpp"
@@ -72,6 +72,9 @@ class LIPFilterGenerator {
     selection_infos_.emplace_back(selection, select_operator_index);
   }
 
+  void deployLIPFilters(QueryPlan *execution_plan,
+                        serialization::QueryContext *query_context_proto) 
const;
+
  private:
   struct AggregateInfo {
     AggregateInfo(const physical::AggregatePtr &aggregate_in,
@@ -110,7 +113,7 @@ class LIPFilterGenerator {
   };
 
   const physical::LIPFilterConfigurationPtr lip_filter_configuration_;
-  std::map<physical::PhysicalPtr, std::map<expressions::ExprId, attribute_id>> 
attribute_map_;
+  std::map<physical::PhysicalPtr, std::map<expressions::ExprId, const 
CatalogAttribute *>> attribute_map_;
   std::map<physical::PhysicalPtr, QueryPlan::DAGNodeIndex> 
builder_op_index_map_;
   std::vector<AggregateInfo> aggregate_infos_;
   std::vector<HashJoinInfo> hash_join_infos_;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/utility/lip_filter/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utility/lip_filter/CMakeLists.txt 
b/utility/lip_filter/CMakeLists.txt
index 87a58e2..df6a5ec 100644
--- a/utility/lip_filter/CMakeLists.txt
+++ b/utility/lip_filter/CMakeLists.txt
@@ -32,13 +32,13 @@ add_library(quickstep_utility_lipfilter_LIPFilter_proto
 target_link_libraries(quickstep_utility_lipfilter_LIPFilter
                       quickstep_utility_Macros)
 target_link_libraries(quickstep_utility_lipfilter_LIPFilterAdaptiveProber
-                      quickstep_catalog_CatalogTypeDefs
+                      quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros)
 target_link_libraries(quickstep_utility_lipfilter_LIPFilterBuilder
-                      quickstep_catalog_CatalogTypeDefs
+                      quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros)
 target_link_libraries(quickstep_utility_lipfilter_LIPFilterDeploymentInfo
-                      quickstep_catalog_CatalogTypeDefs
+                      quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros
                       quickstep_utility_lipfilter_LIPFilter)
 target_link_libraries(quickstep_utility_lipfilter_LIPFilterFactory

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/utility/lip_filter/LIPFilter.proto
----------------------------------------------------------------------
diff --git a/utility/lip_filter/LIPFilter.proto 
b/utility/lip_filter/LIPFilter.proto
index 2dd095d..897a86e 100644
--- a/utility/lip_filter/LIPFilter.proto
+++ b/utility/lip_filter/LIPFilter.proto
@@ -40,12 +40,12 @@ message SingleIdentityHashFilter {
   }
 }
 
-message LIPFilterDeploymentInfo {
-  enum LIPFilterActionType {
-    BUILD = 1;
-    PROBE = 2;
-  }
+enum LIPFilterActionType {
+  BUILD = 1;
+  PROBE = 2;
+}
 
+message LIPFilterDeploymentInfo {
   required LIPFilterActionType action_type = 1;
   required uint32 lip_filter_id = 2;
   required int32 attribute_id = 3;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/utility/lip_filter/LIPFilterAdaptiveProber.hpp
----------------------------------------------------------------------
diff --git a/utility/lip_filter/LIPFilterAdaptiveProber.hpp 
b/utility/lip_filter/LIPFilterAdaptiveProber.hpp
index cf9fa34..6005690 100644
--- a/utility/lip_filter/LIPFilterAdaptiveProber.hpp
+++ b/utility/lip_filter/LIPFilterAdaptiveProber.hpp
@@ -22,7 +22,7 @@
 
 #include <vector>
 
-#include "catalog/CatalogTypeDefs.hpp"
+#include "catalog/CatalogTypedefs.hpp"
 #include "utility/Macros.hpp"
 
 namespace quickstep {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/utility/lip_filter/LIPFilterBuilder.hpp
----------------------------------------------------------------------
diff --git a/utility/lip_filter/LIPFilterBuilder.hpp 
b/utility/lip_filter/LIPFilterBuilder.hpp
index 34e56b1..07b26da 100644
--- a/utility/lip_filter/LIPFilterBuilder.hpp
+++ b/utility/lip_filter/LIPFilterBuilder.hpp
@@ -24,7 +24,7 @@
 
 #include "utility/Macros.hpp"
 
-#include "catalog/CatalogTypeDefs.hpp"
+#include "catalog/CatalogTypedefs.hpp"
 
 namespace quickstep {
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/51f020ec/utility/lip_filter/LIPFilterDeploymentInfo.hpp
----------------------------------------------------------------------
diff --git a/utility/lip_filter/LIPFilterDeploymentInfo.hpp 
b/utility/lip_filter/LIPFilterDeploymentInfo.hpp
index aa5371a..db75021 100644
--- a/utility/lip_filter/LIPFilterDeploymentInfo.hpp
+++ b/utility/lip_filter/LIPFilterDeploymentInfo.hpp
@@ -22,11 +22,10 @@
 
 #include <vector>
 
+#include "catalog/CatalogTypedefs.hpp"
 #include "utility/Macros.hpp"
 #include "utility/lip_filter/LIPFilter.hpp"
 
-#include "catalog/CatalogTypeDefs.hpp"
-
 namespace quickstep {
 
 /** \addtogroup Utility

Reply via email to