mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #57183 from bigo-sg/opt_array_join
Trivial improvement on array join
This commit is contained in:
commit
335e7bf7ef
@ -206,10 +206,19 @@ Block ArrayJoinResultIterator::next()
|
|||||||
bool is_left = array_join->is_left;
|
bool is_left = array_join->is_left;
|
||||||
auto cut_any_col = any_array->cut(current_row, next_row - current_row);
|
auto cut_any_col = any_array->cut(current_row, next_row - current_row);
|
||||||
const auto * cut_any_array = typeid_cast<const ColumnArray *>(cut_any_col.get());
|
const auto * cut_any_array = typeid_cast<const ColumnArray *>(cut_any_col.get());
|
||||||
|
|
||||||
for (size_t i = 0; i < num_columns; ++i)
|
for (size_t i = 0; i < num_columns; ++i)
|
||||||
{
|
{
|
||||||
ColumnWithTypeAndName current = block.safeGetByPosition(i);
|
ColumnWithTypeAndName current = block.safeGetByPosition(i);
|
||||||
current.column = current.column->cut(current_row, next_row - current_row);
|
|
||||||
|
/// Reuse cut_any_col if possible to avoid unnecessary cut.
|
||||||
|
if (!is_unaligned && !is_left && current.name == *columns.begin())
|
||||||
|
{
|
||||||
|
current.column = cut_any_col;
|
||||||
|
current.type = getArrayJoinDataType(current.type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
current.column = current.column->cut(current_row, next_row - current_row);
|
||||||
|
|
||||||
if (columns.contains(current.name))
|
if (columns.contains(current.name))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user