mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 09:52:38 +00:00
Some polishing
This commit is contained in:
parent
ca72c1269c
commit
996b833faa
@ -2262,6 +2262,7 @@ ActionsDAGPtr ActionsDAG::buildFilterActionsDAG(
|
||||
|
||||
const ActionsDAG::Node * ActionsDAG::getOriginalNodeForOutputAlias(const String & output_name)
|
||||
{
|
||||
/// find alias in output
|
||||
const Node * output_alias = nullptr;
|
||||
for (const auto * node : outputs)
|
||||
{
|
||||
@ -2274,6 +2275,7 @@ const ActionsDAG::Node * ActionsDAG::getOriginalNodeForOutputAlias(const String
|
||||
if (!output_alias)
|
||||
return nullptr;
|
||||
|
||||
/// find original(non alias) node it refers to
|
||||
const Node * node = output_alias;
|
||||
while (node && node->type == ActionsDAG::ActionType::ALIAS)
|
||||
{
|
||||
|
@ -13,17 +13,17 @@
|
||||
namespace DB::QueryPlanOptimizations
|
||||
{
|
||||
|
||||
constexpr bool debug_logging_enabled = true;
|
||||
void logDebug(const String & prefix, const String & message)
|
||||
{
|
||||
if constexpr (debug_logging_enabled)
|
||||
{
|
||||
LOG_DEBUG(&Poco::Logger::get("redundantDistinct"), "{}: {}", prefix, message);
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr bool debug_logging_enabled = false;
|
||||
void logActionsDAG(const String & prefix, const ActionsDAGPtr & actions)
|
||||
{
|
||||
if constexpr (debug_logging_enabled)
|
||||
{
|
||||
LOG_DEBUG(&Poco::Logger::get("redundantDistinct"), "{}: {}", prefix, actions->dumpDAG());
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string_view> getDistinctColumns(const DistinctStep * distinct)
|
||||
{
|
||||
/// find non-const columns in DISTINCT
|
||||
@ -100,6 +100,8 @@ size_t tryRemoveRedundantDistinct(QueryPlan::Node * parent_node, QueryPlan::Node
|
||||
path_actions->mergeInplace(std::move(*clone));
|
||||
}
|
||||
|
||||
logActionsDAG("merged DAG:\n{}", path_actions);
|
||||
|
||||
/// compare columns of two DISTINCTs
|
||||
for (const auto & column : distinct_columns)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user