quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shix...@apache.org
Subject incubator-quickstep git commit: Addressed comment issues
Date Tue, 28 Jun 2016 22:18:28 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/SQL-window-aggregation ef6ad9163 -> 823edb661


Addressed comment issues


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

Branch: refs/heads/SQL-window-aggregation
Commit: 823edb661155b878f2d7f9863146d252c392d398
Parents: ef6ad91
Author: shixuan-fan <shixuan@apache.org>
Authored: Tue Jun 28 22:18:14 2016 +0000
Committer: shixuan-fan <shixuan@apache.org>
Committed: Tue Jun 28 22:18:14 2016 +0000

----------------------------------------------------------------------
 query_optimizer/ExecutionGenerator.cpp       | 21 +++++++++++++++------
 query_optimizer/physical/WindowAggregate.hpp |  6 +++---
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/823edb66/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index ae3e23a..9c427ae 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -1579,12 +1579,21 @@ void ExecutionGenerator::convertSort(const P::SortPtr &physical_sort)
{
   merged_runs_destination_proto->set_relational_op_index(merge_run_operator_index);
   sorted_output_destination_proto->set_relational_op_index(merge_run_operator_index);
 
-  // REVIEW(Shixuan): There might be an issue with the original code: if a throw
-  // happens before the plan is executed, merged_runs_relation will not be dropped
-  // by dropAllTemporaryRelations() if not added to temporary_relation_info_vec,
-  // which might cause "RelationNameCollision".
-  temporary_relation_info_vec_.emplace_back(merge_run_operator_index,
-                                            merged_runs_relation);
+  // Do not add merged_runs_relation into 'temporary_relation_info_vec_'
+  // and create the DropTableOperator for it at the end. Instead, add the drop
+  // operator right here, because the relation won't be used by any other operator.
+  const QueryPlan::DAGNodeIndex drop_merged_runs_index =
+      execution_plan_->addRelationalOperator(
+          new DropTableOperator(
+              query_handle_->query_id(),
+              *merged_runs_relation,
+              optimizer_context_->catalog_database(),
+              false /* only_drop_blocks */));
+  execution_plan_->addDirectDependency(
+      drop_merged_runs_index,
+      merge_run_operator_index,
+      true /* is_pipeline_breaker */);
+
   temporary_relation_info_vec_.emplace_back(merge_run_operator_index,
                                             sorted_relation);
   physical_to_output_relation_map_.emplace(

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/823edb66/query_optimizer/physical/WindowAggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/WindowAggregate.hpp b/query_optimizer/physical/WindowAggregate.hpp
index 2c539f8..297c7e9 100644
--- a/query_optimizer/physical/WindowAggregate.hpp
+++ b/query_optimizer/physical/WindowAggregate.hpp
@@ -94,7 +94,7 @@ class WindowAggregate : public Physical {
    * @return An immutable WindowAggregate node.
    */
   static WindowAggregatePtr Create(
-      PhysicalPtr input,
+      const PhysicalPtr input,
       const expressions::AliasPtr &window_aggregate_expression) {
     return WindowAggregatePtr(new WindowAggregate(input,
                                                   window_aggregate_expression));
@@ -111,14 +111,14 @@ class WindowAggregate : public Physical {
 
  private:
   WindowAggregate(
-      PhysicalPtr input,
+      const PhysicalPtr input,
       const expressions::AliasPtr &window_aggregate_expression)
       : input_(input),
         window_aggregate_expression_(window_aggregate_expression) {
     addChild(input_);
   }
 
-  PhysicalPtr input_;
+  const PhysicalPtr input_;
   const expressions::AliasPtr window_aggregate_expression_;
 
   DISALLOW_COPY_AND_ASSIGN(WindowAggregate);


Mime
View raw message