Github user jianqiao commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/155#discussion_r93111376 --- Diff: cli/CommandExecutor.cpp --- @@ -321,39 +338,69 @@ void executeAnalyze(const PtrVector<ParseString> *arguments, CatalogRelation *mutable_relation = query_processor->getDefaultDatabase()->getRelationByIdMutable(relation.getID()); + CatalogRelationStatistics *mutable_stat = + mutable_relation->getStatisticsMutable(); + + const std::string rel_name = EscapeQuotes(relation.getName(), '"'); // Get the number of distinct values for each column. for (const CatalogAttribute &attribute : relation) { - std::string query_string = "SELECT COUNT(DISTINCT "; - query_string.append(attribute.getName()); - query_string.append(") FROM "); - query_string.append(relation.getName()); - query_string.append(";"); + 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}); + + std::string query_string = "SELECT COUNT(DISTINCT \""; --- End diff -- Add a comment about the double quotes here.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---