ClickHouse/src/Processors/Formats/Impl/ArrowBlockOutputFormat.h

34 lines
822 B
C++
Raw Normal View History

2020-05-03 02:46:36 +00:00
#pragma once
#include "config_formats.h"
#if USE_ARROW
#include <Formats/FormatSettings.h>
#include <Processors/Formats/IOutputFormat.h>
2020-05-03 18:12:14 +00:00
#include "ArrowBufferedStreams.h"
2020-05-03 02:46:36 +00:00
namespace arrow::ipc { class RecordBatchWriter; }
namespace DB
{
class ArrowBlockOutputFormat : public IOutputFormat
{
public:
ArrowBlockOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings_);
String getName() const override { return "ArrowBlockOutputFormat"; }
void consume(Chunk) override;
void finalize() override;
String getContentType() const override { return "application/octet-stream"; }
private:
const FormatSettings format_settings;
2020-05-03 18:12:14 +00:00
std::shared_ptr<ArrowBufferedOutputStream> arrow_ostream;
2020-05-03 02:46:36 +00:00
std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
};
}
#endif