[4/6] incubator-quickstep git commit: Added unit tests for the distributed version.

2016-08-23 Thread hakanmemisoglu
Added unit tests for the distributed version.


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

Branch: refs/heads/fuse-join-with-select
Commit: cdc1e053b34aff46104397405642cd9c64b7d5f1
Parents: 59f4dab
Author: Zuyu Zhang 
Authored: Sun Aug 14 00:02:20 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:33:54 2016 -0700

--
 query_optimizer/tests/CMakeLists.txt|  35 
 .../tests/DistributedExecutionGeneratorTest.cpp |  62 +++
 .../DistributedExecutionGeneratorTestRunner.cpp | 162 +++
 .../DistributedExecutionGeneratorTestRunner.hpp | 118 ++
 .../tests/execution_generator/CMakeLists.txt|  70 
 5 files changed, 447 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cdc1e053/query_optimizer/tests/CMakeLists.txt
--
diff --git a/query_optimizer/tests/CMakeLists.txt 
b/query_optimizer/tests/CMakeLists.txt
index 4969ada..597dbe0 100644
--- a/query_optimizer/tests/CMakeLists.txt
+++ b/query_optimizer/tests/CMakeLists.txt
@@ -80,6 +80,14 @@ 
target_link_libraries(quickstep_queryoptimizer_tests_TestDatabaseLoader
   quickstep_utility_Macros
   tmb)
 
