ClickHouse/src/Storages/MergeTree/MergeTreeDataPartInMemory.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.8 KiB
C++
Raw Normal View History

2020-04-14 19:47:19 +00:00
#pragma once
#include <Storages/MergeTree/IMergeTreeDataPart.h>
namespace DB
{
2020-07-09 01:00:16 +00:00
class UncompressedCache;
2020-04-14 19:47:19 +00:00
class MergeTreeDataPartInMemory : public IMergeTreeDataPart
{
public:
MergeTreeDataPartInMemory(
const MergeTreeData & storage_,
const String & name_,
const MergeTreePartInfo & info_,
2022-04-07 17:44:49 +00:00
const DataPartStoragePtr & data_part_storage_,
const IMergeTreeDataPart * parent_part_ = nullptr);
2020-04-14 19:47:19 +00:00
MergeTreeDataPartInMemory(
MergeTreeData & storage_,
const String & name_,
2022-04-07 17:44:49 +00:00
const DataPartStoragePtr & data_part_storage_,
const IMergeTreeDataPart * parent_part_ = nullptr);
2020-04-14 19:47:19 +00:00
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;
2020-10-23 17:57:17 +00:00
2020-04-14 19:47:19 +00:00
MergeTreeWriterPtr getWriter(
2022-04-19 19:34:41 +00:00
DataPartStorageBuilderPtr data_part_storage_builder_,
2020-04-14 19:47:19 +00:00
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; }
bool isStoredOnRemoteDisk() const override { return false; }
bool isStoredOnRemoteDiskWithZeroCopySupport() const override { return false; }
2021-11-02 17:44:15 +00:00
bool hasColumnFiles(const NameAndTypePair & column) const override { return !!getColumnPosition(column.getNameInStorage()); }
2020-04-14 19:47:19 +00:00
String getFileNameForColumn(const NameAndTypePair & /* column */) const override { return ""; }
2022-06-27 19:41:29 +00:00
void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists, DataPartStorageBuilderPtr) 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
2022-04-19 19:34:41 +00:00
DataPartStoragePtr flushToDisk(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;
2022-04-19 19:34:41 +00:00
mutable DataPartStorageBuilderPtr data_part_storage_builder;
2020-04-14 19:47:19 +00:00
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
}