mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Merge branch 'master' of github.com:yandex/ClickHouse
This commit is contained in:
commit
2e870f62e4
@ -4,7 +4,7 @@
|
|||||||
* Fixed the possibility of hanging queries when server is overloaded. [#6301](https://github.com/yandex/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
* Fixed the possibility of hanging queries when server is overloaded. [#6301](https://github.com/yandex/ClickHouse/pull/6301) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||||
* Fix FPE in yandexConsistentHash function. This fixes [#6304](https://github.com/yandex/ClickHouse/issues/6304). [#6126](https://github.com/yandex/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
* Fix FPE in yandexConsistentHash function. This fixes [#6304](https://github.com/yandex/ClickHouse/issues/6304). [#6126](https://github.com/yandex/ClickHouse/pull/6126) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||||
* Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [#6257](https://github.com/yandex/ClickHouse/issues/6257). [#6281](https://github.com/yandex/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai))
|
* Fixed bug in conversion of `LowCardinality` types in `AggregateFunctionFactory`. This fixes [#6257](https://github.com/yandex/ClickHouse/issues/6257). [#6281](https://github.com/yandex/ClickHouse/pull/6281) ([Nikolai Kochetov](https://github.com/KochetovNicolai))
|
||||||
* Fix parsing of `bool` settings from `true` and `false` strings. [#6278](https://github.com/yandex/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin))
|
* Fix parsing of `bool` settings from `true` and `false` strings in configuration files. [#6278](https://github.com/yandex/ClickHouse/pull/6278) ([alesapin](https://github.com/alesapin))
|
||||||
* Fix rare bug with incompatible stream headers in queries to `Distributed` table over `MergeTree` table when part of `WHERE` moves to `PREWHERE`. [#6236](https://github.com/yandex/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin))
|
* Fix rare bug with incompatible stream headers in queries to `Distributed` table over `MergeTree` table when part of `WHERE` moves to `PREWHERE`. [#6236](https://github.com/yandex/ClickHouse/pull/6236) ([alesapin](https://github.com/alesapin))
|
||||||
* Fixed overflow in integer division of signed type to unsigned type. This fixes [#6214](https://github.com/yandex/ClickHouse/issues/6214). [#6233](https://github.com/yandex/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
* Fixed overflow in integer division of signed type to unsigned type. This fixes [#6214](https://github.com/yandex/ClickHouse/issues/6214). [#6233](https://github.com/yandex/ClickHouse/pull/6233) ([alexey-milovidov](https://github.com/alexey-milovidov))
|
||||||
|
|
||||||
|
@ -1040,23 +1040,35 @@ void ExpressionAnalyzer::collectUsedColumns()
|
|||||||
/// You need to read at least one column to find the number of rows.
|
/// You need to read at least one column to find the number of rows.
|
||||||
if (select_query && required.empty())
|
if (select_query && required.empty())
|
||||||
{
|
{
|
||||||
/// We will find a column with minimum compressed size. Because it is the column that is cheapest to read.
|
/// We will find a column with minimum <compressed_size, type_size, uncompressed_size>.
|
||||||
size_t min_data_compressed = 0;
|
/// Because it is the column that is cheapest to read.
|
||||||
String min_column_name;
|
struct ColumnSizeTuple
|
||||||
|
{
|
||||||
|
size_t compressed_size;
|
||||||
|
size_t type_size;
|
||||||
|
size_t uncompressed_size;
|
||||||
|
String name;
|
||||||
|
bool operator<(const ColumnSizeTuple & that) const
|
||||||
|
{
|
||||||
|
return std::tie(compressed_size, type_size, uncompressed_size)
|
||||||
|
< std::tie(that.compressed_size, that.type_size, that.uncompressed_size);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::vector<ColumnSizeTuple> columns;
|
||||||
if (storage)
|
if (storage)
|
||||||
{
|
{
|
||||||
auto column_sizes = storage->getColumnSizes();
|
auto column_sizes = storage->getColumnSizes();
|
||||||
for (auto & [column_name, column_size] : column_sizes)
|
for (auto & source_column : source_columns)
|
||||||
{
|
{
|
||||||
if (min_data_compressed == 0 || min_data_compressed > column_size.data_compressed)
|
auto c = column_sizes.find(source_column.name);
|
||||||
{
|
if (c == column_sizes.end())
|
||||||
min_data_compressed = column_size.data_compressed;
|
continue;
|
||||||
min_column_name = column_name;
|
size_t type_size = source_column.type->haveMaximumSizeOfValue() ? source_column.type->getMaximumSizeOfValueInMemory() : 100;
|
||||||
|
columns.emplace_back(ColumnSizeTuple{c->second.data_compressed, type_size, c->second.data_uncompressed, source_column.name});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (columns.size())
|
||||||
if (min_data_compressed > 0)
|
required.insert(std::min_element(columns.begin(), columns.end())->name);
|
||||||
required.insert(min_column_name);
|
|
||||||
else
|
else
|
||||||
/// If we have no information about columns sizes, choose a column of minimum size of its data type.
|
/// If we have no information about columns sizes, choose a column of minimum size of its data type.
|
||||||
required.insert(ExpressionActions::getSmallestColumn(source_columns));
|
required.insert(ExpressionActions::getSmallestColumn(source_columns));
|
||||||
|
Loading…
Reference in New Issue
Block a user