mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
update as suggested
This commit is contained in:
parent
7b9e81742f
commit
9bdd9c912e
@ -21,10 +21,10 @@ public:
|
||||
static constexpr auto name = "buildId";
|
||||
static FunctionPtr create(ContextPtr context)
|
||||
{
|
||||
return std::make_shared<FunctionBuildId>(context);
|
||||
return std::make_shared<FunctionBuildId>(context->isDistributed());
|
||||
}
|
||||
|
||||
explicit FunctionBuildId(ContextPtr context_) : context(context_)
|
||||
explicit FunctionBuildId(bool is_distributed_) : is_distributed(is_distributed_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public:
|
||||
|
||||
bool isDeterministic() const override { return false; }
|
||||
bool isDeterministicInScopeOfQuery() const override { return true; }
|
||||
bool isSuitableForConstantFolding() const override { return !context->isDistributed(); }
|
||||
bool isSuitableForConstantFolding() const override { return !is_distributed; }
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & /*arguments*/) const override
|
||||
{
|
||||
@ -53,7 +53,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ContextPtr context;
|
||||
bool is_distributed;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ public:
|
||||
static constexpr auto name = "hostName";
|
||||
static FunctionPtr create(ContextPtr context)
|
||||
{
|
||||
return std::make_shared<FunctionHostName>(context);
|
||||
return std::make_shared<FunctionHostName>(context->isDistributed());
|
||||
}
|
||||
|
||||
explicit FunctionHostName(ContextPtr context_) : context(context_)
|
||||
explicit FunctionHostName(bool is_distributed_) : is_distributed(is_distributed_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSuitableForConstantFolding() const override { return !context->isDistributed(); }
|
||||
bool isSuitableForConstantFolding() const override { return !is_distributed; }
|
||||
|
||||
size_t getNumberOfArguments() const override
|
||||
{
|
||||
@ -54,7 +54,7 @@ public:
|
||||
return result_type->createColumnConst(input_rows_count, DNSResolver::instance().getHostName());
|
||||
}
|
||||
private:
|
||||
ContextPtr context;
|
||||
bool is_distributed;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ public:
|
||||
|
||||
static FunctionPtr create(ContextPtr context)
|
||||
{
|
||||
return std::make_shared<FunctionTcpPort>(context, context->getTCPPort());
|
||||
return std::make_shared<FunctionTcpPort>(context->isDistributed(), context->getTCPPort());
|
||||
}
|
||||
|
||||
explicit FunctionTcpPort(ContextPtr context_, UInt16 port_) : context(context_), port(port_)
|
||||
explicit FunctionTcpPort(bool is_distributed_, UInt16 port_) : is_distributed(is_distributed_), port(port_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
|
||||
bool isDeterministicInScopeOfQuery() const override { return true; }
|
||||
|
||||
bool isSuitableForConstantFolding() const override { return !context->isDistributed(); }
|
||||
bool isSuitableForConstantFolding() const override { return !is_distributed; }
|
||||
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
|
||||
{
|
||||
@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ContextPtr context;
|
||||
bool is_distributed;
|
||||
const UInt64 port;
|
||||
};
|
||||
|
||||
|
@ -15,10 +15,10 @@ public:
|
||||
static constexpr auto name = "uptime";
|
||||
static FunctionPtr create(ContextPtr context)
|
||||
{
|
||||
return std::make_shared<FunctionUptime>(context, context->getUptimeSeconds());
|
||||
return std::make_shared<FunctionUptime>(context->isDistributed(), context->getUptimeSeconds());
|
||||
}
|
||||
|
||||
explicit FunctionUptime(ContextPtr context_, time_t uptime_) : context(context_), uptime(uptime_)
|
||||
explicit FunctionUptime(bool is_distributed_, time_t uptime_) : is_distributed(is_distributed_), uptime(uptime_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
bool isDeterministic() const override { return false; }
|
||||
bool isDeterministicInScopeOfQuery() const override { return true; }
|
||||
bool isSuitableForConstantFolding() const override { return !context->isDistributed(); }
|
||||
bool isSuitableForConstantFolding() const override { return !is_distributed; }
|
||||
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
|
||||
{
|
||||
@ -47,7 +47,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ContextPtr context;
|
||||
bool is_distributed;
|
||||
time_t uptime;
|
||||
};
|
||||
|
||||
|
@ -19,10 +19,10 @@ public:
|
||||
static constexpr auto name = "version";
|
||||
static FunctionPtr create(ContextPtr context)
|
||||
{
|
||||
return std::make_shared<FunctionVersion>(context);
|
||||
return std::make_shared<FunctionVersion>(context->isDistributed());
|
||||
}
|
||||
|
||||
explicit FunctionVersion(ContextPtr context_) : context(context_)
|
||||
explicit FunctionVersion(bool is_distributed_) : is_distributed(is_distributed_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
|
||||
bool isDeterministic() const override { return false; }
|
||||
bool isDeterministicInScopeOfQuery() const override { return true; }
|
||||
bool isSuitableForConstantFolding() const override { return !context->isDistributed(); }
|
||||
bool isSuitableForConstantFolding() const override { return !is_distributed; }
|
||||
|
||||
size_t getNumberOfArguments() const override
|
||||
{
|
||||
@ -50,7 +50,7 @@ public:
|
||||
return DataTypeString().createColumnConst(input_rows_count, VERSION_STRING);
|
||||
}
|
||||
private:
|
||||
ContextPtr context;
|
||||
bool is_distributed;
|
||||
};
|
||||
|
||||
|
||||
|
@ -126,6 +126,7 @@ ExpressionAnalyzerData::~ExpressionAnalyzerData() = default;
|
||||
ExpressionAnalyzer::ExtractedSettings::ExtractedSettings(const Settings & settings_)
|
||||
: use_index_for_in_with_subqueries(settings_.use_index_for_in_with_subqueries)
|
||||
, size_limits_for_set(settings_.max_rows_in_set, settings_.max_bytes_in_set, settings_.set_overflow_mode)
|
||||
, distributed_group_by_no_merge(settings_.distributed_group_by_no_merge)
|
||||
{}
|
||||
|
||||
ExpressionAnalyzer::~ExpressionAnalyzer() = default;
|
||||
@ -247,8 +248,8 @@ void ExpressionAnalyzer::analyzeAggregation()
|
||||
if (!node)
|
||||
throw Exception("Unknown identifier (in GROUP BY): " + column_name, ErrorCodes::UNKNOWN_IDENTIFIER);
|
||||
|
||||
/// Only removes constant keys if it's an initiator.
|
||||
if (getContext()->getClientInfo().distributed_depth == 0)
|
||||
/// Only removes constant keys if it's an initiator or distributed_group_by_no_merge is enabled.
|
||||
if (getContext()->getClientInfo().distributed_depth == 0 && settings.distributed_group_by_no_merge > 0)
|
||||
{
|
||||
/// Constant expressions have non-null column pointer at this stage.
|
||||
if (node->column && isColumnConst(*node->column))
|
||||
|
@ -90,6 +90,7 @@ private:
|
||||
{
|
||||
const bool use_index_for_in_with_subqueries;
|
||||
const SizeLimits size_limits_for_set;
|
||||
const UInt64 distributed_group_by_no_merge;
|
||||
|
||||
ExtractedSettings(const Settings & settings_);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user