Class import_export::Loader

class Loader

Subclassed by DistributedLoader

Public Functions

Loader(Catalog_Namespace::Catalog &c, const TableDescriptor *t, LoadCallbackType load_callback = nullptr)
virtual ~Loader()
Catalog_Namespace::Catalog &getCatalog() const
const TableDescriptor *getTableDesc() const
const std::list<const ColumnDescriptor *> &get_column_descs() const
StringDictionary *getStringDict(const ColumnDescriptor *cd) const
bool load(const std::vector<std::unique_ptr<TypedImportBuffer>> &import_buffers, const size_t row_count, const Catalog_Namespace::SessionInfo *session_info)
bool loadNoCheckpoint(const std::vector<std::unique_ptr<TypedImportBuffer>> &import_buffers, const size_t row_count, const Catalog_Namespace::SessionInfo *session_info)
void checkpoint()
std::vector<Catalog_Namespace::TableEpochInfo> getTableEpochs() const
void setTableEpochs(const std::vector<Catalog_Namespace::TableEpochInfo> &table_epochs)
void setAddingColumns(const bool adding_columns)
bool isAddingColumns() const
void dropColumns(const std::vector<int> &columns)
std::string getErrorMessage()

Protected Types

using OneShardBuffers = std::vector<std::unique_ptr<TypedImportBuffer>>

Protected Functions

void init()
bool loadImpl(const std::vector<std::unique_ptr<TypedImportBuffer>> &import_buffers, size_t row_count, bool checkpoint, const Catalog_Namespace::SessionInfo *session_info)
void distributeToShards(std::vector<OneShardBuffers> &all_shard_import_buffers, std::vector<size_t> &all_shard_row_counts, const OneShardBuffers &import_buffers, const size_t row_count, const size_t shard_count, const Catalog_Namespace::SessionInfo *session_info)

Protected Attributes

Catalog_Namespace::Catalog &catalog_
const TableDescriptor *table_desc_
std::list<const ColumnDescriptor *> column_descs_
LoadCallbackType load_callback_
Fragmenter_Namespace::InsertData insert_data_
std::map<int, StringDictionary *> dict_map_

Private Types

using LoadCallbackType = std::function<bool(const std::vector<std::unique_ptr<TypedImportBuffer>>&, std::vector<DataBlockPtr>&, size_t)>

Private Functions

bool loadToShard(const std::vector<std::unique_ptr<TypedImportBuffer>> &import_buffers, size_t row_count, const TableDescriptor *shard_table, bool checkpoint, const Catalog_Namespace::SessionInfo *session_info)
void distributeToShardsNewColumns(std::vector<OneShardBuffers> &all_shard_import_buffers, std::vector<size_t> &all_shard_row_counts, const OneShardBuffers &import_buffers, const size_t row_count, const size_t shard_count, const Catalog_Namespace::SessionInfo *session_info)
void distributeToShardsExistingColumns(std::vector<OneShardBuffers> &all_shard_import_buffers, std::vector<size_t> &all_shard_row_counts, const OneShardBuffers &import_buffers, const size_t row_count, const size_t shard_count, const Catalog_Namespace::SessionInfo *session_info)
void fillShardRow(const size_t row_index, OneShardBuffers &shard_output_buffers, const OneShardBuffers &import_buffers)

Private Members

bool adding_columns_ = false
std::mutex loader_mutex_
std::string error_msg_