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

53 lines
1.2 KiB
C++
Raw Normal View History

2020-04-28 19:52:22 +00:00
#pragma once
2021-07-28 11:09:17 +00:00
#if !defined(ARCADIA_BUILD)
# include "config_formats.h"
#endif
2020-05-03 01:01:05 +00:00
#if USE_ARROW
2020-04-28 19:52:22 +00:00
#include <Processors/Formats/IInputFormat.h>
#include <Formats/FormatSettings.h>
2020-04-28 19:52:22 +00:00
namespace arrow { class RecordBatchReader; }
2020-05-04 14:28:36 +00:00
namespace arrow::ipc { class RecordBatchFileReader; }
2020-04-28 19:52:22 +00:00
namespace DB
{
2020-05-02 19:35:58 +00:00
class ReadBuffer;
2021-06-02 08:51:07 +00:00
class ArrowColumnToCHColumn;
2020-05-02 19:35:58 +00:00
2020-05-02 19:34:34 +00:00
class ArrowBlockInputFormat : public IInputFormat
2020-04-28 19:52:22 +00:00
{
public:
ArrowBlockInputFormat(ReadBuffer & in_, const Block & header_, bool stream_, const FormatSettings & format_settings_);
2020-04-28 19:52:22 +00:00
void resetParser() override;
String getName() const override { return "ArrowBlockInputFormat"; }
protected:
Chunk generate() override;
private:
// Whether to use ArrowStream format
bool stream;
// This field is only used for ArrowStream format
std::shared_ptr<arrow::RecordBatchReader> stream_reader;
// The following fields are used only for Arrow format
2020-05-04 14:28:36 +00:00
std::shared_ptr<arrow::ipc::RecordBatchFileReader> file_reader;
2021-06-02 08:51:07 +00:00
std::unique_ptr<ArrowColumnToCHColumn> arrow_column_to_ch_column;
2020-05-04 14:28:36 +00:00
int record_batch_total = 0;
int record_batch_current = 0;
const FormatSettings format_settings;
void prepareReader();
2020-04-28 19:52:22 +00:00
};
}
2020-05-02 19:32:33 +00:00
#endif