quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hakanmemiso...@apache.org
Subject [01/11] incubator-quickstep git commit: Deserialization logic is implemented for relational operators.
Date Tue, 02 May 2017 05:13:13 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend 46e411354 -> 79f0e7809


Deserialization logic is implemented for relational operators.


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

Branch: refs/heads/frontend-backend
Commit: 79f0e7809c38b67b0b22f504d297b2806344e320
Parents: 1d94edf
Author: Hakan Memisoglu <hakanmemisoglu@apache.org>
Authored: Tue May 2 00:12:01 2017 -0500
Committer: Hakan Memisoglu <hakanmemisoglu@apache.org>
Committed: Tue May 2 00:12:54 2017 -0500

----------------------------------------------------------------------
 query_execution/ExecutionDeserializer.cpp | 427 ++++++++++++++++++++++++-
 query_execution/ExecutionDeserializer.hpp |   9 +-
 query_optimizer/ExecutionSerializer.cpp   |   5 +-
 relational_operators/DeleteOperator.hpp   |   4 +
 relational_operators/Operator.proto       |   7 +-
 utility/DAG.hpp                           |   2 +-
 6 files changed, 430 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/query_execution/ExecutionDeserializer.cpp
----------------------------------------------------------------------
diff --git a/query_execution/ExecutionDeserializer.cpp b/query_execution/ExecutionDeserializer.cpp
index d1e96fa..d4af317 100644
--- a/query_execution/ExecutionDeserializer.cpp
+++ b/query_execution/ExecutionDeserializer.cpp
@@ -17,6 +17,8 @@
  * under the License.
  **/
 
