return back result_size_hint

This commit is contained in:
Anton Popov 2022-02-15 15:12:25 +03:00
parent c18ab88706
commit 7cddae1351
2 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@ struct ConstantFilterDescription
struct IFilterDescription struct IFilterDescription
{ {
virtual ColumnPtr filter(const IColumn & column) const = 0; virtual ColumnPtr filter(const IColumn & column, ssize_t result_size_hint) const = 0;
virtual size_t countBytesInFilter() const = 0; virtual size_t countBytesInFilter() const = 0;
virtual ~IFilterDescription() = default; virtual ~IFilterDescription() = default;
}; };
@ -35,7 +35,7 @@ struct FilterDescription final : public IFilterDescription
explicit FilterDescription(const IColumn & column); explicit FilterDescription(const IColumn & column);
ColumnPtr filter(const IColumn & column) const override { return column.filter(*data, -1); } ColumnPtr filter(const IColumn & column, ssize_t result_size_hint) const override { return column.filter(*data, result_size_hint); }
size_t countBytesInFilter() const override { return DB::countBytesInFilter(*data); } size_t countBytesInFilter() const override { return DB::countBytesInFilter(*data); }
}; };
@ -44,7 +44,7 @@ struct SparseFilterDescription final : public IFilterDescription
const IColumn * filter_indices = nullptr; const IColumn * filter_indices = nullptr;
explicit SparseFilterDescription(const IColumn & column); explicit SparseFilterDescription(const IColumn & column);
ColumnPtr filter(const IColumn & column) const override { return column.index(*filter_indices, 0); } ColumnPtr filter(const IColumn & column, ssize_t) const override { return column.index(*filter_indices, 0); }
size_t countBytesInFilter() const override { return filter_indices->size(); } size_t countBytesInFilter() const override { return filter_indices->size(); }
}; };

View File

@ -161,7 +161,7 @@ void FilterTransform::transform(Chunk & chunk)
size_t num_filtered_rows = 0; size_t num_filtered_rows = 0;
if (first_non_constant_column != num_columns) if (first_non_constant_column != num_columns)
{ {
columns[first_non_constant_column] = filter_description->filter(*columns[first_non_constant_column]); columns[first_non_constant_column] = filter_description->filter(*columns[first_non_constant_column], -1);
num_filtered_rows = columns[first_non_constant_column]->size(); num_filtered_rows = columns[first_non_constant_column]->size();
} }
else else
@ -211,7 +211,7 @@ void FilterTransform::transform(Chunk & chunk)
if (isColumnConst(*current_column)) if (isColumnConst(*current_column))
current_column = current_column->cut(0, num_filtered_rows); current_column = current_column->cut(0, num_filtered_rows);
else else
current_column = filter_description->filter(*current_column); current_column = filter_description->filter(*current_column, num_filtered_rows);
} }
chunk.setColumns(std::move(columns), num_filtered_rows); chunk.setColumns(std::move(columns), num_filtered_rows);