You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2017/04/12 19:34:06 UTC

[03/27] incubator-quickstep git commit: Added an enum type for all relational operators

Added an enum type for all 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/db3e2f55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/db3e2f55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/db3e2f55

Branch: refs/heads/new-op
Commit: db3e2f5543a9bbf29822cad616cf8dfa98bf15cb
Parents: 18bea4a
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Tue Apr 4 23:06:15 2017 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Wed Apr 5 15:38:11 2017 -0500

----------------------------------------------------------------------
 .../tests/QueryManagerSingleNode_unittest.cpp   |  4 ++
 relational_operators/AggregationOperator.hpp    |  4 ++
 .../BuildAggregationExistenceMapOperator.hpp    |  4 ++
 relational_operators/BuildHashOperator.hpp      |  4 ++
 relational_operators/BuildLIPFilterOperator.hpp |  4 ++
 relational_operators/CreateIndexOperator.hpp    |  4 ++
 relational_operators/CreateTableOperator.hpp    |  4 ++
 relational_operators/DeleteOperator.hpp         |  4 ++
 .../DestroyAggregationStateOperator.hpp         |  4 ++
 relational_operators/DestroyHashOperator.hpp    |  4 ++
 relational_operators/DropTableOperator.hpp      |  4 ++
 .../FinalizeAggregationOperator.hpp             |  4 ++
 relational_operators/HashJoinOperator.hpp       | 15 ++++++++
 .../InitializeAggregationOperator.hpp           |  4 ++
 relational_operators/InsertOperator.hpp         |  4 ++
 .../NestedLoopsJoinOperator.hpp                 |  4 ++
 relational_operators/RelationalOperator.hpp     | 39 ++++++++++++++++++++
 relational_operators/SampleOperator.hpp         |  4 ++
 relational_operators/SaveBlocksOperator.hpp     |  4 ++
 relational_operators/SelectOperator.hpp         |  4 ++
 relational_operators/SortMergeRunOperator.hpp   |  4 ++
 .../SortRunGenerationOperator.hpp               |  4 ++
 relational_operators/TableGeneratorOperator.hpp |  4 ++
 relational_operators/TextScanOperator.hpp       |  4 ++
 relational_operators/UpdateOperator.hpp         |  4 ++
 .../WindowAggregationOperator.hpp               |  4 ++
 26 files changed, 150 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/query_execution/tests/QueryManagerSingleNode_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/QueryManagerSingleNode_unittest.cpp b/query_execution/tests/QueryManagerSingleNode_unittest.cpp
