Пример #1
0
void SimpleTableScan::executeMaterialized() {
  auto tbl = input.getTable(0);
  auto result_table = tbl->copy_structure_modifiable();
  size_t target_row = 0;

  size_t row = _ofDelta ? checked_pointer_cast<const storage::Store>(tbl)->deltaOffset() : 0;
  for (size_t input_size = tbl->size(); row < input_size; ++row) {
    if ((*_comparator)(row)) {
      // TODO materializing result set will make the allocation the boundary
      result_table->resize(target_row + 1);
      result_table->copyRowFrom(input.getTable(0), row, target_row++, true /* Copy Value*/, false /* Use Memcpy */);
    }
  }
  addResult(result_table);
}
Пример #2
0
TEST_F(SelectTests, select_after_insert_simple) {
  auto ctx = tx::TransactionManager::getInstance().buildContext();
  hyrise::storage::atable_ptr_t t = Loader::shortcuts::load("test/lin_xxs.tbl");
  auto s = std::make_shared<const storage::Store>(t);

  hyrise::storage::atable_ptr_t data = s->copy_structure_modifiable(nullptr, s->size());
  data->resize(1);
  for (std::size_t i=0; i <= 9; ++i) {
    data->setValue<hyrise_int_t>(i, 0, 1000+i);
  }
  // insert data
  InsertScan isc;
  isc.setTXContext(ctx);
  isc.addInput(s);
  isc.setInputData(data);
  isc.execute();


  ASSERT_EQ(t->size() + 1, isc.getResultTable(0)->size());
}