mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
dbms: Cleanup [#METR-19266]
This commit is contained in:
parent
2e15882f5d
commit
e38d29346e
@ -78,8 +78,6 @@ public:
|
||||
const ColumnWithTypeAndName & getByName(const std::string & name) const;
|
||||
|
||||
bool has(const std::string & name) const;
|
||||
bool hasNullColumns(const ColumnNumbers & arguments) const;
|
||||
bool hasNullableColumns(const ColumnNumbers & arguments) const;
|
||||
|
||||
size_t getPositionByName(const std::string & name) const;
|
||||
|
||||
|
@ -249,30 +249,6 @@ bool Block::has(const std::string & name) const
|
||||
}
|
||||
|
||||
|
||||
bool Block::hasNullColumns(const ColumnNumbers & arguments) const
|
||||
{
|
||||
for (const auto & arg : arguments)
|
||||
{
|
||||
const auto & elem = unsafeGetByPosition(arg);
|
||||
if (elem.column && elem.column.get()->isNull())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Block::hasNullableColumns(const ColumnNumbers & arguments) const
|
||||
{
|
||||
for (const auto & arg : arguments)
|
||||
{
|
||||
const auto & elem = unsafeGetByPosition(arg);
|
||||
if (elem.column && elem.column.get()->isNullable())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
size_t Block::getPositionByName(const std::string & name) const
|
||||
{
|
||||
IndexByName_t::const_iterator it = index_by_name.find(name);
|
||||
|
@ -29,6 +29,17 @@ void createNullValuesByteMap(Block & block, size_t result)
|
||||
}
|
||||
}
|
||||
|
||||
bool hasNullColumns(const Block & block, const ColumnNumbers & arguments) const
|
||||
{
|
||||
for (const auto & arg : arguments)
|
||||
{
|
||||
const auto & elem = block.unsafeGetByPosition(arg);
|
||||
if (elem.column && elem.column.get()->isNull())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasNullColumns(const ColumnsWithTypeAndName & args)
|
||||
{
|
||||
for (const auto & arg : args)
|
||||
@ -51,6 +62,17 @@ bool hasNullColumns(const DataTypes & args)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasNullableColumns(const Block & block, const ColumnNumbers & arguments) const
|
||||
{
|
||||
for (const auto & arg : arguments)
|
||||
{
|
||||
const auto & elem = block.unsafeGetByPosition(arg);
|
||||
if (elem.column && elem.column.get()->isNullable())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasNullableColumns(const ColumnsWithTypeAndName & args)
|
||||
{
|
||||
for (const auto & arg : args)
|
||||
@ -170,14 +192,14 @@ void IFunction::getLambdaArgumentTypes(DataTypes & arguments) const
|
||||
|
||||
void IFunction::execute(Block & block, const ColumnNumbers & arguments, size_t result)
|
||||
{
|
||||
if (!hasSpecialSupportForNulls() && block.hasNullColumns(arguments))
|
||||
if (!hasSpecialSupportForNulls() && hasNullColumns(block, arguments))
|
||||
{
|
||||
ColumnWithTypeAndName & dest_col = block.getByPosition(result);
|
||||
dest_col.column = std::make_shared<ColumnNull>(block.rowsInFirstColumn(), Null());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasSpecialSupportForNulls() && block.hasNullableColumns(arguments))
|
||||
if (!hasSpecialSupportForNulls() && hasNullableColumns(block, arguments))
|
||||
{
|
||||
Block non_nullable_block = block.extractNonNullableBlock(arguments);
|
||||
executeImpl(non_nullable_block, arguments, result);
|
||||
@ -192,14 +214,14 @@ void IFunction::execute(Block & block, const ColumnNumbers & arguments, size_t r
|
||||
|
||||
void IFunction::execute(Block & block, const ColumnNumbers & arguments, const ColumnNumbers & prerequisites, size_t result)
|
||||
{
|
||||
if (!hasSpecialSupportForNulls() && block.hasNullColumns(arguments))
|
||||
if (!hasSpecialSupportForNulls() && hasNullColumns(block, arguments))
|
||||
{
|
||||
ColumnWithTypeAndName & dest_col = block.getByPosition(result);
|
||||
dest_col.column = std::make_shared<ColumnNull>(block.rowsInFirstColumn(), Null());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasSpecialSupportForNulls() && block.hasNullableColumns(arguments))
|
||||
if (!hasSpecialSupportForNulls() && hasNullableColumns(block, arguments))
|
||||
{
|
||||
Block non_nullable_block = block.extractNonNullableBlock(arguments);
|
||||
executeImpl(non_nullable_block, arguments, prerequisites, result);
|
||||
|
Loading…
Reference in New Issue
Block a user