20 namespace foreign_storage {
23 const std::map<
ChunkKey, std::shared_ptr<ChunkMetadata>>& chunk_metadata_map,
24 const std::map<ChunkKey, AbstractBuffer*>& buffers,
36 if (column->columnType.is_varlen_indeed()) {
37 data_chunk_key.push_back(1);
38 ChunkKey index_chunk_key = chunk_key;
39 index_chunk_key.push_back(2);
41 CHECK(buffers.find(data_chunk_key) != buffers.end());
42 CHECK(buffers.find(index_chunk_key) != buffers.end());
44 data_buffer = buffers.find(data_chunk_key)->second;
45 index_buffer = buffers.find(index_chunk_key)->second;
46 CHECK_EQ(data_buffer->size(),
static_cast<size_t>(0));
49 size_t index_offset_size{0};
50 if (column->columnType.is_string() || column->columnType.is_geometry()) {
52 }
else if (column->columnType.is_array()) {
57 if (chunk_metadata_map.find(data_chunk_key) != chunk_metadata_map.end()) {
58 index_buffer->
reserve(index_offset_size *
59 (chunk_metadata_map.at(data_chunk_key)->numElements + 1));
62 data_chunk_key = chunk_key;
63 CHECK(buffers.find(data_chunk_key) != buffers.end());
64 data_buffer = buffers.find(data_chunk_key)->second;
66 if (chunk_metadata_map.find(data_chunk_key) != chunk_metadata_map.end()) {
67 data_buffer->
reserve(chunk_metadata_map.at(data_chunk_key)->numBytes);
78 size_t num_elements) {
84 chunk_metadata->numElements = num_elements;
87 chunk_metadata->numBytes = type.
get_size() * num_elements;
94 chunk_metadata->chunkStats.min = scalar_metadata->chunkStats.min;
95 chunk_metadata->chunkStats.max = scalar_metadata->chunkStats.max;
98 return chunk_metadata;
105 auto table = catalog->getForeignTable(tb_id);
void setPinnable(bool pinnable)
std::vector< int > ChunkKey
HOST DEVICE int get_size() const
bool is_system_table_chunk_key(const ChunkKey &chunk_key)
void setIndexBuffer(AbstractBuffer *ib)
bool is_append_table_chunk_key(const ChunkKey &chunk_key)
void initEncoder(const SQLTypeInfo &tmp_sql_type)
bool is_replicated_table_chunk_key(const ChunkKey &chunk_key)
void setBuffer(AbstractBuffer *b)
virtual void getMetadata(const std::shared_ptr< ChunkMetadata > &chunkMetadata)
This file contains the class specification and related data structures for Catalog.
bool key_does_not_shard_to_leaf(const ChunkKey &key)
std::shared_ptr< ChunkMetadata > get_placeholder_metadata(const SQLTypeInfo &type, size_t num_elements)
static SysCatalog & instance()
int get_fragment(const ChunkKey &key)
#define CHUNK_KEY_TABLE_IDX
void init_chunk_for_column(const ChunkKey &chunk_key, const std::map< ChunkKey, std::shared_ptr< ChunkMetadata >> &chunk_metadata_map, const std::map< ChunkKey, AbstractBuffer * > &buffers, Chunk_NS::Chunk &chunk)
An AbstractBuffer is a unit of data management for a data manager.
bool fragment_maps_to_leaf(const ChunkKey &key)
bool isAppendMode() const
Checks if the table is in append mode.
bool is_shardable_key(const ChunkKey &key)
const foreign_storage::ForeignTable & get_foreign_table_for_key(const ChunkKey &key)
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
int32_t g_distributed_leaf_idx
bool table_is_replicated(const TableDescriptor *td)
int32_t g_distributed_num_leaves
std::pair< int, int > get_table_prefix(const ChunkKey &key)
Encoder * getEncoder() const
void setColumnDesc(const ColumnDescriptor *cd)
bool is_varlen_indeed() const
#define CHUNK_KEY_COLUMN_IDX
SQLTypeInfo get_elem_type() const
virtual void reserve(size_t num_bytes)=0