mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
Fix for no_more_keys
This commit is contained in:
parent
1f5e209897
commit
aac5131859
@ -7,8 +7,8 @@ namespace DB
|
||||
/// Special struct that helps to convert bool variables to function template bool arguments.
|
||||
/// It can be used to avoid multiple nested if/else on bool arguments. How to use it:
|
||||
/// Imagine you have template function
|
||||
/// template <bool b1, bool b2, ..., bn> return_type foo(...);
|
||||
/// and bool variables b1, b2, ..., bool bn. To pass these variables as template for foo you can do the following:
|
||||
/// template <bool b1, bool b2, ..., bool bn> return_type foo(...);
|
||||
/// and bool variables b1, b2, ..., bn. To pass these variables as template for foo you can do the following:
|
||||
///
|
||||
/// auto call_foo = []<bool b1, bool b2, ..., bool bn>()
|
||||
/// {
|
||||
|
@ -1180,7 +1180,7 @@ void NO_INLINE Aggregator::executeImplBatch(
|
||||
/// - this affects only optimize_aggregation_in_order,
|
||||
/// - this is just a pointer, so it should not be significant,
|
||||
/// - and plus this will require other changes in the interface.
|
||||
std::unique_ptr<AggregateDataPtr[]> places(new AggregateDataPtr[row_end]);
|
||||
std::unique_ptr<AggregateDataPtr[]> places(new AggregateDataPtr[all_keys_are_const ? 1 : row_end]);
|
||||
|
||||
/// For all rows.
|
||||
size_t start, end;
|
||||
@ -1202,7 +1202,7 @@ void NO_INLINE Aggregator::executeImplBatch(
|
||||
|
||||
if constexpr (!no_more_keys)
|
||||
{
|
||||
if constexpr (prefetch && HasPrefetchMemberFunc<decltype(method.data), KeyHolder>)
|
||||
if constexpr (prefetch && !all_keys_are_const && HasPrefetchMemberFunc<decltype(method.data), KeyHolder>)
|
||||
{
|
||||
if (i == row_begin + prefetching.iterationsToMeasure())
|
||||
prefetch_look_ahead = prefetching.calcPrefetchLookAhead();
|
||||
@ -1267,9 +1267,17 @@ void NO_INLINE Aggregator::executeImplBatch(
|
||||
/// Add only if the key already exists.
|
||||
auto find_result = state.findKey(method.data, i, *aggregates_pool);
|
||||
if (find_result.isFound())
|
||||
{
|
||||
aggregate_data = find_result.getMapped();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// If all keys are constant and this is new key
|
||||
/// we don't need to do anything and just skip the whole block.
|
||||
if constexpr (all_keys_are_const)
|
||||
return;
|
||||
aggregate_data = overflow_row;
|
||||
}
|
||||
}
|
||||
|
||||
places[i] = aggregate_data;
|
||||
|
@ -965,13 +965,13 @@ public:
|
||||
{
|
||||
if (virtual_column.name == "_path")
|
||||
{
|
||||
chunk.addColumn(virtual_column.type->createColumnConst(num_rows, current_path)->convertToFullColumnIfConst());
|
||||
chunk.addColumn(virtual_column.type->createColumnConst(num_rows, current_path));
|
||||
}
|
||||
else if (virtual_column.name == "_file")
|
||||
{
|
||||
size_t last_slash_pos = current_path.find_last_of('/');
|
||||
auto file_name = current_path.substr(last_slash_pos + 1);
|
||||
chunk.addColumn(virtual_column.type->createColumnConst(num_rows, file_name)->convertToFullColumnIfConst());
|
||||
chunk.addColumn(virtual_column.type->createColumnConst(num_rows, file_name));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user