This commit is contained in:
Dmitry 2020-02-14 16:31:01 +03:00
parent 76e9a8edfd
commit 4bcf10b5a5
3 changed files with 25 additions and 25 deletions

View File

@ -1910,15 +1910,15 @@ void InterpreterSelectQuery::executeAggregation(Pipeline & pipeline, const Expre
const Settings & settings = context->getSettingsRef();
if (group_by_info) {
if (group_by_info)
{
/// TODO optimization :)
// for (const auto & elem : group_by_info->order_key_prefix_descr) {
// for (const auto & elem : group_by_info->order_key_prefix_descr)
// std::cerr << elem << " ";
// }
// std::cerr << "\n";
}
/** Two-level aggregation is useful in two cases:
* 1. Parallel aggregation is done, and the results should be merged in parallel.
* 2. An aggregation is done with store of temporary data on the disk, and they need to be merged in a memory efficient way.

View File

@ -136,10 +136,10 @@ GroupByInfoPtr AggregateInOrderOptimizer::getGroupByCommonPrefix(const StoragePt
if (forbidden_columns.count(group_by_description[i]))
break;
if (group_by_description[i] == sorting_key_columns[i]) {
if (group_by_description[i] == sorting_key_columns[i])
group_by_common_prefix.push_back(group_by_description[i]);
}
else {
else
{
/// TODO injective functions
break;
}

View File

@ -30,24 +30,24 @@ private:
};
/** Helper class, that can analyze MergeTree order key
* and required group by description to get their
* common prefix, which is needed for
* performing reading in order of PK.
*/
class AggregateInOrderOptimizer
{
public:
AggregateInOrderOptimizer(
const Names & group_by_description,
const SyntaxAnalyzerResultPtr & syntax_result);
/** Helper class, that can analyze MergeTree order key
* and required group by description to get their
* common prefix, which is needed for
* performing reading in order of PK.
*/
class AggregateInOrderOptimizer
{
public:
AggregateInOrderOptimizer(
const Names & group_by_description,
const SyntaxAnalyzerResultPtr & syntax_result);
GroupByInfoPtr getGroupByCommonPrefix(const StoragePtr & storage) const;
GroupByInfoPtr getGroupByCommonPrefix(const StoragePtr & storage) const;
private:
/// Actions for every element of order expression to analyze functions for monotonicity
NameSet forbidden_columns;
Names group_by_description;
};
private:
/// Actions for every element of order expression to analyze functions for monotonicity
NameSet forbidden_columns;
Names group_by_description;
};
}
}