Exemple #1
0
TEST_F(GroupByTests, group_by_scan_with_count) {
  hyrise::storage::atable_ptr_t t = Loader::shortcuts::load("test/10_30_group.tbl");

  auto count = new CountAggregateFun(0);

  hyrise::access::GroupByScan gs;
  gs.addInput(t);
  gs.addFunction(count);
  gs.addField(0);

  hyrise::access::HashBuild hs;
  hs.addInput(t);
  hs.addField(0);
  hs.setKey("groupby");

  auto group_map = hs.execute()->getResultHashTable();
  gs.addInput(group_map);

  const auto& result = gs.execute()->getResultTable();
  const auto& reference = Loader::shortcuts::load("test/reference/group_by_scan_with_count.tbl");

  SortScan so;
  so.addInput(result);
  so.setSortField(0);
  const auto& r2 = so.execute()->getResultTable();

  SortScan so2;
  so2.addInput(reference);
  so2.setSortField(0);
  const auto& ref2 = so2.execute()->getResultTable();

  ASSERT_TABLE_EQUAL(r2, ref2);

}
Exemple #2
0
TEST_F(GroupByTests, group_by_scan_using_table_multiple_fields) {
  auto t = io::Loader::shortcuts::load("test/10_30_group.tbl");

  hyrise::access::GroupByScan gs;
  gs.addInput(t);
  gs.addField(0);
  gs.addField(1);

  hyrise::access::HashBuild hs;
  hs.addInput(t);
  hs.addField(0);
  hs.addField(1);
  hs.setKey("groupby");

  auto group_map = hs.execute()->getResultHashTable();
  gs.addInput(group_map);
  const auto& result = gs.execute()->getResultTable();

  SortScan so;
  so.addInput(result);
  so.setSortField(0);
  const auto& r2 = so.execute()->getResultTable();


  const auto& reference = io::Loader::shortcuts::load("test/reference/group_by_scan_using_table_multiple_fields.tbl");

  SortScan so2;
  so2.addInput(reference);
  so2.setSortField(0);
  const auto& ref2 = so2.execute()->getResultTable();

  ASSERT_TABLE_EQUAL(r2, ref2);
}
Exemple #3
0
  void BenchmarkSetUp() {
    sm = io::StorageManager::getInstance();

    sc = new SortScan();
    sc->setEvent("NO_PAPI");

    t = sm->getTable("item");
    sc->addInput(t);
  }
Exemple #4
0
TEST_F(GroupByTests, group_by_scan_using_table_2) {
  hyrise::storage::atable_ptr_t t = Loader::shortcuts::load("test/10_30_group.tbl");

  {
    auto gs = std::make_shared<hyrise::access::GroupByScan>();
    gs->addInput(t);
    gs->addField(0);

    auto hs = std::make_shared<hyrise::access::HashBuild>();
    hs->addInput(t);
    hs->addField(0);
    hs->setKey("groupby");

    auto group_map = hs->execute()->getResultHashTable();
    
    gs->addInput(group_map);

    const auto& result = gs->execute()->getResultTable();

    ASSERT_EQ(result->size(), t->size());


    hyrise::access::GroupByScan gs2;
    gs2.addInput(t);

    gs2.addField(1);

    hyrise::access::HashBuild hs2;
    hs2.addInput(t);
    hs2.addField(1);
    hs2.setKey("groupby");

    auto group_map2 = hs2.execute()->getResultHashTable();
    gs2.addInput(group_map2);

    const auto& result2 = gs2.execute()->getResultTable();

    SortScan s;
    s.addInput(result2);


    s.setSortField(0);
    const auto& r2 = s.execute()->getResultTable();

    hyrise::storage::atable_ptr_t reference = Loader::shortcuts::load("test/reference/group_by_scan_using_table_2.tbl");

    SortScan s2;
    s2.addInput(reference);
    s2.setSortField(0);
    const auto& ref2 = s2.execute()->getResultTable();

    ASSERT_TABLE_EQUAL(r2, ref2);
  }
  ASSERT_EQ(1u, t.use_count());
}
TEST_F(SortScanTests, basic_sort_scan_test) {
  auto t = Loader::shortcuts::load("test/reference/group_by_scan_using_table_2.tbl");
  auto reference = Loader::shortcuts::load("test/sort_test.tbl");

  SortScan ss;
  ss.addInput(t);
  ss.setSortField(0);
  ss.execute();

  const auto &result = ss.getResultTable();

  ASSERT_TRUE(result->contentEquals(reference));
}