Add const qualifier for IFunction::isInjective()

This commit is contained in:
Azat Khuzhin 2020-04-17 01:23:31 +03:00
parent fa62be250f
commit f29e5c60a5
15 changed files with 31 additions and 31 deletions

View File

@ -35,7 +35,7 @@ public:
return 1;
}
bool isInjective(const Block &) override
bool isInjective(const Block &) const override
{
return is_injective;
}

View File

@ -112,7 +112,7 @@ public:
}
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; }

View File

@ -72,7 +72,7 @@ public:
String getName() const override { return name; }
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
{
@ -326,7 +326,7 @@ public:
}
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
{
@ -447,7 +447,7 @@ public:
String getName() const override { return name; }
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
{
@ -546,7 +546,7 @@ public:
}
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
{
@ -739,7 +739,7 @@ public:
}
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
{
@ -837,7 +837,7 @@ public:
}
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
{
@ -941,7 +941,7 @@ public:
}
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
{
@ -1224,7 +1224,7 @@ public:
}
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
{
@ -1313,7 +1313,7 @@ public:
}
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; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
@ -1408,7 +1408,7 @@ public:
}
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
{

View File

@ -913,7 +913,7 @@ public:
bool isVariadic() const override { return true; }
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
{
@ -1268,7 +1268,7 @@ public:
}
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
{

View File

@ -589,7 +589,7 @@ public:
/// 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.
bool isInjective(const Block &) override { return true; }
bool isInjective(const Block &) const override { return true; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
{

View File

@ -241,7 +241,7 @@ private:
bool useDefaultImplementationForConstants() const final { return true; }
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);
}
@ -763,7 +763,7 @@ private:
bool useDefaultImplementationForConstants() const final { return true; }
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);
}
@ -1328,7 +1328,7 @@ private:
bool useDefaultImplementationForConstants() const final { return true; }
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);
}
@ -1476,7 +1476,7 @@ private:
bool useDefaultImplementationForConstants() const final { return true; }
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);
}
@ -1617,7 +1617,7 @@ public:
private:
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; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const final { return {0}; }

View File

@ -42,7 +42,7 @@ public:
}
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
{

View File

@ -131,7 +131,7 @@ public:
*
* 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.
* Most of functions are deterministic. Notable counterexample is rand().

View File

@ -68,7 +68,7 @@ public:
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 isDeterministicInScopeOfQuery() const final { return impl->isDeterministicInScopeOfQuery(); }
bool hasInformationAboutMonotonicity() const final { return impl->hasInformationAboutMonotonicity(); }
@ -195,7 +195,7 @@ public:
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(); }

View File

@ -107,7 +107,7 @@ public:
virtual bool isSuitableForConstantFolding() const { return true; }
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 isDeterministicInScopeOfQuery() const { return true; }
virtual bool hasInformationAboutMonotonicity() const { return false; }
@ -256,7 +256,7 @@ public:
/// Properties from IFunctionBase (see IFunction.h)
virtual bool isSuitableForConstantFolding() const { return true; }
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 isDeterministicInScopeOfQuery() const { return true; }
virtual bool isStateful() const { return false; }

View File

@ -41,7 +41,7 @@ public:
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; }

View File

@ -71,7 +71,7 @@ public:
return 1;
}
bool isInjective(const Block &) override
bool isInjective(const Block &) const override
{
return true;
}

View File

@ -43,7 +43,7 @@ public:
return 0;
}
bool isInjective(const Block &) override
bool isInjective(const Block &) const override
{
return true;
}

View File

@ -510,7 +510,7 @@ bool LLVMFunction::isSuitableForConstantFolding() const
return true;
}
bool LLVMFunction::isInjective(const Block & sample_block)
bool LLVMFunction::isInjective(const Block & sample_block) const
{
for (const auto & f : originals)
if (!f->isInjective(sample_block))

View File

@ -51,7 +51,7 @@ public:
bool isSuitableForConstantFolding() const override;
bool isInjective(const Block & sample_block) override;
bool isInjective(const Block & sample_block) const override;
bool hasInformationAboutMonotonicity() const override;