quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [14/15] incubator-quickstep git commit: Minor updates
Date Mon, 07 Nov 2016 21:34:25 GMT
Minor 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/49ef7284
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/49ef7284
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/49ef7284

Branch: refs/heads/collision-free-agg
Commit: 49ef7284a3adf335e482a799048ccbe97237db02
Parents: c5b3eec
Author: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Authored: Mon Nov 7 15:30:37 2016 -0600
Committer: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Committed: Mon Nov 7 15:32:34 2016 -0600

----------------------------------------------------------------------
 query_optimizer/rules/ReduceGroupByAttributes.cpp | 11 ++++++-----
 query_optimizer/rules/ReduceGroupByAttributes.hpp |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49ef7284/query_optimizer/rules/ReduceGroupByAttributes.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/ReduceGroupByAttributes.cpp b/query_optimizer/rules/ReduceGroupByAttributes.cpp
index effe5a8..d7a93bb 100644
--- a/query_optimizer/rules/ReduceGroupByAttributes.cpp
+++ b/query_optimizer/rules/ReduceGroupByAttributes.cpp
@@ -50,13 +50,11 @@ namespace optimizer {
 namespace E = ::quickstep::optimizer::expressions;
 namespace P = ::quickstep::optimizer::physical;
 
-
 P::PhysicalPtr ReduceGroupByAttributes::apply(const P::PhysicalPtr &input) {
   DCHECK(input->getPhysicalType() == P::PhysicalType::kTopLevelPlan);
   cost_model_.reset(new cost::StarSchemaSimpleCostModel(
       std::static_pointer_cast<const P::TopLevelPlan>(input)->shared_subplans()));
 
-  // Check
   P::PhysicalPtr output = applyInternal(input);
   if (output != input) {
     output = PruneColumns().apply(output);
@@ -112,13 +110,16 @@ P::PhysicalPtr ReduceGroupByAttributes::applyToNode(const P::PhysicalPtr
&input)
     }
 
     std::vector<AttributeInfo> attr_infos;
-    std::vector<const AttributeInfo *> attr_info_refs;
     for (const auto &attr : attributes) {
       attr_infos.emplace_back(attr,
                               cost_model_->impliesUniqueAttributes(table, {attr}),
                               !attr->getValueType().isVariableLength(),
                               attr->getValueType().maximumByteLength());
-      attr_info_refs.emplace_back(&attr_infos.back());
+    }
+
+    std::vector<const AttributeInfo *> attr_info_refs;
+    for (const auto &info : attr_infos) {
+      attr_info_refs.emplace_back(&info);
     }
     std::sort(attr_info_refs.begin(),
               attr_info_refs.end(),
@@ -130,7 +131,7 @@ P::PhysicalPtr ReduceGroupByAttributes::applyToNode(const P::PhysicalPtr
&input)
       continue;
     }
 
-    const E::AttributeReferencePtr &key_attribute = best_candidate.attribute;
+    const E::AttributeReferencePtr key_attribute = best_candidate.attribute;
     hoisted_tables.emplace_back(table, key_attribute);
 
     for (const auto &attr : attributes) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49ef7284/query_optimizer/rules/ReduceGroupByAttributes.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/ReduceGroupByAttributes.hpp b/query_optimizer/rules/ReduceGroupByAttributes.hpp
index 9402ef0..081c7b6 100644
--- a/query_optimizer/rules/ReduceGroupByAttributes.hpp
+++ b/query_optimizer/rules/ReduceGroupByAttributes.hpp
@@ -51,7 +51,7 @@ class ReduceGroupByAttributes : public Rule<physical::Physical> {
 
  private:
   struct AttributeInfo {
-    AttributeInfo(const expressions::AttributeReferencePtr attribute_in,
+    AttributeInfo(const expressions::AttributeReferencePtr &attribute_in,
                   const bool is_unique_in,
                   const bool is_fixed_length_in,
                   const std::size_t maximum_size_in)


Mime
View raw message