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: Refactored QueryProcessor.
Date Thu, 04 Aug 2016 21:20:05 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/refactor-q-processor [created] 6ddea61e7


Refactored QueryProcessor.


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

Branch: refs/heads/refactor-q-processor
Commit: 6ddea61e7e2a5a6292e0230eb89df1ee5fb24ad4
Parents: 991f7a4
Author: Zuyu Zhang <zuyuz@twitter.com>
Authored: Thu Aug 4 14:19:38 2016 -0700
Committer: Zuyu Zhang <zuyuz@twitter.com>
Committed: Thu Aug 4 14:19:38 2016 -0700

----------------------------------------------------------------------
 query_optimizer/QueryProcessor.cpp | 8 +++++---
 query_optimizer/QueryProcessor.hpp | 8 +-------
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6ddea61e/query_optimizer/QueryProcessor.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.cpp b/query_optimizer/QueryProcessor.cpp
index f3693a1..059e5f1 100644
--- a/query_optimizer/QueryProcessor.cpp
+++ b/query_optimizer/QueryProcessor.cpp
@@ -32,9 +32,11 @@ namespace quickstep {
 
 void QueryProcessor::generateQueryHandle(const ParseStatement &statement,
                                          QueryHandle *query_handle) {
-  optimizer_->generateQueryHandle(statement, query_handle);
+  optimizer::Optimizer optimizer(getDefaultDatabase(), storage_manager_.get());
 
-  if (optimizer_->isCatalogChanged() && !catalog_altered_) {
+  optimizer.generateQueryHandle(statement, query_handle);
+
+  if (optimizer.isCatalogChanged() && !catalog_altered_) {
     catalog_altered_ = true;
   }
 
@@ -66,7 +68,7 @@ void QueryProcessor::loadCatalog() {
     throw CatalogNotProto(catalog_filename_);
   }
   catalog_file.close();
-  catalog_.reset(new Catalog(catalog_proto));
+  catalog_ = std::make_unique<Catalog>(catalog_proto);
 
   catalog_altered_ = false;
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6ddea61e/query_optimizer/QueryProcessor.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.hpp b/query_optimizer/QueryProcessor.hpp
index 43e462f..23a0189 100644
--- a/query_optimizer/QueryProcessor.hpp
+++ b/query_optimizer/QueryProcessor.hpp
@@ -26,7 +26,6 @@
 #include <string>
 
 #include "catalog/Catalog.hpp"
-#include "query_optimizer/Optimizer.hpp"
 #include "storage/StorageManager.hpp"
 #include "utility/Macros.hpp"
 
@@ -136,13 +135,10 @@ class QueryProcessor {
   QueryProcessor(const std::string &catalog_filename,
                  const std::string &storage_path)
       : catalog_filename_(catalog_filename),
+        storage_manager_(std::make_unique<StorageManager>(storage_path)),
         catalog_altered_(false),
         query_id_(0) {
     loadCatalog();
-    storage_manager_.reset(new StorageManager(storage_path));
-
-    // Construct after Catalog loads and StorageManager initializes.
-    optimizer_.reset(new optimizer::Optimizer(getDefaultDatabase(), storage_manager_.get()));
   }
 
   /**
@@ -203,8 +199,6 @@ class QueryProcessor {
   std::unique_ptr<Catalog> catalog_;
   std::unique_ptr<StorageManager> storage_manager_;
 
-  std::unique_ptr<optimizer::Optimizer> optimizer_;
-
   bool catalog_altered_;
 
   std::size_t query_id_;


Mime
View raw message