+if (ENABLE_DISTRIBUTED)
+  
add_executable(quickstep_queryoptimizer_tests_DistributedExecutionGeneratorTest
+ DistributedExecutionGeneratorTest.cpp
+ DistributedExecutionGeneratorTestRunner.cpp
+ DistributedExecutionGeneratorTestRunner.hpp
+ 
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"
+ 
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
+endif(ENABLE_DISTRIBUTED)
 add_executable(quickstep_queryoptimizer_tests_ExecutionGeneratorTest
ExecutionGeneratorTest.cpp
ExecutionGeneratorTestRunner.cpp
@@ -109,6 +117,33 @@ 
add_executable(quickstep_queryoptimizer_tests_OptimizerTextTest
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"

"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
 
+if (ENABLE_DISTRIBUTED)
+  
target_link_libraries(quickstep_queryoptimizer_tests_DistributedExecutionGeneratorTest
+glog
+gtest
+quickstep_catalog_CatalogTypedefs
+quickstep_cli_DropRelation
+quickstep_cli_PrintToScreen
+quickstep_parser_ParseStatement
+quickstep_parser_SqlParserWrapper
+quickstep_queryexecution_ForemanDistributed
+quickstep_queryexecution_QueryExecutionTypedefs
+quickstep_queryexecution_QueryExecutionUtil
+quickstep_queryexecution_Shiftboss
+quickstep_queryexecution_Worker
+quickstep_queryexecution_WorkerDirectory
+quickstep_queryoptimizer_Optimizer
+quickstep_queryoptimizer_OptimizerContext
+quickstep_queryoptimizer_QueryHandle
+quickstep_queryoptimizer_tests_TestDatabaseLoader
+quickstep_utility_Macros
+quickstep_utility_MemStream
+quickstep_utility_SqlError
+quickstep_utility_TextBasedTestDriver
+tmb
+${GFLAGS_LIB_NAME}
+${LIBS})
+endif(ENABLE_DISTRIBUTED)
 target_link_libraries(quickstep_queryoptimizer_tests_ExecutionGeneratorTest
   glog
   gtest

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cdc1e053/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
--
diff --git a/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp 
b/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
new file mode 100644
index 000..af310bc
--- /dev/null
+++ b/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 

[2/6] incubator-quickstep git commit: Refactored OptimizerContext and Optimizer.

2016-08-23 Thread hakanmemisoglu
Refactored OptimizerContext and Optimizer.

  * Construct physical generator in query_optimizer once for all queries.


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

Branch: refs/heads/fuse-join-with-select
Commit: 8c811c85e64ddb9889780ad3467dfc5abbfc9f28
Parents: 8ec99ed
Author: Zuyu Zhang 
Authored: Sat Aug 13 01:49:03 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:26:38 2016 -0700

--
 cli/tests/CMakeLists.txt|  8 +---
 cli/tests/CommandExecutorTestRunner.cpp | 35 ++
 cli/tests/CommandExecutorTestRunner.hpp |  2 +
 query_optimizer/CMakeLists.txt  |  2 +-
 query_optimizer/ExecutionGenerator.cpp  | 35 +-
 query_optimizer/ExecutionGenerator.hpp  | 12 +++---
 query_optimizer/LogicalGenerator.cpp|  3 +-
 query_optimizer/LogicalGenerator.hpp|  5 ++-
 query_optimizer/Optimizer.cpp   | 12 +++---
 query_optimizer/Optimizer.hpp   | 26 +
 query_optimizer/OptimizerContext.hpp| 39 +---
 query_optimizer/QueryProcessor.cpp  |  7 ++--
 query_optimizer/QueryProcessor.hpp  |  3 ++
 query_optimizer/resolver/Resolver.cpp   |  4 +-
 query_optimizer/resolver/Resolver.hpp   |  8 +++-
 query_optimizer/tests/CMakeLists.txt| 12 +-
 .../tests/ExecutionGeneratorTestRunner.cpp  | 35 +-
 .../tests/ExecutionGeneratorTestRunner.hpp  |  3 +-
 query_optimizer/tests/OptimizerTest.cpp |  3 +-
 .../tests/OptimizerTextTestRunner.cpp   |  9 ++---
 20 files changed, 93 insertions(+), 170 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8c811c85/cli/tests/CMakeLists.txt
--
diff --git a/cli/tests/CMakeLists.txt b/cli/tests/CMakeLists.txt
index 3bceba8..99fa3a3 100644
--- a/cli/tests/CMakeLists.txt
+++ b/cli/tests/CMakeLists.txt
@@ -36,19 +36,13 @@ 
target_link_libraries(quickstep_cli_tests_CommandExecutorTest
   quickstep_parser_SqlParserWrapper
   quickstep_queryexecution_AdmitRequestMessage
   quickstep_queryexecution_ForemanSingleNode
-  quickstep_queryexecution_QueryContext
   quickstep_queryexecution_QueryExecutionTypedefs
   quickstep_queryexecution_QueryExecutionUtil
   quickstep_queryexecution_Worker
   quickstep_queryexecution_WorkerDirectory
-  quickstep_queryexecution_WorkerMessage
-  quickstep_queryoptimizer_ExecutionGenerator
-  quickstep_queryoptimizer_LogicalGenerator
+  quickstep_queryoptimizer_Optimizer
   quickstep_queryoptimizer_OptimizerContext
-  quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_QueryHandle
-  quickstep_queryoptimizer_QueryPlan
-  quickstep_queryoptimizer_physical_Physical
   quickstep_queryoptimizer_tests_TestDatabaseLoader
   quickstep_utility_Macros
   quickstep_utility_MemStream

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8c811c85/cli/tests/CommandExecutorTestRunner.cpp
--
diff --git a/cli/tests/CommandExecutorTestRunner.cpp 
b/cli/tests/CommandExecutorTestRunner.cpp
index 9c701cd..41cc9da 100644
--- a/cli/tests/CommandExecutorTestRunner.cpp
+++ b/cli/tests/CommandExecutorTestRunner.cpp
@@ -31,17 +31,10 @@
 #include "query_execution/AdmitRequestMessage.hpp"
 #include "query_execution/ForemanSingleNode.hpp"
 #include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/Worker.hpp"
-#include "query_optimizer/ExecutionGenerator.hpp"
-#include "query_optimizer/LogicalGenerator.hpp"
+#include "query_optimizer/Optimizer.hpp"
 #include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/PhysicalGenerator.hpp"
 #include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
 #include "utility/MemStream.hpp"
-#include "utility/PtrList.hpp"
 #include "utility/SqlError.hpp"
 
 #include "glog/logging.h"
@@ -53,8 +46,6 @@ namespace quickstep {
 

[5/6] incubator-quickstep git commit: Initial commit.

2016-08-23 Thread hakanmemisoglu
Initial commit.


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

Branch: refs/heads/fuse-join-with-select
Commit: 8427d06842a38c8f97bc5a0115b9e48ee97784aa
Parents: cdc1e05
Author: Hakan Memisoglu 
Authored: Tue Aug 16 16:40:27 2016 -0500
Committer: hakanmem 

Committed: Tue Aug 23 13:57:22 2016 -0500

--
 query_optimizer/CMakeLists.txt|  1 +
 query_optimizer/ExecutionGenerator.cpp|  9 ++
 query_optimizer/PhysicalGenerator.cpp |  2 ++
 query_optimizer/physical/HashJoin.cpp |  5 +++
 query_optimizer/physical/HashJoin.hpp | 18 ---
 query_optimizer/rules/CMakeLists.txt  | 11 +++
 query_optimizer/rules/FuseJoinSelect.cpp  | 43 ++
 query_optimizer/rules/FuseJoinSelect.hpp  | 33 
 relational_operators/HashJoinOperator.cpp | 13 +++-
 relational_operators/HashJoinOperator.hpp | 12 +++
 relational_operators/WorkOrder.proto  |  1 +
 storage/StorageBlock.hpp  | 10 --
 12 files changed, 151 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 56ae52f..b0bc38b 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -195,6 +195,7 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_LogicalToPhysicalMapper
   quickstep_queryoptimizer_logical_Logical
   quickstep_queryoptimizer_physical_Physical
+  quickstep_queryoptimizer_rules_FuseJoinSelect
   quickstep_queryoptimizer_rules_PruneColumns
   
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
   quickstep_queryoptimizer_rules_SwapProbeBuild

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 2e03e09..c5f3005 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -683,6 +683,14 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 
query_context_proto_->add_predicates()->CopyFrom(residual_predicate->getProto());
   }
 
+  // Convert the left filter predicate proto.
+  QueryContext::predicate_id left_filter_predicate_index = 
QueryContext::kInvalidPredicateId;
+  if (physical_plan->residual_predicate()) {
+left_filter_predicate_index = query_context_proto_->predicates_size();
+unique_ptr 
left_filter_predicate(convertPredicate(physical_plan->left_filter_predicate()));
+
query_context_proto_->add_predicates()->CopyFrom(left_filter_predicate->getProto());
+  }
+
   // Convert the project expressions proto.
   const QueryContext::scalar_group_id project_expressions_group_index =
   query_context_proto_->scalar_groups_size();
@@ -787,6 +795,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   insert_destination_index,
   join_hash_table_index,
   residual_predicate_index,
+  left_filter_predicate_index,
   project_expressions_group_index,
   is_selection_on_build.get(),
   join_type));

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 8f19702..6ad1f8c 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -26,6 +26,7 @@
 #include "query_optimizer/Validator.hpp"
 #include "query_optimizer/logical/Logical.hpp"
 #include "query_optimizer/physical/Physical.hpp"
+#include "query_optimizer/rules/FuseJoinSelect.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
 #include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
 #include "query_optimizer/rules/SwapProbeBuild.hpp"
@@ -100,6 +101,7 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   }
   rules.emplace_back(new PruneColumns());
   

[3/6] incubator-quickstep git commit: Minor fixes to the distributed query execution engine.

2016-08-23 Thread hakanmemisoglu
Minor fixes to the distributed query execution engine.


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

Branch: refs/heads/fuse-join-with-select
Commit: 59f4dab26aa31a7e2aa9dfdc60524e56060f935b
Parents: 8c811c8
Author: Zuyu Zhang 
Authored: Tue Aug 16 13:17:01 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:30:41 2016 -0700

--
 query_execution/ForemanDistributed.cpp  | 2 +-
 query_execution/ForemanDistributed.hpp  | 2 +-
 query_execution/QueryManagerDistributed.cpp | 2 +-
 query_execution/QueryManagerDistributed.hpp | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/ForemanDistributed.cpp
--
diff --git a/query_execution/ForemanDistributed.cpp 
b/query_execution/ForemanDistributed.cpp
index 29f5b9b..9c20465 100644
--- a/query_execution/ForemanDistributed.cpp
+++ b/query_execution/ForemanDistributed.cpp
@@ -279,7 +279,7 @@ void 
ForemanDistributed::printWorkOrderProfilingResults(const std::size_t query_
 }
 
 void ForemanDistributed::processShiftbossRegistrationMessage(const client_id 
shiftboss_client_id,
-  const 
std::size_t work_order_capacity) {
+ const std::size_t 
work_order_capacity) {
   S::ShiftbossRegistrationResponseMessage proto;
   proto.set_shiftboss_index(shiftboss_directory_.size());
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/ForemanDistributed.hpp
--
diff --git a/query_execution/ForemanDistributed.hpp 
b/query_execution/ForemanDistributed.hpp
index f9a326a..fc1ede5 100644
--- a/query_execution/ForemanDistributed.hpp
+++ b/query_execution/ForemanDistributed.hpp
@@ -102,7 +102,7 @@ class ForemanDistributed final : public ForemanBase {
 const serialization::WorkOrderMessage );
 
   void processShiftbossRegistrationMessage(const tmb::client_id 
shiftboss_client_id,
-const std::size_t 
work_order_capacity);
+   const std::size_t 
work_order_capacity);
 
   void processSaveQueryResultResponseMessage(const tmb::client_id cli_id,
  const relation_id 
result_relation_id);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/QueryManagerDistributed.cpp
--
diff --git a/query_execution/QueryManagerDistributed.cpp 
b/query_execution/QueryManagerDistributed.cpp
index e300ce5..7d45933 100644
--- a/query_execution/QueryManagerDistributed.cpp
+++ b/query_execution/QueryManagerDistributed.cpp
@@ -47,7 +47,7 @@ using std::unique_ptr;
 namespace quickstep {
 
 QueryManagerDistributed::QueryManagerDistributed(QueryHandle *query_handle,
- ShiftbossDirectory 
*shiftboss_directory,
+ const ShiftbossDirectory 
*shiftboss_directory,
  const tmb::client_id 
foreman_client_id,
  tmb::MessageBus *bus)
 : QueryManagerBase(query_handle),

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/QueryManagerDistributed.hpp
--
diff --git a/query_execution/QueryManagerDistributed.hpp 
b/query_execution/QueryManagerDistributed.hpp
index b448528..e609ab8 100644
--- a/query_execution/QueryManagerDistributed.hpp
+++ b/query_execution/QueryManagerDistributed.hpp
@@ -58,7 +58,7 @@ class QueryManagerDistributed final : public QueryManagerBase 
{
* @param bus The TMB used for communication.
**/
   QueryManagerDistributed(QueryHandle *query_handle,
-  ShiftbossDirectory *shiftboss_directory,
+  const ShiftbossDirectory *shiftboss_directory,
   const tmb::client_id foreman_client_id,
   tmb::MessageBus *bus);
 
@@ -105,7 +105,7 @@ class QueryManagerDistributed final : public 
QueryManagerBase {
(query_exec_state_->getNumRebuildWorkOrders(index) == 0);
   }
 
-  ShiftbossDirectory *shiftboss_directory_;
+  const 

incubator-quickstep git commit: Introduced DestroyAggregationState operator [Forced Update!]

2016-08-23 Thread hbdeshmukh
Repository: incubator-quickstep
Updated Branches:
  refs/heads/destroy-agg-state-operator 57db5d332 -> 245fa2f6e (forced update)


Introduced DestroyAggregationState operator

- Similar to the pattern with DestroyHash, this operator destroys the
  AggregationState once the Finalize aggregation operator finishes its
  execution.
- Optimizer support for DestroyAggregationState operator.


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

Branch: refs/heads/destroy-agg-state-operator
Commit: 245fa2f6e80cb3314cb5382fbc6447bcabc8a326
Parents: cdc1e05
Author: Harshad Deshmukh 
Authored: Tue Aug 23 11:00:57 2016 -0500
Committer: Harshad Deshmukh 
Committed: Tue Aug 23 11:57:16 2016 -0500

--
 query_execution/QueryContext.hpp|  13 ++-
 query_optimizer/CMakeLists.txt  |   1 +
 query_optimizer/ExecutionGenerator.cpp  |  10 ++
 relational_operators/CMakeLists.txt |  17 ++-
 .../DestroyAggregationStateOperator.cpp |  64 ++
 .../DestroyAggregationStateOperator.hpp | 116 +++
 .../FinalizeAggregationOperator.cpp |   2 +-
 .../FinalizeAggregationOperator.hpp |   3 +-
 relational_operators/WorkOrder.proto|   7 ++
 relational_operators/WorkOrderFactory.cpp   |  43 +++
 .../tests/AggregationOperator_unittest.cpp  |  25 
 11 files changed, 270 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/245fa2f6/query_execution/QueryContext.hpp
--
diff --git a/query_execution/QueryContext.hpp b/query_execution/QueryContext.hpp
index c54c7ff..6a928e8 100644
--- a/query_execution/QueryContext.hpp
+++ b/query_execution/QueryContext.hpp
@@ -184,7 +184,7 @@ class QueryContext {
   /**
* @brief Release the given AggregationOperationState.
*
-   * @param id The id of the AggregationOperationState to destroy.
+   * @param id The id of the AggregationOperationState to release.
*
* @return The AggregationOperationState, alreadly created in the 
constructor.
**/
@@ -195,6 +195,17 @@ class QueryContext {
   }
 
   /**
+   * @brief Destroy the given aggregation state.
+   *
+   * @param id The ID of the AggregationOperationState to destroy.
+   **/
+  inline void destroyAggregationState(const aggregation_state_id id) {
+DCHECK_LT(id, aggregation_states_.size());
+DCHECK(aggregation_states_[id]);
+aggregation_states_[id].reset(nullptr);
+  }
+
+  /**
* @brief Whether the given BloomFilter id is valid.
*
* @param id The BloomFilter id.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/245fa2f6/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 56ae52f..32f7885 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -118,6 +118,7 @@ 
target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
   quickstep_relationaloperators_CreateIndexOperator
   quickstep_relationaloperators_CreateTableOperator
   quickstep_relationaloperators_DeleteOperator
+  
quickstep_relationaloperators_DestroyAggregationStateOperator
   quickstep_relationaloperators_DestroyHashOperator
   quickstep_relationaloperators_DropTableOperator
   quickstep_relationaloperators_FinalizeAggregationOperator

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/245fa2f6/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 2e03e09..130134c 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -94,6 +94,7 @@
 #include "relational_operators/CreateIndexOperator.hpp"
 #include "relational_operators/CreateTableOperator.hpp"
 #include "relational_operators/DeleteOperator.hpp"
+#include "relational_operators/DestroyAggregationStateOperator.hpp"
 #include "relational_operators/DestroyHashOperator.hpp"
 #include "relational_operators/DropTableOperator.hpp"
 #include "relational_operators/FinalizeAggregationOperator.hpp"
@@ -1464,6 +1465,15 @@ void ExecutionGenerator::convertAggregate(
   

incubator-quickstep git commit: Introduced DestroyAggregationState operator

2016-08-23 Thread hbdeshmukh
Repository: incubator-quickstep
Updated Branches:
  refs/heads/destroy-agg-state-operator [created] 57db5d332


Introduced DestroyAggregationState operator

- Similar to the pattern with DestroyHash, this operator destroys the
  AggregationState once the Finalize aggregation operator finishes its
  execution.
- Optimizer support for DestroyAggregationState operator.


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

Branch: refs/heads/destroy-agg-state-operator
Commit: 57db5d33267dcf1f258d83ac72cb49e00de79962
Parents: cdc1e05
Author: Harshad Deshmukh 
Authored: Tue Aug 23 11:00:57 2016 -0500
Committer: Harshad Deshmukh 
Committed: Tue Aug 23 11:41:28 2016 -0500

--
 query_execution/QueryContext.hpp|  41 ---
 query_optimizer/CMakeLists.txt  |   1 +
 query_optimizer/ExecutionGenerator.cpp  |  10 ++
 relational_operators/CMakeLists.txt |  17 ++-
 .../DestroyAggregationStateOperator.cpp |  64 ++
 .../DestroyAggregationStateOperator.hpp | 116 +++
 .../FinalizeAggregationOperator.cpp |   2 +-
 .../FinalizeAggregationOperator.hpp |   3 +-
 relational_operators/WorkOrder.proto|  35 +++---
 relational_operators/WorkOrderFactory.cpp   |  68 +--
 .../tests/AggregationOperator_unittest.cpp  |  51 +---
 11 files changed, 321 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57db5d33/query_execution/QueryContext.hpp
--
diff --git a/query_execution/QueryContext.hpp b/query_execution/QueryContext.hpp
index c54c7ff..c179586 100644
--- a/query_execution/QueryContext.hpp
+++ b/query_execution/QueryContext.hpp
@@ -1,20 +1,20 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ *   Copyright 2011-2015 Quickstep Technologies LLC.
+ *   Copyright 2015-2016 Pivotal Software, Inc.
+ *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+ * University of Wisconsin—Madison.
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
  *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
  **/
 
 #ifndef QUICKSTEP_QUERY_EXECUTION_QUERY_CONTEXT_HPP_
@@ -184,7 +184,7 @@ class QueryContext {
   /**
* @brief Release the given AggregationOperationState.
*
-   * @param id The id of the AggregationOperationState to destroy.
+   * @param id The id of the AggregationOperationState to release.
*
* @return The AggregationOperationState, alreadly created in the 
constructor.
**/
@@ -195,6 +195,17 @@ class QueryContext {
   }
 
   /**
+   * @brief Destroy the given aggregation state.
+   *
+   * @param id The ID of the AggregationOperationState to destroy.
+   **/
+  inline void destroyAggregationState(const aggregation_state_id id) {
+DCHECK_LT(id, aggregation_states_.size());
+DCHECK(aggregation_states_[id]);
+aggregation_states_[id].reset(nullptr);
+  }
+
+  /**
* @brief Whether the given BloomFilter id is valid.
*
* @param id The BloomFilter id.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/57db5d33/query_optimizer/CMakeLists.txt
--
diff --git