mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
#include <Storages/SelectQueryInfo.h>
|
|
#include <Parsers/ASTSelectQuery.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
bool SelectQueryInfo::isFinal() const
|
|
{
|
|
if (table_expression_modifiers)
|
|
return table_expression_modifiers->hasFinal();
|
|
|
|
const auto & select = query->as<ASTSelectQuery &>();
|
|
return select.final();
|
|
}
|
|
|
|
std::unordered_map<std::string, ColumnWithTypeAndName> SelectQueryInfo::buildNodeNameToInputNodeColumn() const
|
|
{
|
|
std::unordered_map<std::string, ColumnWithTypeAndName> node_name_to_input_node_column;
|
|
if (planner_context)
|
|
{
|
|
auto & table_expression_data = planner_context->getTableExpressionDataOrThrow(table_expression);
|
|
const auto & alias_column_expressions = table_expression_data.getAliasColumnExpressions();
|
|
for (const auto & [column_identifier, column_name] : table_expression_data.getColumnIdentifierToColumnName())
|
|
{
|
|
/// ALIAS columns cannot be used in the filter expression without being calculated in ActionsDAG,
|
|
/// so they should not be added to the input nodes.
|
|
if (alias_column_expressions.contains(column_name))
|
|
continue;
|
|
const auto & column = table_expression_data.getColumnOrThrow(column_name);
|
|
node_name_to_input_node_column.emplace(column_identifier, ColumnWithTypeAndName(column.type, column_name));
|
|
}
|
|
}
|
|
return node_name_to_input_node_column;
|
|
}
|
|
|
|
}
|