| 325 | } |
| 326 | |
| 327 | inline void table_data::add_insert_slots(int32_t nslots, TupleTableSlot** slots) |
| 328 | { |
| 329 | for (int32_t k = 0; k < nslots; ++k) { |
| 330 | auto slot = slots[k]; |
| 331 | slot_getallattrs(slot); |
| 332 | } |
| 333 | for (int32_t i = 0; i < num_columns(); ++i) { |
| 334 | auto& column_values = insert_rows_[get_atttypename(i)]; |
| 335 | const auto dt = get_column_view(i)->dtype(); |
| 336 | const auto slot_pos = get_tupdesc_index(i); |
| 337 | for (int32_t k = 0; k < nslots; ++k) { |
| 338 | auto slot = slots[k]; |
| 339 | nd::array val; |
| 340 | if (slot->tts_isnull[slot_pos]) { |
| 341 | val = (nd::dtype_is_numeric(dt) ? nd::adapt(0) : nd::none(dt, 0)); |
| 342 | } else { |
| 343 | val = pg::utils::datum_to_nd(slot->tts_values[slot_pos], get_base_atttypid(i), get_atttypmod(i)); |
| 344 | } |
| 345 | column_values.push_back(std::move(val)); |
| 346 | } |
| 347 | } |
| 348 | num_total_rows_ += nslots; |
| 349 | const auto num_inserts = insert_rows_.begin()->second.size(); |
| 350 | if (num_inserts >= 512) { |
| 351 | flush_inserts(); |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | inline void table_data::add_delete_row(int64_t row_id) |
| 356 | { |
no test coverage detected