#pragma once #include #include #include #include #include #include #include namespace DB { class TTLCalcTransform : public IAccumulatingTransform { public: TTLCalcTransform( const ContextPtr & context, const Block & header_, const MergeTreeData & storage_, const StorageMetadataPtr & metadata_snapshot_, const MergeTreeData::MutableDataPartPtr & data_part_, time_t current_time, bool force_ ); PreparedSets::Subqueries getSubqueries() { return std::move(subqueries_for_sets); } String getName() const override { return "TTL_CALC"; } Status prepare() override; protected: void consume(Chunk chunk) override; Chunk generate() override; /// Finalizes ttl infos and updates data part void finalize(); private: std::vector algorithms; PreparedSets::Subqueries subqueries_for_sets; /// ttl_infos and empty_columns are updating while reading const MergeTreeData::MutableDataPartPtr & data_part; LoggerPtr log; }; }