mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add const qualifier for IFunction::isInjective()
This commit is contained in:
parent
fa62be250f
commit
f29e5c60a5
@ -35,7 +35,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInjective(const Block &) override
|
bool isInjective(const Block &) const override
|
||||||
{
|
{
|
||||||
return is_injective;
|
return is_injective;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return is_injective; }
|
bool isInjective(const Block &) const override { return is_injective; }
|
||||||
|
|
||||||
bool useDefaultImplementationForConstants() const override { return true; }
|
bool useDefaultImplementationForConstants() const override { return true; }
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
String getName() const override { return name; }
|
String getName() const override { return name; }
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return mask_tail_octets == 0; }
|
bool isInjective(const Block &) const override { return mask_tail_octets == 0; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -447,7 +447,7 @@ public:
|
|||||||
String getName() const override { return name; }
|
String getName() const override { return name; }
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -546,7 +546,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -739,7 +739,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -837,7 +837,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -941,7 +941,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -1224,7 +1224,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
@ -1313,7 +1313,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isVariadic() const override { return true; }
|
bool isVariadic() const override { return true; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
size_t getNumberOfArguments() const override { return 0; }
|
size_t getNumberOfArguments() const override { return 0; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
@ -1408,7 +1408,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
|
@ -913,7 +913,7 @@ public:
|
|||||||
|
|
||||||
bool isVariadic() const override { return true; }
|
bool isVariadic() const override { return true; }
|
||||||
size_t getNumberOfArguments() const override { return 0; }
|
size_t getNumberOfArguments() const override { return 0; }
|
||||||
bool isInjective(const Block &) override { return std::is_same_v<Name, NameToString>; }
|
bool isInjective(const Block &) const override { return std::is_same_v<Name, NameToString>; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
|
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
|
||||||
{
|
{
|
||||||
@ -1268,7 +1268,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 2; }
|
size_t getNumberOfArguments() const override { return 2; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
|
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
|
||||||
{
|
{
|
||||||
|
@ -589,7 +589,7 @@ public:
|
|||||||
|
|
||||||
/// For the purpose of query optimization, we assume this function to be injective
|
/// For the purpose of query optimization, we assume this function to be injective
|
||||||
/// even in face of fact that there are many different cities named Moscow.
|
/// even in face of fact that there are many different cities named Moscow.
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,7 @@ private:
|
|||||||
bool useDefaultImplementationForConstants() const final { return true; }
|
bool useDefaultImplementationForConstants() const final { return true; }
|
||||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override
|
bool isInjective(const Block & sample_block) const override
|
||||||
{
|
{
|
||||||
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
||||||
}
|
}
|
||||||
@ -763,7 +763,7 @@ private:
|
|||||||
bool useDefaultImplementationForConstants() const final { return true; }
|
bool useDefaultImplementationForConstants() const final { return true; }
|
||||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override
|
bool isInjective(const Block & sample_block) const override
|
||||||
{
|
{
|
||||||
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
||||||
}
|
}
|
||||||
@ -1328,7 +1328,7 @@ private:
|
|||||||
bool useDefaultImplementationForConstants() const final { return true; }
|
bool useDefaultImplementationForConstants() const final { return true; }
|
||||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override
|
bool isInjective(const Block & sample_block) const override
|
||||||
{
|
{
|
||||||
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
||||||
}
|
}
|
||||||
@ -1476,7 +1476,7 @@ private:
|
|||||||
bool useDefaultImplementationForConstants() const final { return true; }
|
bool useDefaultImplementationForConstants() const final { return true; }
|
||||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0, 1}; }
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override
|
bool isInjective(const Block & sample_block) const override
|
||||||
{
|
{
|
||||||
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
return isDictGetFunctionInjective(dictionaries_loader, sample_block);
|
||||||
}
|
}
|
||||||
@ -1617,7 +1617,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
size_t getNumberOfArguments() const override { return 2; }
|
size_t getNumberOfArguments() const override { return 2; }
|
||||||
bool isInjective(const Block & /*sample_block*/) override { return true; }
|
bool isInjective(const Block & /*sample_block*/) const override { return true; }
|
||||||
|
|
||||||
bool useDefaultImplementationForConstants() const final { return true; }
|
bool useDefaultImplementationForConstants() const final { return true; }
|
||||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0}; }
|
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0}; }
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 1; }
|
size_t getNumberOfArguments() const override { return 1; }
|
||||||
bool isInjective(const Block &) override { return true; }
|
bool isInjective(const Block &) const override { return true; }
|
||||||
|
|
||||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,7 @@ public:
|
|||||||
*
|
*
|
||||||
* sample_block should contain data types of arguments and values of constants, if relevant.
|
* sample_block should contain data types of arguments and values of constants, if relevant.
|
||||||
*/
|
*/
|
||||||
virtual bool isInjective(const Block & /*sample_block*/) { return false; }
|
virtual bool isInjective(const Block & /*sample_block*/) const { return false; }
|
||||||
|
|
||||||
/** Function is called "deterministic", if it returns same result for same values of arguments.
|
/** Function is called "deterministic", if it returns same result for same values of arguments.
|
||||||
* Most of functions are deterministic. Notable counterexample is rand().
|
* Most of functions are deterministic. Notable counterexample is rand().
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
return impl->getResultIfAlwaysReturnsConstantAndHasArguments(block, arguments);
|
return impl->getResultIfAlwaysReturnsConstantAndHasArguments(block, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) final { return impl->isInjective(sample_block); }
|
bool isInjective(const Block & sample_block) const final { return impl->isInjective(sample_block); }
|
||||||
bool isDeterministic() const final { return impl->isDeterministic(); }
|
bool isDeterministic() const final { return impl->isDeterministic(); }
|
||||||
bool isDeterministicInScopeOfQuery() const final { return impl->isDeterministicInScopeOfQuery(); }
|
bool isDeterministicInScopeOfQuery() const final { return impl->isDeterministicInScopeOfQuery(); }
|
||||||
bool hasInformationAboutMonotonicity() const final { return impl->hasInformationAboutMonotonicity(); }
|
bool hasInformationAboutMonotonicity() const final { return impl->hasInformationAboutMonotonicity(); }
|
||||||
@ -195,7 +195,7 @@ public:
|
|||||||
|
|
||||||
bool isStateful() const override { return function->isStateful(); }
|
bool isStateful() const override { return function->isStateful(); }
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override { return function->isInjective(sample_block); }
|
bool isInjective(const Block & sample_block) const override { return function->isInjective(sample_block); }
|
||||||
|
|
||||||
bool isDeterministic() const override { return function->isDeterministic(); }
|
bool isDeterministic() const override { return function->isDeterministic(); }
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
virtual bool isSuitableForConstantFolding() const { return true; }
|
virtual bool isSuitableForConstantFolding() const { return true; }
|
||||||
virtual ColumnPtr getResultIfAlwaysReturnsConstantAndHasArguments(const Block & /*block*/, const ColumnNumbers & /*arguments*/) const { return nullptr; }
|
virtual ColumnPtr getResultIfAlwaysReturnsConstantAndHasArguments(const Block & /*block*/, const ColumnNumbers & /*arguments*/) const { return nullptr; }
|
||||||
|
|
||||||
virtual bool isInjective(const Block & /*sample_block*/) { return false; }
|
virtual bool isInjective(const Block & /*sample_block*/) const { return false; }
|
||||||
virtual bool isDeterministic() const { return true; }
|
virtual bool isDeterministic() const { return true; }
|
||||||
virtual bool isDeterministicInScopeOfQuery() const { return true; }
|
virtual bool isDeterministicInScopeOfQuery() const { return true; }
|
||||||
virtual bool hasInformationAboutMonotonicity() const { return false; }
|
virtual bool hasInformationAboutMonotonicity() const { return false; }
|
||||||
@ -256,7 +256,7 @@ public:
|
|||||||
/// Properties from IFunctionBase (see IFunction.h)
|
/// Properties from IFunctionBase (see IFunction.h)
|
||||||
virtual bool isSuitableForConstantFolding() const { return true; }
|
virtual bool isSuitableForConstantFolding() const { return true; }
|
||||||
virtual ColumnPtr getResultIfAlwaysReturnsConstantAndHasArguments(const Block & /*block*/, const ColumnNumbers & /*arguments*/) const { return nullptr; }
|
virtual ColumnPtr getResultIfAlwaysReturnsConstantAndHasArguments(const Block & /*block*/, const ColumnNumbers & /*arguments*/) const { return nullptr; }
|
||||||
virtual bool isInjective(const Block & /*sample_block*/) { return false; }
|
virtual bool isInjective(const Block & /*sample_block*/) const { return false; }
|
||||||
virtual bool isDeterministic() const { return true; }
|
virtual bool isDeterministic() const { return true; }
|
||||||
virtual bool isDeterministicInScopeOfQuery() const { return true; }
|
virtual bool isDeterministicInScopeOfQuery() const { return true; }
|
||||||
virtual bool isStateful() const { return false; }
|
virtual bool isStateful() const { return false; }
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
size_t getNumberOfArguments() const override { return 0; }
|
size_t getNumberOfArguments() const override { return 0; }
|
||||||
|
|
||||||
bool isInjective(const Block &) override { return is_injective; }
|
bool isInjective(const Block &) const override { return is_injective; }
|
||||||
|
|
||||||
bool useDefaultImplementationForConstants() const override { return true; }
|
bool useDefaultImplementationForConstants() const override { return true; }
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInjective(const Block &) override
|
bool isInjective(const Block &) const override
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInjective(const Block &) override
|
bool isInjective(const Block &) const override
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ bool LLVMFunction::isSuitableForConstantFolding() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLVMFunction::isInjective(const Block & sample_block)
|
bool LLVMFunction::isInjective(const Block & sample_block) const
|
||||||
{
|
{
|
||||||
for (const auto & f : originals)
|
for (const auto & f : originals)
|
||||||
if (!f->isInjective(sample_block))
|
if (!f->isInjective(sample_block))
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
bool isSuitableForConstantFolding() const override;
|
bool isSuitableForConstantFolding() const override;
|
||||||
|
|
||||||
bool isInjective(const Block & sample_block) override;
|
bool isInjective(const Block & sample_block) const override;
|
||||||
|
|
||||||
bool hasInformationAboutMonotonicity() const override;
|
bool hasInformationAboutMonotonicity() const override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user