2019-02-21 18:36:46 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-08-02 16:00:24 +00:00
|
|
|
#include "config_formats.h"
|
2019-02-21 18:36:46 +00:00
|
|
|
#if USE_PARQUET
|
2019-08-02 16:00:24 +00:00
|
|
|
|
|
|
|
#include <Processors/Formats/IInputFormat.h>
|
2019-02-21 18:36:46 +00:00
|
|
|
|
2020-05-05 12:56:54 +00:00
|
|
|
namespace parquet::arrow { class FileReader; }
|
2019-02-21 18:36:46 +00:00
|
|
|
|
|
|
|
namespace arrow { class Buffer; }
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-05-05 12:56:54 +00:00
|
|
|
class ParquetBlockInputFormat : public IInputFormat
|
2019-02-21 18:36:46 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-25 19:17:41 +00:00
|
|
|
ParquetBlockInputFormat(ReadBuffer & in_, Block header_);
|
2019-02-21 18:36:46 +00:00
|
|
|
|
2019-11-26 23:46:19 +00:00
|
|
|
void resetParser() override;
|
|
|
|
|
2019-02-21 18:36:46 +00:00
|
|
|
String getName() const override { return "ParquetBlockInputFormat"; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Chunk generate() override;
|
|
|
|
|
2020-05-04 00:52:28 +00:00
|
|
|
private:
|
|
|
|
void prepareReader();
|
|
|
|
|
2019-02-21 18:36:46 +00:00
|
|
|
private:
|
|
|
|
std::unique_ptr<parquet::arrow::FileReader> file_reader;
|
|
|
|
int row_group_total = 0;
|
2020-02-23 06:04:58 +00:00
|
|
|
// indices of columns to read from Parquet file
|
|
|
|
std::vector<int> column_indices;
|
2019-02-21 18:36:46 +00:00
|
|
|
int row_group_current = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|