quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [5/6] incubator-quickstep git commit: Update analyze command
Date Mon, 18 Sep 2017 19:33:09 GMT
Update analyze command


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

Branch: refs/heads/trace
Commit: 01dc5322acfe97f71e5c7e0b5bc9443c7a51cb91
Parents: 4f4e71f
Author: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Authored: Tue Sep 12 14:29:52 2017 -0500
Committer: jianqiao <jianqiao@node-2.jianqiao.quickstep-pg0.wisc.cloudlab.us>
Committed: Mon Sep 18 14:32:45 2017 -0500

----------------------------------------------------------------------
 cli/CommandExecutor.cpp | 99 --------------------------------------------
 1 file changed, 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/01dc5322/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index 595c41b..fb0dd4c 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -370,105 +370,6 @@ void ExecuteAnalyzeRange(const PtrVector<ParseString> &arguments,
   query_processor->saveCatalog();
 }
 
-void ExecuteAnalyzeRange(const PtrVector<ParseString> &arguments,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out) {
-  const CatalogDatabase &database = *query_processor->getDefaultDatabase();
-
-  std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
-  std::vector<std::reference_wrapper<const CatalogRelation>> relations;
-  if (arguments.empty()) {
-    relations.insert(relations.begin(), database.begin(), database.end());
-  } else {
-    for (const auto &rel_name : arguments) {
-      const CatalogRelation *rel = database.getRelationByName(rel_name.value());
-      if (rel == nullptr) {
-        THROW_SQL_ERROR_AT(&rel_name) << "Table does not exist";
-      } else {
-        relations.emplace_back(*rel);
-      }
-    }
-  }
-
-  // Analyze each relation in the database.
-  for (const CatalogRelation &relation : relations) {
-    fprintf(out, "Analyzing %s ... ", relation.getName().c_str());
-    fflush(out);
-
-    CatalogRelation *mutable_relation =
-        query_processor->getDefaultDatabase()->getRelationByIdMutable(relation.getID());
-    CatalogRelationStatistics *mutable_stat =
-        mutable_relation->getStatisticsMutable();
-
-    if (!mutable_stat->isExact()) {
-      mutable_stat->clear();
-
-      const std::string rel_name = EscapeQuotes(relation.getName(), '"');
-
-      for (const CatalogAttribute &attribute : relation) {
-        const std::string attr_name = EscapeQuotes(attribute.getName(), '"');
-        const Type &attr_type = attribute.getType();
-        bool is_min_applicable =
-            AggregateFunctionMin::Instance().canApplyToTypes({&attr_type});
-        bool is_max_applicable =
-            AggregateFunctionMax::Instance().canApplyToTypes({&attr_type});
-        if (!is_min_applicable || !is_max_applicable) {
-          continue;
-        }
-
-        std::string query_string = "SELECT MIN(\"";
-        query_string.append(attr_name);
-        query_string.append("\"), MAX(\"");
-        query_string.append(attr_name);
-        query_string.append("\") FROM \"");
-        query_string.append(rel_name);
-        query_string.append("\";");
-
-        std::vector<TypedValue> results =
-            ExecuteQueryForSingleRow(main_thread_client_id,
-                                     foreman_client_id,
-                                     query_string,
-                                     bus,
-                                     storage_manager,
-                                     query_processor,
-                                     parser_wrapper.get());
-        DCHECK_EQ(2u, results.size());
-
-        const attribute_id attr_id = attribute.getID();
-        mutable_stat->setMinValue(attr_id, results[0]);
-        mutable_stat->setMaxValue(attr_id, results[1]);
-      }
-
-      // Get the number of tuples for the relation.
-      std::string query_string = "SELECT COUNT(*) FROM \"";
-      query_string.append(rel_name);
-      query_string.append("\";");
-
-      TypedValue num_tuples =
-          ExecuteQueryForSingleResult(main_thread_client_id,
-                                      foreman_client_id,
-                                      query_string,
-                                      bus,
-                                      storage_manager,
-                                      query_processor,
-                                      parser_wrapper.get());
-
-      DCHECK_EQ(TypeID::kLong, num_tuples.getTypeID());
-      mutable_stat->setNumTuples(num_tuples.getLiteral<std::int64_t>());
-
-      mutable_stat->setExactness(true);
-    }
-    fprintf(out, "done\n");
-    fflush(out);
-  }
-  query_processor->markCatalogAltered();
-  query_processor->saveCatalog();
-}
-
 }  // namespace
 
 void executeCommand(const ParseStatement &statement,


Mime
View raw message