mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
commit
033b9cc28c
@ -255,7 +255,7 @@ void buildSortingDAG(QueryPlan::Node & node, std::optional<ActionsDAG> & dag, Fi
|
|||||||
|
|
||||||
/// Add more functions to fixed columns.
|
/// Add more functions to fixed columns.
|
||||||
/// Functions result is fixed if all arguments are fixed or constants.
|
/// Functions result is fixed if all arguments are fixed or constants.
|
||||||
void enreachFixedColumns(const ActionsDAG & dag, FixedColumns & fixed_columns)
|
void enrichFixedColumns(const ActionsDAG & dag, FixedColumns & fixed_columns)
|
||||||
{
|
{
|
||||||
struct Frame
|
struct Frame
|
||||||
{
|
{
|
||||||
@ -300,20 +300,20 @@ void enreachFixedColumns(const ActionsDAG & dag, FixedColumns & fixed_columns)
|
|||||||
{
|
{
|
||||||
if (frame.node->function_base->isDeterministicInScopeOfQuery())
|
if (frame.node->function_base->isDeterministicInScopeOfQuery())
|
||||||
{
|
{
|
||||||
//std::cerr << "*** enreachFixedColumns check " << frame.node->result_name << std::endl;
|
//std::cerr << "*** enrichFixedColumns check " << frame.node->result_name << std::endl;
|
||||||
bool all_args_fixed_or_const = true;
|
bool all_args_fixed_or_const = true;
|
||||||
for (const auto * child : frame.node->children)
|
for (const auto * child : frame.node->children)
|
||||||
{
|
{
|
||||||
if (!child->column && !fixed_columns.contains(child))
|
if (!child->column && !fixed_columns.contains(child))
|
||||||
{
|
{
|
||||||
//std::cerr << "*** enreachFixedColumns fail " << child->result_name << ' ' << static_cast<const void *>(child) << std::endl;
|
//std::cerr << "*** enrichFixedColumns fail " << child->result_name << ' ' << static_cast<const void *>(child) << std::endl;
|
||||||
all_args_fixed_or_const = false;
|
all_args_fixed_or_const = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_args_fixed_or_const)
|
if (all_args_fixed_or_const)
|
||||||
{
|
{
|
||||||
//std::cerr << "*** enreachFixedColumns add " << frame.node->result_name << ' ' << static_cast<const void *>(frame.node) << std::endl;
|
//std::cerr << "*** enrichFixedColumns add " << frame.node->result_name << ' ' << static_cast<const void *>(frame.node) << std::endl;
|
||||||
fixed_columns.insert(frame.node);
|
fixed_columns.insert(frame.node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,7 +357,7 @@ InputOrderInfoPtr buildInputOrderInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enreachFixedColumns(sorting_key_dag, fixed_key_columns);
|
enrichFixedColumns(sorting_key_dag, fixed_key_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is a result direction we will read from MergeTree
|
/// This is a result direction we will read from MergeTree
|
||||||
@ -530,7 +530,7 @@ AggregationInputOrder buildInputOrderInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enreachFixedColumns(sorting_key_dag, fixed_key_columns);
|
enrichFixedColumns(sorting_key_dag, fixed_key_columns);
|
||||||
|
|
||||||
for (const auto * output : dag->getOutputs())
|
for (const auto * output : dag->getOutputs())
|
||||||
{
|
{
|
||||||
@ -804,7 +804,7 @@ InputOrderInfoPtr buildInputOrderInfo(SortingStep & sorting, QueryPlan::Node & n
|
|||||||
buildSortingDAG(node, dag, fixed_columns, limit);
|
buildSortingDAG(node, dag, fixed_columns, limit);
|
||||||
|
|
||||||
if (dag && !fixed_columns.empty())
|
if (dag && !fixed_columns.empty())
|
||||||
enreachFixedColumns(*dag, fixed_columns);
|
enrichFixedColumns(*dag, fixed_columns);
|
||||||
|
|
||||||
if (auto * reading = typeid_cast<ReadFromMergeTree *>(reading_node->step.get()))
|
if (auto * reading = typeid_cast<ReadFromMergeTree *>(reading_node->step.get()))
|
||||||
{
|
{
|
||||||
@ -858,7 +858,7 @@ AggregationInputOrder buildInputOrderInfo(AggregatingStep & aggregating, QueryPl
|
|||||||
buildSortingDAG(node, dag, fixed_columns, limit);
|
buildSortingDAG(node, dag, fixed_columns, limit);
|
||||||
|
|
||||||
if (dag && !fixed_columns.empty())
|
if (dag && !fixed_columns.empty())
|
||||||
enreachFixedColumns(*dag, fixed_columns);
|
enrichFixedColumns(*dag, fixed_columns);
|
||||||
|
|
||||||
if (auto * reading = typeid_cast<ReadFromMergeTree *>(reading_node->step.get()))
|
if (auto * reading = typeid_cast<ReadFromMergeTree *>(reading_node->step.get()))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user