ClickHouse/src/Storages/MergeTree/MergeTreeDataPartInMemory.h

65 lines
2.5 KiB
C++
Raw Normal View History

2020-04-14 19:47:19 +00:00
#pragma once
#include <Storages/MergeTree/IMergeTreeDataPart.h>
namespace DB
{
class MergeTreeDataPartInMemory : public IMergeTreeDataPart
{
public:
MergeTreeDataPartInMemory(
const MergeTreeData & storage_,
const String & name_,
const MergeTreePartInfo & info_,
const VolumePtr & volume_,
2020-04-14 19:47:19 +00:00
const std::optional<String> & relative_path_ = {});
MergeTreeDataPartInMemory(
MergeTreeData & storage_,
const String & name_,
const VolumePtr & volume_,
2020-04-14 19:47:19 +00:00
const std::optional<String> & relative_path_ = {});
MergeTreeReaderPtr getReader(
const NamesAndTypesList & columns,
2020-06-26 11:30:23 +00:00
const StorageMetadataPtr & metadata_snapshot,
2020-04-14 19:47:19 +00:00
const MarkRanges & mark_ranges,
UncompressedCache * uncompressed_cache,
MarkCache * mark_cache,
const MergeTreeReaderSettings & reader_settings_,
const ValueSizeMap & avg_value_size_hints,
const ReadBufferFromFileBase::ProfileCallback & profile_callback) const override;
MergeTreeWriterPtr getWriter(
const NamesAndTypesList & columns_list,
2020-06-26 11:30:23 +00:00
const StorageMetadataPtr & metadata_snapshot,
2020-04-14 19:47:19 +00:00
const std::vector<MergeTreeIndexPtr> & indices_to_recalc,
const CompressionCodecPtr & default_codec_,
const MergeTreeWriterSettings & writer_settings,
const MergeTreeIndexGranularity & computed_index_granularity) const override;
bool isStoredOnDisk() const override { return false; }
2020-05-28 23:59:13 +00:00
bool hasColumnFiles(const String & column_name, const IDataType & /* type */) const override { return !!getColumnPosition(column_name); }
2020-04-14 19:47:19 +00:00
String getFileNameForColumn(const NameAndTypePair & /* column */) const override { return ""; }
2020-06-03 18:59:18 +00:00
void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists) const override;
2020-06-26 11:30:23 +00:00
void makeCloneInDetached(const String & prefix, const StorageMetadataPtr & metadata_snapshot) const override;
2020-04-14 19:47:19 +00:00
2020-06-26 11:30:23 +00:00
void flushToDisk(const String & base_path, const String & new_relative_path, const StorageMetadataPtr & metadata_snapshot) const;
2020-05-29 16:58:08 +00:00
/// Returns hash of parts's block
Checksum calculateBlockChecksum() const;
2020-04-14 19:47:19 +00:00
mutable Block block;
private:
mutable std::condition_variable is_merged;
2020-06-29 20:36:18 +00:00
/// Calculates uncompressed sizes in memory.
void calculateEachColumnSizes(ColumnSizeByName & each_columns_size, ColumnSize & total_size) const override;
2020-04-14 19:47:19 +00:00
};
using DataPartInMemoryPtr = std::shared_ptr<const MergeTreeDataPartInMemory>;
2020-06-05 20:47:46 +00:00
DataPartInMemoryPtr asInMemoryPart(const MergeTreeDataPartPtr & part);
2020-04-14 19:47:19 +00:00
}