2022-11-18 20:09:20 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Processors/ISource.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IMergeTreeSelectAlgorithm;
|
|
|
|
using MergeTreeSelectAlgorithmPtr = std::unique_ptr<IMergeTreeSelectAlgorithm>;
|
|
|
|
|
|
|
|
struct ChunkAndProgress;
|
|
|
|
|
|
|
|
class MergeTreeSource final : public ISource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit MergeTreeSource(MergeTreeSelectAlgorithmPtr algorithm_);
|
|
|
|
~MergeTreeSource() override;
|
|
|
|
|
|
|
|
std::string getName() const override;
|
|
|
|
|
|
|
|
Status prepare() override;
|
2022-11-22 11:24:24 +00:00
|
|
|
|
|
|
|
#if defined(OS_LINUX)
|
2022-11-18 20:09:20 +00:00
|
|
|
int schedule() override;
|
2022-11-22 11:24:24 +00:00
|
|
|
#endif
|
2022-11-18 20:09:20 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
std::optional<Chunk> tryGenerate() override;
|
|
|
|
|
|
|
|
void onCancel() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
MergeTreeSelectAlgorithmPtr algorithm;
|
|
|
|
|
2022-11-22 11:24:24 +00:00
|
|
|
#if defined(OS_LINUX)
|
2022-11-18 20:09:20 +00:00
|
|
|
struct AsyncReadingState;
|
|
|
|
std::unique_ptr<AsyncReadingState> async_reading_state;
|
2022-11-22 11:24:24 +00:00
|
|
|
#endif
|
2022-11-18 20:09:20 +00:00
|
|
|
|
|
|
|
std::optional<Chunk> reportProgress(ChunkAndProgress chunk);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|