index 28ab388..9183d32 100644
--- a/query_execution/tests/QueryManagerSingleNode_unittest.cpp
+++ b/query_execution/tests/QueryManagerSingleNode_unittest.cpp
@@ -105,6 +105,10 @@ class MockOperator: public RelationalOperator {
         num_calls_donefeedingblocks_(0) {
   }
 
+  OperatorType getOperatorType() const override {
+    return kMockOperator;
+  }
+
   std::string getName() const override {
     return "MockOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/AggregationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/AggregationOperator.hpp b/relational_operators/AggregationOperator.hpp
index 2bd69f3..93f4550 100644
--- a/relational_operators/AggregationOperator.hpp
+++ b/relational_operators/AggregationOperator.hpp
@@ -82,6 +82,10 @@ class AggregationOperator : public RelationalOperator {
 
   ~AggregationOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kAggregation;
+  }
+
   std::string getName() const override {
     return "AggregationOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/BuildAggregationExistenceMapOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/BuildAggregationExistenceMapOperator.hpp b/relational_operators/BuildAggregationExistenceMapOperator.hpp
index dde39d8..b28b0b4 100644
--- a/relational_operators/BuildAggregationExistenceMapOperator.hpp
+++ b/relational_operators/BuildAggregationExistenceMapOperator.hpp
@@ -88,6 +88,10 @@ class BuildAggregationExistenceMapOperator : public RelationalOperator {
 
   ~BuildAggregationExistenceMapOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kBuildAggregationExistenceMap;
+  }
+
   std::string getName() const override {
     return "BuildAggregationExistenceMapOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/BuildHashOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/BuildHashOperator.hpp b/relational_operators/BuildHashOperator.hpp
index 273e3b1..634e1dd 100644
--- a/relational_operators/BuildHashOperator.hpp
+++ b/relational_operators/BuildHashOperator.hpp
@@ -118,6 +118,10 @@ class BuildHashOperator : public RelationalOperator {
     return input_relation_;
   }
 
+  OperatorType getOperatorType() const override {
+    return kBuildHash;
+  }
+
   std::string getName() const override {
     return "BuildHashOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/BuildLIPFilterOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/BuildLIPFilterOperator.hpp b/relational_operators/BuildLIPFilterOperator.hpp
index 5192b40..68bd307 100644
--- a/relational_operators/BuildLIPFilterOperator.hpp
+++ b/relational_operators/BuildLIPFilterOperator.hpp
@@ -98,6 +98,10 @@ class BuildLIPFilterOperator : public RelationalOperator {
     return input_relation_;
   }
 
+  OperatorType getOperatorType() const override {
+    return kBuildLIPFilter;
+  }
+
   std::string getName() const override {
     return "BuildLIPFilterOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/CreateIndexOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/CreateIndexOperator.hpp b/relational_operators/CreateIndexOperator.hpp
index 0286e1c..c08947f 100644
--- a/relational_operators/CreateIndexOperator.hpp
+++ b/relational_operators/CreateIndexOperator.hpp
@@ -70,6 +70,10 @@ class CreateIndexOperator : public RelationalOperator {
 
   ~CreateIndexOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kCreateIndex;
+  }
+
   std::string getName() const override {
     return "CreateIndexOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/CreateTableOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/CreateTableOperator.hpp b/relational_operators/CreateTableOperator.hpp
index 3a2e29b..4b06abc 100644
--- a/relational_operators/CreateTableOperator.hpp
+++ b/relational_operators/CreateTableOperator.hpp
@@ -69,6 +69,10 @@ class CreateTableOperator : public RelationalOperator {
 
   ~CreateTableOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kCreateTable;
+  }
+
   std::string getName() const override {
     return "CreateTableOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/DeleteOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DeleteOperator.hpp b/relational_operators/DeleteOperator.hpp
index 7b69d9c..aed37f6 100644
--- a/relational_operators/DeleteOperator.hpp
+++ b/relational_operators/DeleteOperator.hpp
@@ -84,6 +84,10 @@ class DeleteOperator : public RelationalOperator {
 
   ~DeleteOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kDelete;
+  }
+
   std::string getName() const override {
     return "DeleteOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/DestroyAggregationStateOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DestroyAggregationStateOperator.hpp b/relational_operators/DestroyAggregationStateOperator.hpp
index bfb5ff1..70ab45c 100644
--- a/relational_operators/DestroyAggregationStateOperator.hpp
+++ b/relational_operators/DestroyAggregationStateOperator.hpp
@@ -63,6 +63,10 @@ class DestroyAggregationStateOperator : public RelationalOperator {
 
   ~DestroyAggregationStateOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kDestroyAggregationState;
+  }
+
   std::string getName() const override {
     return "DestroyAggregationStateOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/DestroyHashOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DestroyHashOperator.hpp b/relational_operators/DestroyHashOperator.hpp
index b707999..a65e739 100644
--- a/relational_operators/DestroyHashOperator.hpp
+++ b/relational_operators/DestroyHashOperator.hpp
@@ -66,6 +66,10 @@ class DestroyHashOperator : public RelationalOperator {
 
   ~DestroyHashOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kDestroyHash;
+  }
+
   std::string getName() const override {
     return "DestroyHashOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/DropTableOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/DropTableOperator.hpp b/relational_operators/DropTableOperator.hpp
index e713bd6..99d6e7f 100644
--- a/relational_operators/DropTableOperator.hpp
+++ b/relational_operators/DropTableOperator.hpp
@@ -77,6 +77,10 @@ class DropTableOperator : public RelationalOperator {
 
   ~DropTableOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kDropTable;
+  }
+
   std::string getName() const override {
     return "DropTableOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/FinalizeAggregationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/FinalizeAggregationOperator.hpp b/relational_operators/FinalizeAggregationOperator.hpp
index 3c209b1..87533af 100644
--- a/relational_operators/FinalizeAggregationOperator.hpp
+++ b/relational_operators/FinalizeAggregationOperator.hpp
@@ -76,6 +76,10 @@ class FinalizeAggregationOperator : public RelationalOperator {
 
   ~FinalizeAggregationOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kFinalizeAggregation;
+  }
+
   std::string getName() const override {
     return "FinalizeAggregationOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/HashJoinOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/HashJoinOperator.hpp b/relational_operators/HashJoinOperator.hpp
index 5e9c5d8..8e9f2d7 100644
--- a/relational_operators/HashJoinOperator.hpp
+++ b/relational_operators/HashJoinOperator.hpp
@@ -178,6 +178,21 @@ class HashJoinOperator : public RelationalOperator {
 
   ~HashJoinOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    switch (join_type_) {
+      case JoinType::kInnerJoin:
+        return kInnerJoin;
+      case JoinType::kLeftSemiJoin:
+        return kLeftSemiJoin;
+      case JoinType::kLeftAntiJoin:
+        return kLeftAntiJoin;
+      case JoinType::kLeftOuterJoin:
+        return kLeftOuterJoin;
+      default:
+        LOG(FATAL) << "Unknown join type in HashJoinOperator::getOperatorType()";
+    }
+  }
+
   std::string getName() const override {
     switch (join_type_) {
       case JoinType::kInnerJoin:

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/InitializeAggregationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/InitializeAggregationOperator.hpp b/relational_operators/InitializeAggregationOperator.hpp
index 58d848b..e81264a 100644
--- a/relational_operators/InitializeAggregationOperator.hpp
+++ b/relational_operators/InitializeAggregationOperator.hpp
@@ -65,6 +65,10 @@ class InitializeAggregationOperator : public RelationalOperator {
 
   ~InitializeAggregationOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kInitializeAggregation;
+  }
+
   std::string getName() const override {
     return "InitializeAggregationOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/InsertOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/InsertOperator.hpp b/relational_operators/InsertOperator.hpp
index fcde663..b0bdf87 100644
--- a/relational_operators/InsertOperator.hpp
+++ b/relational_operators/InsertOperator.hpp
@@ -76,6 +76,10 @@ class InsertOperator : public RelationalOperator {
 
   ~InsertOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kInsert;
+  }
+
   std::string getName() const override {
     return "InsertOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/NestedLoopsJoinOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/NestedLoopsJoinOperator.hpp b/relational_operators/NestedLoopsJoinOperator.hpp
index f8eb080..3012114 100644
--- a/relational_operators/NestedLoopsJoinOperator.hpp
+++ b/relational_operators/NestedLoopsJoinOperator.hpp
@@ -119,6 +119,10 @@ class NestedLoopsJoinOperator : public RelationalOperator {
 
   ~NestedLoopsJoinOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kNestedLoopsJoin;
+  }
+
   std::string getName() const override {
     return "NestedLoopsJoinOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/RelationalOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/RelationalOperator.hpp b/relational_operators/RelationalOperator.hpp
index fdea307..0aeb4c9 100644
--- a/relational_operators/RelationalOperator.hpp
+++ b/relational_operators/RelationalOperator.hpp
@@ -58,6 +58,45 @@ class RelationalOperator {
   virtual ~RelationalOperator() {}
 
   /**
+   * @brief Enumeration of the operator types.
+   **/
+  enum OperatorType {
+    kAggregation = 0,
+    kBuildAggregationExistenceMap,
+    kBuildHash,
+    kBuildLIPFilter,
+    kCreateIndex,
+    kCreateTable,
+    kDelete,
+    kDestroyAggregationState,
+    kDestroyHash,
+    kDropTable,
+    kFinalizeAggregation,
+    kInitializeAggregation,
+    kInnerJoin,
+    kInsert,
+    kLeftAntiJoin,
+    kLeftOuterJoin,
+    kLeftSemiJoin,
+    kNestedLoopsJoin,
+    kSample,
+    kSaveBlocks,
+    kSelect,
+    kSortMergeRun,
+    kSortRunGeneration,
+    kTableGenerator,
+    kTextScan,
+    kUpdate,
+    kWindowAggregation,
+    kMockOperator
+  };
+
+  /**
+   * @brief Get the type of the operator.
+   **/
+  virtual OperatorType getOperatorType() const = 0;
+
+  /**
    * @brief Get the name of this relational operator.
    *
    * @return The name of this relational operator.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/SampleOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/SampleOperator.hpp b/relational_operators/SampleOperator.hpp
index e56201a..331c85d 100644
--- a/relational_operators/SampleOperator.hpp
+++ b/relational_operators/SampleOperator.hpp
@@ -96,6 +96,10 @@ class SampleOperator : public RelationalOperator {
 
   ~SampleOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kSample;
+  }
+
   std::string getName() const override {
     return "SampleOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/SaveBlocksOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/SaveBlocksOperator.hpp b/relational_operators/SaveBlocksOperator.hpp
index cd79733..4489299 100644
--- a/relational_operators/SaveBlocksOperator.hpp
+++ b/relational_operators/SaveBlocksOperator.hpp
@@ -71,6 +71,10 @@ class SaveBlocksOperator : public RelationalOperator {
 
   ~SaveBlocksOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kSaveBlocks;
+  }
+
   std::string getName() const override {
     return "SaveBlocksOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/SelectOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/SelectOperator.hpp b/relational_operators/SelectOperator.hpp
index df61c06..b8161b7 100644
--- a/relational_operators/SelectOperator.hpp
+++ b/relational_operators/SelectOperator.hpp
@@ -186,6 +186,10 @@ class SelectOperator : public RelationalOperator {
 
   ~SelectOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kSelect;
+  }
+
   std::string getName() const override {
     return "SelectOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/SortMergeRunOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/SortMergeRunOperator.hpp b/relational_operators/SortMergeRunOperator.hpp
index d2d9a2a..a8ecb88 100644
--- a/relational_operators/SortMergeRunOperator.hpp
+++ b/relational_operators/SortMergeRunOperator.hpp
@@ -132,6 +132,10 @@ class SortMergeRunOperator : public RelationalOperator {
    **/
   ~SortMergeRunOperator() {}
 
+  OperatorType getOperatorType() const override {
+    return kSortMergeRun;
+  }
+
   std::string getName() const override {
     return "SortMergeRunOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/SortRunGenerationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/SortRunGenerationOperator.hpp b/relational_operators/SortRunGenerationOperator.hpp
index 25a1273..716d4f7 100644
--- a/relational_operators/SortRunGenerationOperator.hpp
+++ b/relational_operators/SortRunGenerationOperator.hpp
@@ -112,6 +112,10 @@ class SortRunGenerationOperator : public RelationalOperator {
 
   ~SortRunGenerationOperator() {}
 
+  OperatorType getOperatorType() const override {
+    return kSortRunGeneration;
+  }
+
   std::string getName() const override {
     return "SortRunGenerationOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/TableGeneratorOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/TableGeneratorOperator.hpp b/relational_operators/TableGeneratorOperator.hpp
index c0930a4..adfe2bb 100644
--- a/relational_operators/TableGeneratorOperator.hpp
+++ b/relational_operators/TableGeneratorOperator.hpp
@@ -78,6 +78,10 @@ class TableGeneratorOperator : public RelationalOperator {
 
   ~TableGeneratorOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kTableGenerator;
+  }
+
   std::string getName() const override {
     return "TableGeneratorOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/TextScanOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/TextScanOperator.hpp b/relational_operators/TextScanOperator.hpp
index 59821fc..f6be8c8 100644
--- a/relational_operators/TextScanOperator.hpp
+++ b/relational_operators/TextScanOperator.hpp
@@ -135,6 +135,10 @@ class TextScanOperator : public RelationalOperator {
 
   ~TextScanOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kTextScan;
+  }
+
   std::string getName() const override {
     return "TextScanOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/UpdateOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/UpdateOperator.hpp b/relational_operators/UpdateOperator.hpp
index c095164..8e020d8 100644
--- a/relational_operators/UpdateOperator.hpp
+++ b/relational_operators/UpdateOperator.hpp
@@ -97,6 +97,10 @@ class UpdateOperator : public RelationalOperator {
 
   ~UpdateOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kUpdate;
+  }
+
   std::string getName() const override {
     return "UpdateOperator";
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/db3e2f55/relational_operators/WindowAggregationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/WindowAggregationOperator.hpp b/relational_operators/WindowAggregationOperator.hpp
index 530c2c1..10546b4 100644
--- a/relational_operators/WindowAggregationOperator.hpp
+++ b/relational_operators/WindowAggregationOperator.hpp
@@ -79,6 +79,10 @@ class WindowAggregationOperator : public RelationalOperator {
 
   ~WindowAggregationOperator() override {}
 
+  OperatorType getOperatorType() const override {
+    return kWindowAggregation;
+  }
+
   std::string getName() const override {
     return "WindowAggregationOperator";
   }