ClickHouse/dbms/Storages/MergeTree/MergeTreeDataPartWide.h

69 lines
2.5 KiB
C++
Raw Normal View History

2019-10-10 16:30:30 +00:00
#pragma once
#include <Storages/MergeTree/IMergeTreeDataPart.h>
namespace DB
{
2020-02-19 14:07:36 +00:00
/** In wide format data of each column is stored in one or several (for complex types) files.
* Every data file is followed by marks file.
* Can be used in tables with both adaptive and non-adaptive granularity.
* This is the regular format of parts for MergeTree and suitable for big parts, as it's the most efficient.
* Data part would be created in wide format if it's uncompressed size in bytes or number of rows would exceed
* thresholds `min_bytes_for_wide_part` and `min_rows_for_wide_part`.
*/
2019-10-10 16:30:30 +00:00
class MergeTreeDataPartWide : public IMergeTreeDataPart
{
public:
MergeTreeDataPartWide(
2019-10-10 16:30:30 +00:00
const MergeTreeData & storage_,
const String & name_,
const MergeTreePartInfo & info_,
2019-12-19 13:10:57 +00:00
const DiskPtr & disk,
2019-10-10 16:30:30 +00:00
const std::optional<String> & relative_path = {});
MergeTreeDataPartWide(
MergeTreeData & storage_,
const String & name_,
2019-12-19 13:10:57 +00:00
const DiskPtr & disk,
2019-10-10 16:30:30 +00:00
const std::optional<String> & relative_path = {});
MergeTreeReaderPtr getReader(
const NamesAndTypesList & columns,
const MarkRanges & mark_ranges,
UncompressedCache * uncompressed_cache,
MarkCache * mark_cache,
const MergeTreeReaderSettings & reader_settings_,
2020-03-18 03:27:32 +00:00
const ValueSizeMap & avg_value_size_hints,
const ReadBufferFromFileBase::ProfileCallback & profile_callback) const override;
2019-10-10 16:30:30 +00:00
2019-10-21 15:33:59 +00:00
MergeTreeWriterPtr getWriter(
const NamesAndTypesList & columns_list,
2019-11-05 11:53:22 +00:00
const std::vector<MergeTreeIndexPtr> & indices_to_recalc,
2019-10-21 15:33:59 +00:00
const CompressionCodecPtr & default_codec_,
const MergeTreeWriterSettings & writer_settings,
2020-03-18 03:27:32 +00:00
const MergeTreeIndexGranularity & computed_index_granularity) const override;
2019-10-21 15:33:59 +00:00
2019-10-10 16:30:30 +00:00
bool isStoredOnDisk() const override { return true; }
bool supportsVerticalMerge() const override { return true; }
2019-12-19 13:10:57 +00:00
String getFileNameForColumn(const NameAndTypePair & column) const override;
2019-11-18 12:22:27 +00:00
~MergeTreeDataPartWide() override;
bool hasColumnFiles(const String & column, const IDataType & type) const override;
2019-12-09 21:21:17 +00:00
2020-01-16 16:15:01 +00:00
private:
2019-11-18 15:18:50 +00:00
void checkConsistency(bool require_part_metadata) const override;
2019-10-10 16:30:30 +00:00
/// Loads marks index granularity into memory
2019-10-31 14:44:17 +00:00
void loadIndexGranularity() override;
2019-10-10 16:30:30 +00:00
ColumnSize getColumnSizeImpl(const String & name, const IDataType & type, std::unordered_set<String> * processed_substreams) const;
2020-03-23 12:19:43 +00:00
void calculateEachColumnSizesOnDisk(ColumnSizeByName & each_columns_size, ColumnSize & total_size) const override;
2019-10-10 16:30:30 +00:00
};
}