Merge pull request #39812 from guowangy/applyFunction-multi-thread

KeyCondition: optimize applyFunction in multi-thread scenario
This commit is contained in:
Nikolay Degterinsky 2022-08-04 01:36:47 +02:00 committed by GitHub
commit 71cb055ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -607,9 +607,9 @@ static FieldRef applyFunction(const FunctionBasePtr & func, const DataTypePtr &
result_idx = i;
}
ColumnsWithTypeAndName args{(*columns)[field.column_idx]};
if (result_idx == columns->size())
{
ColumnsWithTypeAndName args{(*columns)[field.column_idx]};
field.columns->emplace_back(ColumnWithTypeAndName {nullptr, func->getResultType(), result_name});
(*columns)[result_idx].column = func->execute(args, (*columns)[result_idx].type, columns->front().column->size());
}