// Same as above, but manually parallelized TEST_F(SimpleTableScanTests, parallelized_simple_table_scan) { storage::c_atable_ptr_t t = io::Loader::shortcuts::load("test/lin_xxs.tbl"); SimpleTableScan sts1; sts1.addInput(t); sts1.setPredicate(new EqualsExpression<storage::hyrise_int_t>(0, 0, 100)); sts1.setPart(0); sts1.setCount(2); sts1.execute(); SimpleTableScan sts2; sts2.addInput(t); sts2.setPredicate(new EqualsExpression<storage::hyrise_int_t>(0, 0, 100)); sts2.setPart(1); sts2.setCount(2); sts2.execute(); auto result1 = sts1.getResultTable(); auto result2 = sts2.getResultTable(); UnionAll ua; ua.addInput(result1); ua.addInput(result2); ua.execute(); auto result = ua.getResultTable(); ASSERT_EQ(1u, result->size()); ASSERT_EQ(100, result->getValue<storage::hyrise_int_t>(0, 0)); }
TEST(UnionAllTests, basic_union_scan_test) { UnionAll us; us.addInput(t); us.addInput(t); us.execute(); const auto &result = us.getResultTable(); ASSERT_EQ(2* t->size(), result->size()); }
TEST(UnionAllTests, pointer_calc_input) { auto pc1 = std::make_shared<PointerCalculator>(t, nullptr, nullptr); auto pc2 = std::make_shared<PointerCalculator>(t, nullptr, nullptr); UnionAll us; us.addInput(pc1); us.addInput(pc2); us.execute(); const auto &result = us.getResultTable(); ASSERT_TRUE(std::dynamic_pointer_cast<const PointerCalculator>(result) != nullptr); }
TEST_F(UnionAllTests, mixed_input) { auto pc1 = std::make_shared<storage::PointerCalculator>(t, nullptr, nullptr); auto pc2 = std::make_shared<storage::PointerCalculator>(t, nullptr, nullptr); UnionAll us; us.addInput(pc1); us.addInput(pc2); us.addInput(t); us.execute(); const auto &result = us.getResultTable(); ASSERT_TRUE(std::dynamic_pointer_cast<const storage::HorizontalTable>(result) != nullptr); }
TEST(UnionAllTests, many_pointer_calc_input) { auto pc1 = std::make_shared<PointerCalculator>(t, nullptr, nullptr); auto pc2 = std::make_shared<PointerCalculator>(t, nullptr, nullptr); auto pc3 = std::make_shared<PointerCalculator>(t, nullptr, nullptr); UnionAll us; us.addInput(pc1); us.addInput(pc2); us.addInput(pc3); us.execute(); const auto &result = us.getResultTable(); ASSERT_EQ(3 * t->size(), result->size()) << "Needs to be three times as large as original table"; ASSERT_TRUE(std::dynamic_pointer_cast<const PointerCalculator>(result) != nullptr); }
TEST(UnionAllTests, vertical_nested_pointer_calculators) { auto pc1_l = std::make_shared<PointerCalculator>(t, new std::vector<size_t> {1}, new std::vector<size_t> {0, 1}); auto pc1_r = std::make_shared<PointerCalculator>(t, new std::vector<size_t> {5}, new std::vector<size_t> {2, 3, 4}); std::vector<storage::atable_ptr_t> pc1 {pc1_l , pc1_r}; auto mtv1 = std::make_shared<MutableVerticalTable>(pc1); auto pc2_l = std::make_shared<PointerCalculator>(t, new std::vector<size_t> {2, 3}, new std::vector<size_t> {0, 1}); auto pc2_r = std::make_shared<PointerCalculator>(t, new std::vector<size_t> {2, 6}, new std::vector<size_t> {2, 3, 4}); std::vector<storage::atable_ptr_t> pc2 {pc2_l , pc2_r}; auto mtv2 = std::make_shared<MutableVerticalTable>(pc2); UnionAll u; u.addInput(mtv1); u.addInput(mtv2); u.execute(); const auto &result = u.getResultTable(); ASSERT_TRUE(std::dynamic_pointer_cast<const MutableVerticalTable>(result) != nullptr); EXPECT_EQ(3u, result->size()); }