Fixed build

This commit is contained in:
Maksim Kita 2022-09-15 12:14:55 +02:00
parent 8cadb1b318
commit fe84e871f8
5 changed files with 14 additions and 9 deletions

View File

@ -9,7 +9,7 @@ namespace DB
namespace ErrorCodes
{
extern const int ILLEGAL_AGGREGATION;
extern const int ILLEGAL_AGGREGATION;
}
namespace

View File

@ -3125,7 +3125,8 @@ void QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, IdentifierResolveSc
"Function GROUPING can have up to 64 arguments, but {} provided",
function_arguments_size);
auto grouping_function = std::make_shared<FunctionGrouping>();
bool force_grouping_standard_compatibility = context->getSettingsRef().force_grouping_standard_compatibility;
auto grouping_function = std::make_shared<FunctionGrouping>(force_grouping_standard_compatibility);
auto grouping_function_adaptor = std::make_shared<FunctionToOverloadResolverAdaptor>(std::move(grouping_function));
function_node.resolveAsFunction(std::move(grouping_function_adaptor), std::make_shared<DataTypeUInt64>());
return;

View File

@ -83,7 +83,7 @@ Block createBlockFromCollection(const Collection & collection, const DataTypes &
"Invalid type in set. Expected tuple, got {}",
value.getTypeName());
const auto & tuple = DB::get<const Tuple &>(value);
const auto & tuple = value.template get<const Tuple &>();
size_t tuple_size = tuple.size();
if (tuple_size != columns_size)

View File

@ -79,8 +79,8 @@ public:
class FunctionGrouping : public FunctionGroupingBase
{
public:
explicit FunctionGrouping()
: FunctionGroupingBase(ColumnNumbers())
explicit FunctionGrouping(bool force_compatibility_)
: FunctionGroupingBase(ColumnNumbers(), force_compatibility_)
{}
String getName() const override { return "grouping"; }

View File

@ -8,6 +8,8 @@
#include <Analyzer/QueryNode.h>
#include <Analyzer/CollectAggregateFunctionNodes.h>
#include <Interpreters/Context.h>
#include <Planner/PlannerActionsVisitor.h>
namespace DB
@ -99,18 +101,20 @@ public:
auto grouping_set_argument_column = std::make_shared<ColumnNode>(NameAndTypePair{"__grouping_set", std::make_shared<DataTypeUInt64>()}, column_source);
function_node->getArguments().getNodes().clear();
bool force_grouping_standard_compatibility = data.planner_context.getQueryContext()->getSettingsRef().force_grouping_standard_compatibility;
switch (data.group_by_kind)
{
case GroupByKind::ORDINARY:
{
auto grouping_ordinary_function = std::make_shared<FunctionGroupingOrdinary>(arguments_indexes);
auto grouping_ordinary_function = std::make_shared<FunctionGroupingOrdinary>(arguments_indexes, force_grouping_standard_compatibility);
auto grouping_ordinary_function_adaptor = std::make_shared<FunctionToOverloadResolverAdaptor>(std::move(grouping_ordinary_function));
function_node->resolveAsFunction(grouping_ordinary_function_adaptor, std::make_shared<DataTypeUInt64>());
break;
}
case GroupByKind::ROLLUP:
{
auto grouping_ordinary_function = std::make_shared<FunctionGroupingForRollup>(arguments_indexes, aggregation_keys_size);
auto grouping_ordinary_function = std::make_shared<FunctionGroupingForRollup>(arguments_indexes, aggregation_keys_size, force_grouping_standard_compatibility);
auto grouping_ordinary_function_adaptor = std::make_shared<FunctionToOverloadResolverAdaptor>(std::move(grouping_ordinary_function));
function_node->resolveAsFunction(grouping_ordinary_function_adaptor, std::make_shared<DataTypeUInt64>());
function_node->getArguments().getNodes().push_back(std::move(grouping_set_argument_column));
@ -118,7 +122,7 @@ public:
}
case GroupByKind::CUBE:
{
auto grouping_ordinary_function = std::make_shared<FunctionGroupingForCube>(arguments_indexes, aggregation_keys_size);
auto grouping_ordinary_function = std::make_shared<FunctionGroupingForCube>(arguments_indexes, aggregation_keys_size, force_grouping_standard_compatibility);
auto grouping_ordinary_function_adaptor = std::make_shared<FunctionToOverloadResolverAdaptor>(std::move(grouping_ordinary_function));
function_node->resolveAsFunction(grouping_ordinary_function_adaptor, std::make_shared<DataTypeUInt64>());
function_node->getArguments().getNodes().push_back(std::move(grouping_set_argument_column));
@ -126,7 +130,7 @@ public:
}
case GroupByKind::GROUPING_SETS:
{
auto grouping_grouping_sets_function = std::make_shared<FunctionGroupingForGroupingSets>(arguments_indexes, data.grouping_sets_keys_indices);
auto grouping_grouping_sets_function = std::make_shared<FunctionGroupingForGroupingSets>(arguments_indexes, data.grouping_sets_keys_indices, force_grouping_standard_compatibility);
auto grouping_ordinary_function_adaptor = std::make_shared<FunctionToOverloadResolverAdaptor>(std::move(grouping_grouping_sets_function));
function_node->resolveAsFunction(grouping_ordinary_function_adaptor, std::make_shared<DataTypeUInt64>());
function_node->getArguments().getNodes().push_back(std::move(grouping_set_argument_column));