2021-07-30 04:27:15 +00:00
|
|
|
#pragma once
|
2021-10-07 17:27:13 +00:00
|
|
|
#include <Processors/IAccumulatingTransform.h>
|
2021-07-30 04:27:15 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreeData.h>
|
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
|
|
|
#include <Core/Block.h>
|
|
|
|
#include <Storages/MergeTree/MergeTreeDataPartTTLInfo.h>
|
2021-10-15 10:11:57 +00:00
|
|
|
#include <Processors/TTL/ITTLAlgorithm.h>
|
2021-07-30 04:27:15 +00:00
|
|
|
|
2021-12-21 13:41:53 +00:00
|
|
|
#include <Common/DateLUT.h>
|
2021-07-30 04:27:15 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-10-07 17:27:13 +00:00
|
|
|
class TTLCalcTransform : public IAccumulatingTransform
|
2021-07-30 04:27:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-10-06 17:59:27 +00:00
|
|
|
TTLCalcTransform(
|
|
|
|
const Block & header_,
|
2021-07-30 04:27:15 +00:00
|
|
|
const MergeTreeData & storage_,
|
|
|
|
const StorageMetadataPtr & metadata_snapshot_,
|
|
|
|
const MergeTreeData::MutableDataPartPtr & data_part_,
|
|
|
|
time_t current_time,
|
|
|
|
bool force_
|
|
|
|
);
|
|
|
|
|
|
|
|
String getName() const override { return "TTL_CALC"; }
|
2021-10-06 17:59:27 +00:00
|
|
|
Status prepare() override;
|
2021-07-30 04:27:15 +00:00
|
|
|
|
|
|
|
protected:
|
2021-10-07 17:27:13 +00:00
|
|
|
void consume(Chunk chunk) override;
|
|
|
|
Chunk generate() override;
|
2021-07-30 04:27:15 +00:00
|
|
|
|
|
|
|
/// Finalizes ttl infos and updates data part
|
2021-10-06 17:59:27 +00:00
|
|
|
void finalize();
|
2021-07-30 04:27:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<TTLAlgorithmPtr> algorithms;
|
|
|
|
|
|
|
|
/// ttl_infos and empty_columns are updating while reading
|
|
|
|
const MergeTreeData::MutableDataPartPtr & data_part;
|
|
|
|
Poco::Logger * log;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|