+#include <vector>
+
 #include "query_execution/ExecutionDeserializer.hpp"
 
 namespace quickstep {
@@ -85,103 +87,496 @@ void ExecutionDeserializer::deserializeInternal(const S::Vertex &vertex)
{
 void ExecutionDeserializer::deserializeAggregation(const S::AggregationOperator &aggregation_operator)
{
   const std::size_t query_id = 1;
   const relation_id relation = aggregation_operator.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
   const bool is_relation_stored = aggregation_operator.relation_is_stored();
   QueryContext::aggregation_state_id aggregation_state_index = aggregation_operator.aggr_state_index();
 
-  std::unique_ptr<AggregationOperator> aggregation = std::make_unique(new AggregationOperator())
-  query_plan.addRelationalOperator();
+
+  const AggregationOperator* aggregation
+      = new AggregationOperator(query_id,
+                                *catalog,
+                                is_relation_stored,
+                                aggregation_state_index);
+  query_plan.addRelationalOperator(aggregation);
 }
 
 void ExecutionDeserializer::deserializeBuildAggregationExistenceMap(const S::BuildAggregationExistenceMapOperator
&op) {
-
+  const std::size_t query_id = 1;
+  const relation_id relation = op.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
+  const attribute_id build_attribute = op.attribute_id();
+  const bool is_relation_stored = op.relation_is_stored();
+  const QueryContext::aggregation_state_id aggregation_state_index = op.aggr_state_index();
+
+  const BuildAggregationExistenceMapOperator* build_aggregation_existence_map
+      = new BuildAggregationExistenceMapOperator(query_id,
+                                                 *catalog,
+                                                 build_attribute,
+                                                 is_relation_stored,
+                                                 aggregation_state_index);
+  query_plan.addRelationalOperator(build_aggregation_existence_map);
 }
 
 void ExecutionDeserializer::deserializeBuildHash(const S::BuildHashOperator &build_hash_operator)
{
-
+  const std::size_t query_id = 1;
+  const relation_id relation = build_hash_operator.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
+  const is_input_relation_stored = build_hash_operator.relation_is_stored();
+  std::vector<attribute_id> join_key_attributes;
+  join_key_attributes.reserve(build_hash_operator.join_key_attributes_size());
+  for (std::size_t i = 0; i < build_hash_operator.join_key_attributes_size(); ++i) {
+    join_key_attributes.push_back(build_hash_operator.join_key_attributes(i));
+  }
+  const bool any_join_key_attributes_nullable = build_hash_operator.any_join_key_nullable();
+  const std::size_t num_partitions = build_hash_operator.num_partitions();
+  const QueryContext::join_hash_table_id join_hash_table_index = build_hash_operator.hash_table_index();
+
+  const BuildHashOperator* build_hash
+      = new BuildHashOperator(query_id,
+                              *catalog,
+                              is_input_relation_stored,
+                              join_key_attributes,
+                              any_join_key_attributes_nullable,
+                              num_partitions,
+                              join_hash_table_index);
+
+  query_plan.addRelationalOperator(build_hash);
 }
 
 void ExecutionDeserializer::deserializeBuildLIPFilter(const S::BuildLIPFilterOperator &build_lip_filter_operator)
{
-
+  const std::size_t query_id = 1;
+  const relation_id relation = build_lip_filter_operator.relation_id();
+  const CatalogRelation *catalog =  database_.getRelationById(relation);
+  const bool is_input_relation_stored = build_lip_filter_operator.relation_is_stored();
+  const QueryContext::predicate_id build_side_predicate_index
+      = build_lip_filter_operator.build_side_predicate_index();
+
+  const BuildLIPFilterOperator* build_lip_filter
+      = new BuildLIPFilterOperator(query_id,
+                                   *catalog,
+                                   build_side_predicate_index,
+                                   is_input_relation_stored);
+
+  query_plan.addRelationalOperator(build_lip_filter);
 }
 
 void ExecutionDeserializer::deserializeCreateIndex(const S::CreateIndexOperator &create_index_operator)
{
-
+  const std::size_t query_id = 1;
+  const relation_id relation = create_index_operator.relation_id();
+  CatalogRelation *catalog = database_.getRelationByIdMutable(relation);
+  const std::string index_name = create_index_operator.index_name();
+  IndexSubBlockDescription description = create_index_operator.index_description();
+
+  const CreateIndexOperator* create_index
+      = new CreateIndexOperator(query_id,
+                                catalog,
+                                index_name,
+                                std::move(description));
+
+  query_plan.addRelationalOperator(create_index);
 }
 
 void ExecutionDeserializer::deserializeCreateTable(const S::CreateTableOperator &create_table_operator)
{
+  const std::size_t query_id = 1;
+  const serialization::CatalogRelationSchema &catalog_relation = create_table_operator.relation_catalog();
+  CatalogRelation *relation = new CatalogRelation(catalog_relation);
 
+  const CreateTableOperator* create_table
+      = new CreateTableOperator(query_id,
+                                relation,
+                                &database_);
+
+  query_plan.addRelationalOperator(create_table);
 }
 
 void ExecutionDeserializer::deserializeDelete(const S::DeleteOperator &delete_operator)
{
-
+  const std::size_t query_id = 1;
+  const relation_id relation = delete_operator.relation_id();
+  const CatalogRelation *catalog_relation = database_.getRelationById(relation);
+  const bool is_relation_stored = delete_operator.relation_is_stored();
+  const QueryContext::predicate_id predicate_index = delete_operator.predicate_index();
+
+  const DeleteOperator* delete_op
+      = new DeleteOperator(query_id,
+                           *catalog_relation,
+                           predicate_index,
+                           is_relation_stored);
+
+  query_plan.addRelationalOperator(delete_op);
 }
 
-void ExecutionDeserializer::deserializeDestroyAggregationState(const S::DestroyAggregationStateOperator
&destroy_aggregation_state_operator) {
+void ExecutionDeserializer::deserializeDestroyAggregationState(
+    const S::DestroyAggregationStateOperator &destroy_aggregation_state_operator) {
+  const std::size_t query_id = 1;
+  const QueryContext::aggregation_state_id aggregation_state_index
+      = destroy_aggregation_state_operator.aggr_state_index();
+
+  const DestroyAggregationStateOperator* destroy_aggregation_state
+      = new DestroyAggregationStateOperator(query_id, aggregation_state_index);
 
+  query_plan.addRelationalOperator(destroy_aggregation_state);
 }
 
-void ExecutionDeserializer::deserializeDestroyHash(const S::DestroyHashOperator &destroy_hash_operator)
{
+void ExecutionDeserializer::deserializeDestroyHash(
+    const S::DestroyHashOperator &destroy_hash_operator) {
+  const std::size_t query_id = 1;
+  const std::size_t build_num_partitions = destroy_hash_operator.build_num_partitions();
+  const QueryContext::join_hash_table_id hash_table_index = destroy_hash_operator.hash_table_index();
+
+  const DestroyHashOperator* destroy_hash
+      = new DestroyHashOperator(query_id,
+                                build_num_partitions,
+                                hash_table_index);
 
+  query_plan.addRelationalOperator(destroy_hash);
 }
 
-void ExecutionDeserializer::deserializeDropTable(const S::DropTableOperator &drop_table_operator)
{
+void ExecutionDeserializer::deserializeDropTable(
+    const S::DropTableOperator &drop_table_operator) {
+  const std::size_t query_id = 1;
+  const relation_id relation = drop_table_operator.relation_id();
+  const CatalogRelation *catalog_relation = database_.getRelationById(relation);
+  const bool only_drop_blocks = drop_table_operator.only_drop_blocks();
 
-}
+  const DropTableOperator* drop_table
+      = new DropTableOperator(query_id,
+                              *catalog_relation,
+                              &database_,
+                              only_drop_blocks);
 
-void ExecutionDeserializer::deserializeFinalizeAggregation(const S::FinalizeAggregationOperator
&finalize_aggregation_operator) {
+  query_plan.addRelationalOperator(drop_table);
+}
 
+void ExecutionDeserializer::deserializeFinalizeAggregation(
+    const S::FinalizeAggregationOperator &finalize_aggregation_operator) {
+  const std::size_t query_id = 1;
+  const QueryContext::aggregation_state_id aggregation_state_index = finalize_aggregation_operator.aggr_state_index();
+  const QueryContext::insert_destination_id output_index = finalize_aggregation_operator.output_destination_index();
+  const relation_id output_relation = finalize_aggregation_operator.output_relation_id();
+  const CatalogRelation *output_catalog = database_.getRelationById(output_relation);
+
+  const FinalizeAggregationOperator* finalize_aggregation
+      = new FinalizeAggregationOperator(query_id,
+                                        aggregation_state_index,
+                                        *output_catalog,
+                                        output_index);
+  query_plan.addRelationalOperator(finalize_aggregation);
 }
 
-void ExecutionDeserializer::deserializeHashJoin(const S::HashJoinOperator &finalize_hash_join)
{
+void ExecutionDeserializer::deserializeHashJoin(const S::HashJoinOperator &hash_join_operator)
{
+  const std::size_t query_id = 1;
+  const relation_id build_relation = hash_join_operator.build_relation_id();
+  const relation_id probe_relation = hash_join_operator.probe_relation_id();
+  const CatalogRelation *build_catalog = database_.getRelationById(build_relation);
+  const CatalogRelation *probe_catalog = database_.getRelationById(probe_relation);
+  const bool probe_relation_is_stored = hash_join_operator.is_probe_relation_stored();
+
+  std::vector<attribute_id> join_attributes;
+  for (const auto &attribute : hash_join_operator.join_key_attributes()) {
+    join_attributes.push_back(attribute);
+  }
+  const bool any_join_key_nullable = hash_join_operator.any_join_key_attributes_nullable();
+  const std::size_t build_num_partitions = hash_join_operator.build_num_partitions();
+
+  const relation_id output_relation = hash_join_operator.output_relation_id();
+  const CatalogRelation *output_catalog = database_.getRelationById(output_relation);
+
+  const QueryContext::insert_destination_id output_destination_index
+      = hash_join_operator.output_destionation_index();
+
+  const QueryContext::join_hash_table_id hash_table_index = hash_join_operator.hash_table_index();
+  const QueryContext::predicate_id residual_predicate_index = hash_join_operator.residiual_predicate_index();
+  const QueryContext::scalar_group_id selection_index = hash_join_operator.selection_index();
+
+  std::unique_ptr<std::vector<bool>> is_selection_on_build = std::make_unique<std::vector<bool>>();
+  for (const auto &selection_on_build : hash_join_operator.is_selection_on_build()) {
+    is_selection_on_build->push_back(selection_on_build);
+  }
+
+  HashJoinOperator::JoinType join_type;
+  switch (hash_join_operator.join_type()) {
+  case serialization::HashJoinOperator_JoinType_LEFT_INNER:
+    join_type = HashJoinOperator::JoinType::kInnerJoin;
+    break;
+  case serialization::HashJoinOperator_JoinType_LEFT_SEMI:
+    join_type = HashJoinOperator::JoinType::kLeftSemiJoin;
+    break;
+  case serialization::HashJoinOperator_JoinType_LEFT_ANTI:
+    join_type = HashJoinOperator::JoinType::kLeftAntiJoin;
+    break;
+  case serialization::HashJoinOperator_JoinType_LEFT_OUTER:
+    join_type = HashJoinOperator::JoinType::kLeftOuterJoin;
+    break;
+  default:
+    join_type = HashJoinOperator::JoinType::kInnerJoin;
+  }
 
+  const HashJoinOperator *hash_join
+      = new HashJoinOperator(query_id,
+                             *build_catalog,
+                             *probe_catalog,
+                             probe_relation_is_stored,
+                             join_attributes,
+                             any_join_key_nullable,
+                             build_num_partitions,
+                             *output_catalog,
+                             output_destination_index,
+                             hash_table_index,
+                             residual_predicate_index,selection_index,
+                             is_selection_on_build.release(),
+                             join_type);
+
+  query_plan.addRelationalOperator(hash_join);
 }
 
-void ExecutionDeserializer::deserializeInitializeAggregation(const S::InitializeAggregationOperator
&initialize_aggregation_operator) {
+void ExecutionDeserializer::deserializeInitializeAggregation(
+    const S::InitializeAggregationOperator &initialize_aggregation_operator) {
+  const std::size_t query_id = 1;
+  const QueryContext::aggregation_state_id aggregation_state_index = initialize_aggregation_operator.aggr_state_index();
+  const InitializeAggregationOperator *initialize_aggregation
+      = new InitializeAggregationOperator(query_id, aggregation_state_index);
 
+  query_plan.addRelationalOperator(initialize_aggregation);
 }
 
 void ExecutionDeserializer::deserializeInsert(const S::InsertOperator &insert_operator)
{
+  const std::size_t query_id = 1;
 
+  const CatalogRelation *output_catalog = database_.getRelationById(insert_operator.output_relation_id());
+  const QueryContext::insert_destination_id output_index = insert_operator.output_destination_index();
+  const QueryContext::tuple_id tuple_index = insert_operator.tuple_index();
+
+  const InsertOperator *insert = new InsertOperator(query_id, *output_catalog, output_index,
 tuple_index);
+
+  query_plan.addRelationalOperator(insert);
 }
 
 void ExecutionDeserializer::deserializeNestedLoopsJoin(const S::NestedLoopsJoinOperator &nested_loops_join_operator)
{
+  const std::size_t query_id = 1;
 
+  const CatalogRelation *output_catalog = database_.getRelationById(nested_loops_join_operator.output_relation_id());
+  const CatalogRelation *left_catalog = database_.getRelationById(nested_loops_join_operator.left_input_relation_id());
+  const CatalogRelation *right_catalog = database_.getRelationById(nested_loops_join_operator.right_input_relation_id());
+
+  const QueryContext::insert_destination_id output_index = nested_loops_join_operator.output_destination_index();
+  const QueryContext::predicate_id join_predicate_index = nested_loops_join_operator.join_predicate_index();
+  const QueryContext::scalar_group_id selection_index = nested_loops_join_operator.selection_index();
+  const bool left_is_stored = nested_loops_join_operator.left_relation_is_stored();
+  const bool right_is_stored = nested_loops_join_operator.right_relation_is_stored();
+
+  const NestedLoopsJoinOperator *nested_loops_join
+      = new NestedLoopsJoinOperator(query_id,
+                                    *left_catalog,
+                                    *right_catalog,
+                                    *output_catalog,
+                                    output_index,
+                                    join_predicate_index,
+                                    selection_index,
+                                    left_is_stored,
+                                    right_is_stored);
+
+  query_plan.addRelationalOperator(nested_loops_join);
 }
 
 void ExecutionDeserializer::deserializeSample(const S::SampleOperator &sample_operator)
{
-
+  const std::size_t query_id = 1;
+  const CatalogRelation *input_catalog = database_.getRelationById(sample_operator.input_relation_id());
+  const CatalogRelation *output_catalog = database_.getRelationById(sample_operator.output_relation_id());
+  const QueryContext::insert_destination_id output_index = sample_operator.output_destination_index();
+  const bool is_input_stored = sample_operator.input_relation_is_stored();
+  const bool is_block_sample = sample_operator.is_block_sample();
+  const int percentage = sample_operator.percentage();
+
+  const SampleOperator *sample
+      = new SampleOperator(query_id,
+                           *input_catalog,
+                           *output_catalog,
+                           output_index,
+                           is_input_stored,
+                           is_block_sample,
+                           percentage);
+
+  query_plan.addRelationalOperator(sample);
 }
 
 void ExecutionDeserializer::deserializeSaveBlocks(const S::SaveBlocksOperator &save_blocks_operator)
{
+  const std::size_t query_id = 1;
 
+  std::unique_ptr<CatalogRelation> catalog = std::make_unique<CatalogRelation>(save_blocks_operator.relation());
+  const bool force = save_blocks_operator.force();
+
+  const SaveBlocksOperator *save_blocks = new SaveBlocksOperator(query_id, catalog.release(),
force);
+  query_plan.addRelationalOperator(save_blocks);
 }
 
 void ExecutionDeserializer::deserializeSelect(const S::SelectOperator &select_operator)
{
+  const std::size_t query_id = 1;
+  const CatalogRelation *input = database_.getRelationById(select_operator.input_relation_id());
+  const CatalogRelation *output = database_.getRelationById(select_operator.output_relation_id());
+
+  const QueryContext::insert_destination_id output_destionation_index = select_operator.output_destination_index();
+  const bool is_input_stored = select_operator.input_relation_is_stored();
+  const QueryContext::predicate_id predicate_index = select_operator.predicate_index();
+
+  const std::size_t num_partitions = select_operator.num_partitions();
+  std::vector<attribute_id> *selections = new std::vector<attribute_id>;
+  for (const auto &selection : select_operator.selection_attributes()) {
+    selections->push_back(selection);
+  }
 
+
+  const SelectOperator *select
+      = (selections->size() == 1) ? new SelectOperator(query_id,
+                                                       *input,
+                                                       *output,
+                                                       output_destionation_index,
+                                                       predicate_index,
+                                                       selections->[0],
+                                                       is_input_stored,
+                                                       num_partitions)
+                                  : new SelectOperator(query_id,
+                                                       *input,
+                                                       *output,
+                                                       output_destionation_index,
+                                                       predicate_index,
+                                                       std::move(*selections),
+                                                       is_input_stored,
+                                                       num_partitions);
+
+  query_plan.addRelationalOperator(select);
 }
 
 void ExecutionDeserializer::deserializeSortMergeRun(const S::SortMergeRunOperator &sort_merge_run_operator)
{
+  const std::size_t query_id = 1;
 
+  const CatalogRelation *input = database_.getRelationById(sort_merge_run_operator.input_relation_id());
+  const CatalogRelation *output = database_.getRelationById(sort_merge_run_operator.output_relation_id());
+
+  const QueryContext::insert_destination_id output_destination_index
+      = sort_merge_run_operator.output_destination_index();
+
+  const CatalogRelation *run = database_.getRelationById(sort_merge_run_operator.run_relation_id());
+  const QueryContext::insert_destination_id run_destination_index
+      = sort_merge_run_operator.run_block_destination_index();
+
+  const QueryContext::sort_config_id sort_config_index = sort_merge_run_operator.sort_config_index();
+  const std::uint64_t merge_factor = sort_merge_run_operator.merge_factor();
+  const std::uint64_t top_k = sort_merge_run_operator.top_k();
+  const bool input_relation_is_stored = sort_merge_run_operator.is_input_stored();
+
+  const SortMergeRunOperator *sort_merge_run
+      = new SortMergeRunOperator(query_id,
+                                 *input,
+                                 *output,
+                                 output_destination_index,
+                                 *run,
+                                 run_destination_index,
+                                 sort_config_index,
+                                 merge_factor, top_k,
+                                 input_relation_is_stored);
+
+  query_plan.addRelationalOperator(sort_merge_run);
 }
 
 void ExecutionDeserializer::deserializeSortRunGeneration(const S::SortRunGenerationOperator
&sort_run_generation_operator) {
+  const std::size_t query_id = 1;
+  const CatalogRelation *input = database_.getRelationById(sort_run_generation_operator.input_relation_id());
+  const CatalogRelation *output = database_.getRelationById(sort_run_generation_operator.output_relation_id());
+
+  const QueryContext::insert_destination_id output_destination_index
+      = sort_run_generation_operator.output_destination_index();
 
+  const QueryContext::sort_config_id sort_config_index = sort_run_generation_operator.sort_config_index();
+  const bool input_relation_is_stored = sort_run_generation_operator.is_input_stored();
+
+  const SortRunGenerationOperator *sort_run_generation
+      = new SortRunGenerationOperator(query_id,
+                                      *input,
+                                      *output,
+                                      output_destination_index,
+                                      sort_config_index,
+                                      input_relation_is_stored);
+
+  query_plan.addRelationalOperator(sort_run_generation);
 }
 
 void ExecutionDeserializer::deserializeTableGenerator(const S::TableGeneratorOperator &table_generator_operator)
{
+  const std::size_t query_id = 1;
+
+  const CatalogRelation *output = database_.getRelationById(table_generator_operator.output_relation_id());
+  const QueryContext::insert_destination_id output_destination_index
+      = table_generator_operator.output_destination_index();
+  const QueryContext::generator_function_id generator_function_index
+      = table_generator_operator.generator_function_index();
 
+  const TableGeneratorOperator *table_generator
+      = new TableGeneratorOperator(query_id,
+                                   *output,
+                                   output_destination_index,
+                                   generator_function_index);
+
+  query_plan.addRelationalOperator(table_generator);
 }
 
 void ExecutionDeserializer::deserializeTextScan(const S::TextScanOperator &text_scan_operator)
{
+  const std::size_t query_id = 1;
+
+  const std::string file_pattern = text_scan_operator.file_pattern();
+  const char field_terminator = text_scan_operator.field_terminator();
+  const bool process_escape_sequences = text_scan_operator.process_escape_sequences();
+
+  const CatalogRelation *output = database_.getRelationById(text_scan_operator.output_relation_id());
+  const QueryContext::insert_destination_id output_index = text_scan_operator.output_destination_index();
 
+  const TextScanOperator *text_scan
+      = new TextScanOperator(query_id,
+                             file_pattern,
+                             field_terminator,
+                             process_escape_sequences,
+                             *output,
+                             output_index);
+
+  query_plan.addRelationalOperator(text_scan);
 }
 
 void ExecutionDeserializer::deserializeUpdate(const S::UpdateOperator &update_operator)
{
+  const std::size_t query_id = 1;
 
+  const CatalogRelation *relation = database_.getRelationById(update_operator.relation_id());
+  const QueryContext::insert_destination_id relocation_destination_index
+      = update_operator.relocation_destionation_index();
+  const QueryContext::predicate_id predicate_index = update_operator.predicate_index();
+  const QueryContext::update_group_id update_group_index = update_operator.update_group_index();
+
+  const UpdateOperator *update = new UpdateOperator(query_id,
+                                                    *relation,
+                                                    relocation_destination_index,
+                                                    predicate_index,
+                                                    update_group_index);
+  query_plan.addRelationalOperator(update);
 }
 
-void ExecutionDeserializer::deserializeWindowAggregation(const S::WindowAggregationOperator
&window_aggregation_operator) {
+void ExecutionDeserializer::deserializeWindowAggregation(
+    const S::WindowAggregationOperator &window_aggregation_operator) {
+  const std::size_t query_id = 1;
 
+  const CatalogRelation *input_relation
+      = database_.getRelationById(window_aggregation_operator.input_relation_id());
+  const CatalogRelation *output_relation
+      = database_.getRelationById(window_aggregation_operator.output_relation_id());
+  const QueryContext::window_aggregation_state_id window_aggregation_state_index
+      = window_aggregation_operator.window_aggregation_state_index();
+  const QueryContext::insert_destination_id output_destination_index
+      = window_aggregation_operator.output_destination_index();
+
+  const WindowAggregationOperator *window_aggregation
+      = new WindowAggregationOperator(query_id,
+                                      *input_relation,
+                                      *output_relation,
+                                      window_aggregation_state_index,
+                                      output_destination_index);
+  
+  query_plan.addRelationalOperator(window_aggregation);
 }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/query_execution/ExecutionDeserializer.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ExecutionDeserializer.hpp b/query_execution/ExecutionDeserializer.hpp
index 2ba4efc..5c54703 100644
--- a/query_execution/ExecutionDeserializer.hpp
+++ b/query_execution/ExecutionDeserializer.hpp
@@ -20,6 +20,7 @@
 #ifndef QUICKSTEP_QUERY_EXECUTION_EXECUTION_DESERIALIZER_HPP
 #define QUICKSTEP_QUERY_EXECUTION_EXECUTION_DESERIALIZER_HPP
 
+#include "catalog/CatalogDatabase.hpp"
 #include "query_optimizer/QueryPlan.hpp"
 #include "relational_operators/AggregationOperator.hpp"
 #include "relational_operators/BuildAggregationExistenceMapOperator.hpp"
@@ -56,8 +57,9 @@ namespace S = ::quickstep::serialization;
 
 class ExecutionDeserializer {
  public:
-  ExecutionDeserializer(const S::QueryPlan &query_plan)
-    : query_plan_proto_(query_plan) {
+  ExecutionDeserializer(const S::QueryPlan &query_plan, CatalogDatabase *database)
+    : query_plan_proto_(query_plan),
+      database_(*database) {
   }
 
   void deserializePlan();
@@ -76,7 +78,7 @@ class ExecutionDeserializer {
   void deserializeDestroyHash(const S::DestroyHashOperator &destroy_hash_operator);
   void deserializeDropTable(const S::DropTableOperator &drop_table_operator);
   void deserializeFinalizeAggregation(const S::FinalizeAggregationOperator &finalize_aggregation_operator);
-  void deserializeHashJoin(const S::HashJoinOperator &finalize_hash_join);
+  void deserializeHashJoin(const S::HashJoinOperator &hash_join_operator);
   void deserializeInitializeAggregation(const S::InitializeAggregationOperator &initialize_aggregation_operator);
   void deserializeInsert(const S::InsertOperator &insert_operator);
   void deserializeNestedLoopsJoin(const S::NestedLoopsJoinOperator &nested_loops_join_operator);
@@ -91,6 +93,7 @@ class ExecutionDeserializer {
   void deserializeWindowAggregation(const S::WindowAggregationOperator &window_aggregation_operator);
 
   const S::QueryPlan &query_plan_proto_;
+  CatalogDatabase &database_;
   
   QueryPlan query_plan;
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/query_optimizer/ExecutionSerializer.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionSerializer.cpp b/query_optimizer/ExecutionSerializer.cpp
index 885ec93..c3914af 100644
--- a/query_optimizer/ExecutionSerializer.cpp
+++ b/query_optimizer/ExecutionSerializer.cpp
@@ -56,6 +56,7 @@ namespace optimizer {
 namespace S = ::quickstep::serialization;
 
 void ExecutionSerializer::serializePlan(const QueryPlan &query_plan) {
+  // TODO(hakan): Fix the problem with const DAG.
   const auto &dag = query_plan.getQueryPlanDAG();
   for (std::size_t i = 0; i < dag.size(); ++i) {
     const auto &edges = dag.getDependencies(i);
@@ -149,6 +150,7 @@ void ExecutionSerializer::serializeInternal(const RelationalOperator &relational
         static_cast<const WindowAggregationOperator&>(relational_operator));
   case RelationalOperator::kMockOperator:
     break;
+  case RelationalOperator::kUnionAll:break;
   }
 }
 
@@ -217,7 +219,7 @@ void ExecutionSerializer::serializeCreateTable(const CreateTableOperator
&create
 
   serialization::CreateTableOperator *create_table = vertex->mutable_create_table_operator();
   // TODO(hakan): Add database id serialization.
-  serialization::CatalogRelation *catalog_relation = create_table->mutable_relation_catalog();
+  serialization::CatalogRelationSchema *catalog_relation = create_table->mutable_relation_catalog();
   catalog_relation->CopyFrom(create_table_operator.getRelation().getProto());
 }
 
@@ -228,6 +230,7 @@ void ExecutionSerializer::serializeDelete(const DeleteOperator &delete_operator)
   serialization::DeleteOperator *delete_op = vertex->mutable_delete_operator();
   delete_op->set_relation_id(delete_operator.getOutputRelationID());
   delete_op->set_predicate_index(delete_operator.getPredicateIndex());
+  delete_op->set_relation_is_stored(!delete_operator.getRelation().isTemporary());
 
 }
 void ExecutionSerializer::serializeDestroyAggregationState(

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/relational_operators/DeleteOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DeleteOperator.hpp b/relational_operators/DeleteOperator.hpp
index e97cdc8..2061bf2 100644
--- a/relational_operators/DeleteOperator.hpp
+++ b/relational_operators/DeleteOperator.hpp
@@ -114,6 +114,10 @@ class DeleteOperator : public RelationalOperator {
     return predicate_index_;
   }
 
+  const CatalogRelation& getRelation() const {
+    return relation_;
+  }
+
  private:
   /**
    * @brief Create Work Order proto.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/relational_operators/Operator.proto
----------------------------------------------------------------------
diff --git a/relational_operators/Operator.proto b/relational_operators/Operator.proto
index 164ab35..e09e128 100644
--- a/relational_operators/Operator.proto
+++ b/relational_operators/Operator.proto
@@ -88,12 +88,13 @@ message CreateIndexOperator {
 
 message CreateTableOperator {
     required int32 database_id = 1;
-    required CatalogRelation relation_catalog = 2;
+    required CatalogRelationSchema relation_catalog = 2;
 }
 
 message DeleteOperator {
     required int32 relation_id = 1;
     required int32 predicate_index = 2;
+    required bool relation_is_stored = 3;
 }
 
 message DestroyAggregationStateOperator {
@@ -133,7 +134,7 @@ message HashJoinOperator {
     required uint64 build_num_partitions = 6;
     required int32 output_relation_id = 7;
     required int32 output_destionation_index = 8;
-    required int32 hash_table_index = 9;
+    required uint32 hash_table_index = 9;
     required int32 residiual_predicate_index = 10;
     required int32 selection_index = 11;
     repeated bool is_selection_on_build = 12;
@@ -201,7 +202,7 @@ message SortRunGenerationOperator {
     required int32 input_relation_id = 1;
     required int32 output_relation_id = 2;
     required int32 output_destination_index = 3;
-    required int32 sort_config_index = 4;
+    required uint32 sort_config_index = 4;
     required bool is_input_stored = 5;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/utility/DAG.hpp
----------------------------------------------------------------------
diff --git a/utility/DAG.hpp b/utility/DAG.hpp
index 8deb795..6456455 100644
--- a/utility/DAG.hpp
+++ b/utility/DAG.hpp
@@ -325,7 +325,7 @@ class DAG {
      **/
     inline const LinkMetadataT& getLinkMetadata(const size_type_nodes node_index) const
{
       DCHECK(dependents_with_metadata_.find(node_index) != dependents_with_metadata_.end());
-      return dependents_with_metadata_[node_index];
+      return dependents_with_metadata_.at(node_index);
     }
 
     /**


Mime
View raw message