mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
fix performance of short queries
This commit is contained in:
parent
e7322110a7
commit
79ea6a1c9c
@ -471,6 +471,7 @@ void IMergeTreeDataPart::setColumns(const NamesAndTypesList & new_columns, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
columns_description = ColumnsDescription(columns);
|
columns_description = ColumnsDescription(columns);
|
||||||
|
columns_description_with_collected_nested = ColumnsDescription(Nested::collect(columns));
|
||||||
}
|
}
|
||||||
|
|
||||||
NameAndTypePair IMergeTreeDataPart::getColumn(const String & column_name) const
|
NameAndTypePair IMergeTreeDataPart::getColumn(const String & column_name) const
|
||||||
|
@ -148,6 +148,7 @@ public:
|
|||||||
|
|
||||||
const NamesAndTypesList & getColumns() const { return columns; }
|
const NamesAndTypesList & getColumns() const { return columns; }
|
||||||
const ColumnsDescription & getColumnsDescription() const { return columns_description; }
|
const ColumnsDescription & getColumnsDescription() const { return columns_description; }
|
||||||
|
const ColumnsDescription & getColumnsDescriptionWithCollectedNested() const { return columns_description_with_collected_nested; }
|
||||||
|
|
||||||
NameAndTypePair getColumn(const String & name) const;
|
NameAndTypePair getColumn(const String & name) const;
|
||||||
std::optional<NameAndTypePair> tryGetColumn(const String & column_name) const;
|
std::optional<NameAndTypePair> tryGetColumn(const String & column_name) const;
|
||||||
@ -531,6 +532,10 @@ private:
|
|||||||
/// to columns by name and getting subcolumns.
|
/// to columns by name and getting subcolumns.
|
||||||
ColumnsDescription columns_description;
|
ColumnsDescription columns_description;
|
||||||
|
|
||||||
|
/// The same as above but after call of Nested::collect().
|
||||||
|
/// It is used while reading from wide parts.
|
||||||
|
ColumnsDescription columns_description_with_collected_nested;
|
||||||
|
|
||||||
/// Reads part unique identifier (if exists) from uuid.txt
|
/// Reads part unique identifier (if exists) from uuid.txt
|
||||||
void loadUUID();
|
void loadUUID();
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Interpreters/Context.h>
|
#include <Interpreters/Context.h>
|
||||||
#include <Storages/MergeTree/AlterConversions.h>
|
#include <Storages/MergeTree/AlterConversions.h>
|
||||||
|
#include <Storages/ColumnsDescription.h>
|
||||||
#include <Core/NamesAndTypes.h>
|
#include <Core/NamesAndTypes.h>
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
@ -41,6 +42,10 @@ public:
|
|||||||
|
|
||||||
virtual const NamesAndTypesList & getColumns() const = 0;
|
virtual const NamesAndTypesList & getColumns() const = 0;
|
||||||
|
|
||||||
|
virtual const ColumnsDescription & getColumnsDescription() const = 0;
|
||||||
|
|
||||||
|
virtual const ColumnsDescription & getColumnsDescriptionWithCollectedNested() const = 0;
|
||||||
|
|
||||||
virtual std::optional<size_t> getColumnPosition(const String & column_name) const = 0;
|
virtual std::optional<size_t> getColumnPosition(const String & column_name) const = 0;
|
||||||
|
|
||||||
virtual String getColumnNameWithMinimumCompressedSize(bool with_subcolumns) const = 0;
|
virtual String getColumnNameWithMinimumCompressedSize(bool with_subcolumns) const = 0;
|
||||||
|
@ -41,8 +41,12 @@ IMergeTreeReader::IMergeTreeReader(
|
|||||||
, alter_conversions(data_part_info_for_read->getAlterConversions())
|
, alter_conversions(data_part_info_for_read->getAlterConversions())
|
||||||
/// For wide parts convert plain arrays of Nested to subcolumns
|
/// For wide parts convert plain arrays of Nested to subcolumns
|
||||||
/// to allow to use shared offset column from cache.
|
/// to allow to use shared offset column from cache.
|
||||||
, requested_columns(data_part_info_for_read->isWidePart() ? Nested::convertToSubcolumns(columns_) : columns_)
|
, requested_columns(data_part_info_for_read->isWidePart()
|
||||||
, part_columns(data_part_info_for_read->isWidePart() ? Nested::collect(data_part_info_for_read->getColumns()) : data_part_info_for_read->getColumns())
|
? Nested::convertToSubcolumns(columns_)
|
||||||
|
: columns_)
|
||||||
|
, part_columns(data_part_info_for_read->isWidePart()
|
||||||
|
? data_part_info_for_read->getColumnsDescriptionWithCollectedNested()
|
||||||
|
: data_part_info_for_read->getColumnsDescription())
|
||||||
{
|
{
|
||||||
columns_to_read.reserve(requested_columns.size());
|
columns_to_read.reserve(requested_columns.size());
|
||||||
serializations.reserve(requested_columns.size());
|
serializations.reserve(requested_columns.size());
|
||||||
|
@ -104,7 +104,7 @@ private:
|
|||||||
NamesAndTypesList requested_columns;
|
NamesAndTypesList requested_columns;
|
||||||
|
|
||||||
/// Actual columns description in part.
|
/// Actual columns description in part.
|
||||||
ColumnsDescription part_columns;
|
const ColumnsDescription & part_columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,10 @@ public:
|
|||||||
|
|
||||||
const NamesAndTypesList & getColumns() const override { return data_part->getColumns(); }
|
const NamesAndTypesList & getColumns() const override { return data_part->getColumns(); }
|
||||||
|
|
||||||
|
const ColumnsDescription & getColumnsDescription() const override { return data_part->getColumnsDescription(); }
|
||||||
|
|
||||||
|
const ColumnsDescription & getColumnsDescriptionWithCollectedNested() const override { return data_part->getColumnsDescriptionWithCollectedNested(); }
|
||||||
|
|
||||||
std::optional<size_t> getColumnPosition(const String & column_name) const override { return data_part->getColumnPosition(column_name); }
|
std::optional<size_t> getColumnPosition(const String & column_name) const override { return data_part->getColumnPosition(column_name); }
|
||||||
|
|
||||||
AlterConversions getAlterConversions() const override { return data_part->storage.getAlterConversionsForPart(data_part); }
|
AlterConversions getAlterConversions() const override { return data_part->storage.getAlterConversionsForPart(data_part); }
|
||||||
|
Loading…
Reference in New Issue
Block a user