quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject incubator-quickstep git commit: Removed the redundant query id in the optimizer.
Date Tue, 02 Aug 2016 06:03:01 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/optimizer-q-id [created] f565f33a4


Removed the redundant query id in the optimizer.


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

Branch: refs/heads/optimizer-q-id
Commit: f565f33a479b6c815a68874beb1d0eaa66e807a1
Parents: ccea2ff
Author: Zuyu Zhang <zuyuz@twitter.com>
Authored: Mon Aug 1 23:02:37 2016 -0700
Committer: Zuyu Zhang <zuyuz@twitter.com>
Committed: Mon Aug 1 23:02:37 2016 -0700

----------------------------------------------------------------------
 cli/tests/CommandExecutorTestRunner.cpp               |  5 ++---
 query_optimizer/ExecutionGenerator.cpp                |  2 +-
 query_optimizer/Optimizer.hpp                         |  7 ++-----
 query_optimizer/OptimizerContext.hpp                  | 14 ++------------
 query_optimizer/QueryProcessor.cpp                    |  2 +-
 .../tests/ExecutionGeneratorTestRunner.cpp            |  5 ++---
 query_optimizer/tests/OptimizerTest.cpp               |  3 +--
 query_optimizer/tests/OptimizerTextTestRunner.cpp     |  3 +--
 8 files changed, 12 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/cli/tests/CommandExecutorTestRunner.cpp
