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

45 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
2021-07-24 11:38:42 +00:00
2021-07-28 11:09:17 +00:00
#if !defined(ARCADIA_BUILD)
# include "config_formats.h"
#endif
2019-08-21 14:19:47 +00:00
2020-04-28 19:52:22 +00:00
#if USE_ARROW || USE_ORC || USE_PARQUET
2019-08-21 14:19:47 +00:00
#include <DataTypes/IDataType.h>
#include <Core/ColumnWithTypeAndName.h>
2019-08-21 14:19:47 +00:00
#include <arrow/table.h>
2021-07-24 11:38:42 +00:00
2019-08-21 14:19:47 +00:00
namespace DB
{
2021-07-24 11:38:42 +00:00
class Block;
class Chunk;
2021-06-07 15:15:58 +00:00
class ArrowColumnToCHColumn
{
public:
ArrowColumnToCHColumn(const Block & header_, const std::string & format_name_, bool import_nested_);
2021-08-05 15:09:48 +00:00
/// Constructor that create header by arrow schema. It will be useful for inserting
/// data from file without knowing table structure.
2021-08-05 15:09:48 +00:00
/// ArrowColumnToCHColumn(const arrow::Schema & schema, const std::string & format_name, bool import_nested_);
2021-06-07 15:15:58 +00:00
void arrowTableToCHChunk(Chunk & res, std::shared_ptr<arrow::Table> & table);
2019-08-21 14:19:47 +00:00
2021-06-07 15:15:58 +00:00
private:
const Block & header;
const std::string format_name;
bool import_nested;
2021-08-05 15:09:48 +00:00
2021-06-07 15:15:58 +00:00
/// Map {column name : dictionary column}.
/// To avoid converting dictionary from Arrow Dictionary
/// to LowCardinality every chunk we save it and reuse.
std::unordered_map<std::string, std::shared_ptr<ColumnWithTypeAndName>> dictionary_values;
2021-06-07 15:15:58 +00:00
};
2021-07-24 11:38:42 +00:00
2019-08-21 14:19:47 +00:00
}
2021-07-24 11:38:42 +00:00
2019-08-21 14:19:47 +00:00
#endif