MCPcopy Create free account
hub / github.com/activeloopai/deeplake / multi_insert

Method multi_insert

cpp/deeplake_pg/table_am.cpp:1032–1065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1030}
1031
1032void deeplake_table_am_routine::multi_insert(Relation rel,
1033 TupleTableSlot** slots,
1034 int32_t nslots,
1035 CommandId cid,
1036 int32_t options,
1037 struct BulkInsertStateData* bistate)
1038{
1039 // Check PostgreSQL memory limits before multi-insert
1040 memory_tracker::check_memory_limit();
1041 const auto table_id = RelationGetRelid(rel);
1042 const auto& table_data = table_storage::instance().get_table_data(table_id);
1043 const auto row_number = table_data.num_total_rows();
1044 try {
1045 table_storage::instance().insert_slots(table_id, nslots, slots);
1046 } catch (const std::exception& e) {
1047 ereport(ERROR,
1048 (errcode(ERRCODE_INTERNAL_ERROR),
1049 errmsg("Failed to insert tuples: %s", e.what()),
1050 errdetail("Table name: %s, Dataset path: %s",
1051 get_qualified_table_name(rel).c_str(),
1052 pg::table_options::current().dataset_path().c_str()),
1053 errhint("Check if the dataset path is accessible and has proper permissions")));
1054 }
1055 for (auto i = 0; i < nslots; ++i) {
1056 const auto [block_number, offset_number] = utils::row_number_to_tid(row_number + i);
1057 ItemPointerSet(&slots[i]->tts_tid, block_number, offset_number);
1058 }
1059
1060 // Report to statistics collector
1061 pgstat_count_heap_insert(rel, nslots);
1062
1063 // Increment version to notify other backends
1064 table_version_tracker::increment_version(table_id);
1065}
1066
1067TM_Result deeplake_table_am_routine::tuple_delete(Relation rel,
1068 ItemPointer tid,

Callers

nothing calls this directly

Calls 5

row_number_to_tidFunction · 0.85
num_total_rowsMethod · 0.80
insert_slotsMethod · 0.80
whatMethod · 0.80
get_qualified_table_nameFunction · 0.70

Tested by

no test coverage detected