----------------------------------------------------------------------
diff --git a/cli/tests/CommandExecutorTestRunner.cpp b/cli/tests/CommandExecutorTestRunner.cpp
index bd7082f..dc7e43f 100644
--- a/cli/tests/CommandExecutorTestRunner.cpp
+++ b/cli/tests/CommandExecutorTestRunner.cpp
@@ -76,8 +76,7 @@ void CommandExecutorTestRunner::runTestCase(
   while (true) {
     ParseResult result = sql_parser_.getNextStatement();
 
-    O::OptimizerContext optimizer_context(0 /* query_id */,
-                                          test_database_loader_.catalog_database(),
+    O::OptimizerContext optimizer_context(test_database_loader_.catalog_database(),
                                           test_database_loader_.storage_manager());
 
     if (result.condition != ParseResult::kSuccess) {
@@ -99,7 +98,7 @@ void CommandExecutorTestRunner::runTestCase(
               nullptr,
               output_stream.file());
         } else  {
-          QueryHandle query_handle(optimizer_context.query_id());
+          QueryHandle query_handle(0 /* query_id */);
           O::LogicalGenerator logical_generator(&optimizer_context);
           O::PhysicalGenerator physical_generator;
           O::ExecutionGenerator execution_generator(&optimizer_context, &query_handle);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index 88103df..98628ca 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -299,7 +299,7 @@ void ExecutionGenerator::generatePlanInternal(
 std::string ExecutionGenerator::getNewRelationName() {
   std::ostringstream out;
   out << OptimizerContext::kInternalTemporaryRelationNamePrefix
-      << optimizer_context_->query_id() << "_" << rel_id_;
+      << query_handle_->query_id() << "_" << rel_id_;
   ++rel_id_;
   return out.str();
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/Optimizer.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/Optimizer.hpp b/query_optimizer/Optimizer.hpp
index 9177414..2a49675 100644
--- a/query_optimizer/Optimizer.hpp
+++ b/query_optimizer/Optimizer.hpp
@@ -45,15 +45,12 @@ class Optimizer {
   /**
    * @brief Constructor.
    *
-   * @param query_id The query id. Used to identify a query and create distinct
-   *        names for temporary relations.
    * @param database The database that the query is executed on.
    * @param storage_manager The storage manager for the database.
    */
-  Optimizer(const std::size_t query_id,
-            CatalogDatabase *database,
+  Optimizer(CatalogDatabase *database,
             StorageManager *storage_manager)
-      : optimizer_context_(query_id, database, storage_manager) {}
+      : optimizer_context_(database, storage_manager) {}
 
   /**
    * @brief Destructor.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/OptimizerContext.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/OptimizerContext.hpp b/query_optimizer/OptimizerContext.hpp
index abdc7f4..5277ab1 100644
--- a/query_optimizer/OptimizerContext.hpp
+++ b/query_optimizer/OptimizerContext.hpp
@@ -49,16 +49,13 @@ class OptimizerContext {
   /**
    * @brief Constructor.
    *
-   * @param query_id The query ID.
    * @param catalog_database The catalog database where this query is executed.
    * @param storage_manager The storage manager to use for allocating storage
    *        blocks.
    */
-  OptimizerContext(const std::size_t query_id,
-                   CatalogDatabase *catalog_database,
+  OptimizerContext(CatalogDatabase *catalog_database,
                    StorageManager *storage_manager)
-      : query_id_(query_id),
-        current_expr_id_(-1),
+      : current_expr_id_(-1),
         catalog_database_(catalog_database),
         storage_manager_(storage_manager),
         has_nested_queries_(false),
@@ -94,11 +91,6 @@ class OptimizerContext {
   StorageManager* storage_manager() { return storage_manager_; }
 
   /**
-   * @return Query ID.
-   */
-  std::size_t query_id() const { return query_id_; }
-
-  /**
    * @brief Gets the next ExprId.
    *
    * @return A new ExprId.
@@ -133,8 +125,6 @@ class OptimizerContext {
   bool is_catalog_changed() const { return is_catalog_changed_; }
 
  private:
-  const std::size_t query_id_;
-
   expressions::ExprId current_expr_id_;
 
   CatalogDatabase *catalog_database_;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/QueryProcessor.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.cpp b/query_optimizer/QueryProcessor.cpp
index 6381d3a..a1b1e92 100644
--- a/query_optimizer/QueryProcessor.cpp
+++ b/query_optimizer/QueryProcessor.cpp
@@ -41,7 +41,7 @@ QueryHandle* QueryProcessor::generateQueryHandle(const ParseStatement &statement
   std::unique_ptr<QueryHandle> query_handle(
       new QueryHandle(query_id_, statement.getPriority()));
 
-  optimizer::Optimizer optimizer(query_id_, getDefaultDatabase(), storage_manager_.get());
+  optimizer::Optimizer optimizer(getDefaultDatabase(), storage_manager_.get());
   optimizer.generateQueryHandle(statement, query_handle.get());
 
   if (optimizer.isCatalogChanged() && !catalog_altered_) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp b/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp
index 563a777..fd1bb86 100644
--- a/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp
+++ b/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp
@@ -73,8 +73,7 @@ void ExecutionGeneratorTestRunner::runTestCase(
   while (true) {
     ParseResult result = sql_parser_.getNextStatement();
 
-    OptimizerContext optimizer_context(0 /* query_id */,
-                                       test_database_loader_.catalog_database(),
+    OptimizerContext optimizer_context(test_database_loader_.catalog_database(),
                                        test_database_loader_.storage_manager());
 
     if (result.condition != ParseResult::kSuccess) {
@@ -85,7 +84,7 @@ void ExecutionGeneratorTestRunner::runTestCase(
     } else {
       std::printf("%s\n", result.parsed_statement->toString().c_str());
       try {
-        QueryHandle query_handle(optimizer_context.query_id());
+        QueryHandle query_handle(0 /* query_id */);
         LogicalGenerator logical_generator(&optimizer_context);
         PhysicalGenerator physical_generator;
         ExecutionGenerator execution_generator(&optimizer_context,

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/tests/OptimizerTest.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/OptimizerTest.cpp b/query_optimizer/tests/OptimizerTest.cpp
index 3734719..57e2d67 100644
--- a/query_optimizer/tests/OptimizerTest.cpp
+++ b/query_optimizer/tests/OptimizerTest.cpp
@@ -59,8 +59,7 @@ OptimizerTest::OptimizerTest()
     : catalog_(new Catalog),
       catalog_database_(
           new CatalogDatabase(catalog_.get(), "TestDatabase" /* name */, 0)),
-      optimizer_context_(new OptimizerContext(0 /* query_id */,
-                                              catalog_database_.get(),
+      optimizer_context_(new OptimizerContext(catalog_database_.get(),
                                               nullptr /* storage_manager */)),
       physical_generator_(new PhysicalGenerator()) {}
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f565f33a/query_optimizer/tests/OptimizerTextTestRunner.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/OptimizerTextTestRunner.cpp b/query_optimizer/tests/OptimizerTextTestRunner.cpp
index 251b64b..d790c33 100644
--- a/query_optimizer/tests/OptimizerTextTestRunner.cpp
+++ b/query_optimizer/tests/OptimizerTextTestRunner.cpp
@@ -47,8 +47,7 @@ void OptimizerTextTestRunner::runTestCase(const std::string &input,
   sql_parser_.feedNextBuffer(new std::string(input));
   ParseResult result = sql_parser_.getNextStatement();
 
-  OptimizerContext optimizer_context(0 /* query_id */,
-                                     test_database_loader_.catalog_database(),
+  OptimizerContext optimizer_context(test_database_loader_.catalog_database(),
                                      nullptr /* storage_manager */);
   if (result.condition != ParseResult::kSuccess) {
     *output = result.error_message;


Mime
View raw message