quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject incubator-quickstep git commit: Added Physical PartitionSchemeHeader in Physical Aggregate.
Date Tue, 11 Jul 2017 15:44:34 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master d9ce64308 -> b7a70951a


Added Physical PartitionSchemeHeader in Physical Aggregate.


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

Branch: refs/heads/master
Commit: b7a70951ab000c06190d0ab6c366decfc7c1e000
Parents: d9ce643
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Tue Jul 11 10:25:50 2017 -0500
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Tue Jul 11 10:40:00 2017 -0500

----------------------------------------------------------------------
 query_optimizer/physical/Aggregate.cpp  |  7 ++++++
 query_optimizer/physical/Aggregate.hpp  | 34 ++++++++++++++++++++--------
 query_optimizer/physical/CMakeLists.txt |  1 +
 3 files changed, 32 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b7a70951/query_optimizer/physical/Aggregate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Aggregate.cpp b/query_optimizer/physical/Aggregate.cpp
index 35476af..f249e95 100644
--- a/query_optimizer/physical/Aggregate.cpp
+++ b/query_optimizer/physical/Aggregate.cpp
@@ -27,6 +27,8 @@
 #include "query_optimizer/expressions/ExpressionUtil.hpp"
 #include "query_optimizer/expressions/NamedExpression.hpp"
 #include "query_optimizer/expressions/Predicate.hpp"
+#include "query_optimizer/physical/PartitionSchemeHeader.hpp"
+#include "query_optimizer/physical/Physical.hpp"
 #include "utility/Cast.hpp"
 
 namespace quickstep {
@@ -94,6 +96,11 @@ void Aggregate::getFieldStringItems(
     std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
     std::vector<std::string> *container_child_field_names,
     std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields)
const {
+  if (partition_scheme_header_) {
+    inline_field_names->push_back("output_partition_scheme_header");
+    inline_field_values->push_back(partition_scheme_header_->toString());
+  }
+
   non_container_child_field_names->push_back("input");
   non_container_child_fields->push_back(input_);
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b7a70951/query_optimizer/physical/Aggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Aggregate.hpp b/query_optimizer/physical/Aggregate.hpp
index de36cc3..c19a951 100644
--- a/query_optimizer/physical/Aggregate.hpp
+++ b/query_optimizer/physical/Aggregate.hpp
@@ -47,6 +47,8 @@ namespace physical {
 class Aggregate;
 typedef std::shared_ptr<const Aggregate> AggregatePtr;
 
+struct PartitionSchemeHeader;
+
 /**
  * @brief Aggregate operator that computes aggregate expressions for each combination
  *        of the values of grouping expressions.
@@ -86,13 +88,20 @@ class Aggregate : public Physical {
   PhysicalPtr copyWithNewChildren(
       const std::vector<PhysicalPtr> &new_children) const override {
     DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], grouping_expressions_, aggregate_expressions_, filter_predicate_);
+    return Create(new_children[0], grouping_expressions_, aggregate_expressions_, filter_predicate_,
+                  cloneOutputPartitionSchemeHeader());
   }
 
   std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
 
   std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
 
+  PhysicalPtr copyWithNewOutputPartitionSchemeHeader(
+      PartitionSchemeHeader *partition_scheme_header) const override {
+    return Create(input_, grouping_expressions_, aggregate_expressions_, filter_predicate_,
+                  partition_scheme_header);
+  }
+
   bool maybeCopyWithPrunedExpressions(
       const expressions::UnorderedNamedExpressionSet &referenced_expressions,
       PhysicalPtr *output) const override {
@@ -107,15 +116,18 @@ class Aggregate : public Physical {
    * @param aggregate_expressions The aggregate expressions.
    * @param grouping_expressions The grouping expressions.
    * @param filter_predicate The filtering predicate applied before aggregation. Can be NULL.
+   * @param partition_scheme_header The optional output partition scheme header.
+   *
    * @return An immutable Aggregate node.
    */
   static AggregatePtr Create(
       PhysicalPtr input,
       const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
       const std::vector<expressions::AliasPtr> &aggregate_expressions,
-      const expressions::PredicatePtr &filter_predicate) {
+      const expressions::PredicatePtr &filter_predicate,
+      PartitionSchemeHeader *partition_scheme_header = nullptr) {
     return AggregatePtr(
-        new Aggregate(input, grouping_expressions, aggregate_expressions, filter_predicate));
+        new Aggregate(input, grouping_expressions, aggregate_expressions, filter_predicate,
partition_scheme_header));
   }
 
  protected:
@@ -129,21 +141,23 @@ class Aggregate : public Physical {
 
  private:
   Aggregate(
-      PhysicalPtr input,
+      const PhysicalPtr &input,
       const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
       const std::vector<expressions::AliasPtr> &aggregate_expressions,
-      const expressions::PredicatePtr &filter_predicate)
-      : input_(input),
+      const expressions::PredicatePtr &filter_predicate,
+      PartitionSchemeHeader *partition_scheme_header)
+      : Physical(partition_scheme_header),
+        input_(input),
         grouping_expressions_(grouping_expressions),
         aggregate_expressions_(aggregate_expressions),
         filter_predicate_(filter_predicate) {
     addChild(input_);
   }
 
-  PhysicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
-  std::vector<expressions::AliasPtr> aggregate_expressions_;
-  expressions::PredicatePtr filter_predicate_;
+  const PhysicalPtr input_;
+  const std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
+  const std::vector<expressions::AliasPtr> aggregate_expressions_;
+  const expressions::PredicatePtr filter_predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(Aggregate);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b7a70951/query_optimizer/physical/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CMakeLists.txt b/query_optimizer/physical/CMakeLists.txt
index e0b1d25..e510f6b 100644
--- a/query_optimizer/physical/CMakeLists.txt
+++ b/query_optimizer/physical/CMakeLists.txt
@@ -58,6 +58,7 @@ target_link_libraries(quickstep_queryoptimizer_physical_Aggregate
                       quickstep_queryoptimizer_expressions_ExpressionUtil
                       quickstep_queryoptimizer_expressions_NamedExpression
                       quickstep_queryoptimizer_expressions_Predicate
+                      quickstep_queryoptimizer_physical_PartitionSchemeHeader
                       quickstep_queryoptimizer_physical_Physical
                       quickstep_queryoptimizer_physical_PhysicalType
                       quickstep_utility_Cast


Mime
View raw message