#pragma once #include #include #include #include #include namespace DB { class IMergedBlockOutputStream : public IBlockOutputStream { public: IMergedBlockOutputStream( const MergeTreeDataPartPtr & data_part, const StorageMetadataPtr & metadata_snapshot_); using WrittenOffsetColumns = std::set; const MergeTreeIndexGranularity & getIndexGranularity() { return writer->getIndexGranularity(); } protected: using SerializationState = IDataType::SerializeBinaryBulkStatePtr; IDataType::OutputStreamGetter createStreamGetter(const String & name, WrittenOffsetColumns & offset_columns); /// Remove all columns marked expired in data_part. Also, clears checksums /// and columns array. Return set of removed files names. static NameSet removeEmptyColumnsFromPart( const MergeTreeDataPartPtr & data_part, NamesAndTypesList & columns, MergeTreeData::DataPart::Checksums & checksums); protected: const MergeTreeData & storage; StorageMetadataPtr metadata_snapshot; VolumePtr volume; String part_path; IMergeTreeDataPart::MergeTreeWriterPtr writer; }; }