2021-06-09 02:03:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
|
|
|
|
|
|
|
#include <Storages/FileLog/ReadBufferFromFileLog.h>
|
|
|
|
#include <Storages/FileLog/StorageFileLog.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
class Logger;
|
|
|
|
}
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
class FileLogBlockInputStream : public IBlockInputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FileLogBlockInputStream(
|
|
|
|
StorageFileLog & storage_,
|
|
|
|
const StorageMetadataPtr & metadata_snapshot_,
|
|
|
|
const std::shared_ptr<Context> & context_,
|
|
|
|
const Names & columns,
|
|
|
|
size_t max_block_size_);
|
|
|
|
~FileLogBlockInputStream() override = default;
|
|
|
|
|
|
|
|
String getName() const override { return storage.getName(); }
|
|
|
|
Block getHeader() const override;
|
|
|
|
|
|
|
|
void readPrefixImpl() override;
|
|
|
|
Block readImpl() override;
|
|
|
|
void readSuffixImpl() override;
|
|
|
|
|
2021-07-04 06:16:40 +00:00
|
|
|
bool isStalled() { return !buffer || buffer->isStalled(); }
|
|
|
|
|
2021-06-09 02:03:36 +00:00
|
|
|
private:
|
|
|
|
StorageFileLog & storage;
|
|
|
|
StorageMetadataPtr metadata_snapshot;
|
|
|
|
ContextPtr context;
|
|
|
|
Names column_names;
|
|
|
|
UInt64 max_block_size;
|
|
|
|
|
|
|
|
ReadBufferFromFileLogPtr buffer;
|
|
|
|
|
|
|
|
const Block non_virtual_header;
|
|
|
|
const Block virtual_header;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|