ClickHouse/src/DataStreams/TTLCalcInputStream.h

44 lines
1.0 KiB
C++
Raw Normal View History

2021-07-30 04:27:15 +00:00
#pragma once
2021-10-06 17:59:27 +00:00
#include <Processors/ISimpleTransform.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>
#include <DataStreams/ITTLAlgorithm.h>
2021-10-02 07:13:14 +00:00
#include <base/DateLUT.h>
2021-07-30 04:27:15 +00:00
namespace DB
{
2021-10-06 17:59:27 +00:00
class TTLCalcTransform : public ISimpleTransform
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-06 17:59:27 +00:00
void transform(Chunk & chunk) 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;
};
}