TEST_F(MergeTests, merge_with_different_layout) { auto main = io::Loader::shortcuts::load("test/merge1_main.tbl"); auto delta = io::Loader::shortcuts::load("test/merge1_delta.tbl"); //, io::Loader::params().set_modifiable(true)); auto correct_result = io::Loader::shortcuts::load("test/merge1_result.tbl"); auto dest = io::Loader::shortcuts::load("test/merge1_newlayout.tbl", io::Loader::params().setModifiableMutableVerticalTable(true)); ASSERT_EQ(3u, main->partitionCount()); ASSERT_EQ(1u, dest->partitionCount()); std::vector<hyrise::storage::c_atable_ptr_t> tables; tables.push_back(main); tables.push_back(delta); TableMerger merger(new DefaultMergeStrategy(), new SequentialHeapMerger()); const auto& result = merger.mergeToTable(dest, tables); ASSERT_TRUE(result[0]->contentEquals(correct_result)); ASSERT_TRUE(result[0]->dictionaryAt(0)->size() == 7); ASSERT_TRUE(result[0]->dictionaryAt(1)->size() == 7); ASSERT_TRUE(result[0]->dictionaryAt(2)->size() == 8); ASSERT_EQ(1u, result[0]->partitionCount()); ASSERT_EQ(dest, result[0]); }
TEST_F(PointerCalcTests, pc_from_vertical_table_slice_count_4_groups) { auto t = createTable(table_5); ASSERT_EQ(5u, t->partitionCount()); auto tmp_fd = new std::vector<field_t>{1, 2, 3, 4}; auto res = PointerCalculator::create(t, nullptr, tmp_fd); ASSERT_EQ(2u, res->partitionCount()); }
TEST_F(PointerCalcTests, pc_from_vertical_table_slice_count_1_group_projection) { auto t = createTable(table_5); ASSERT_EQ(5u, t->partitionCount()); ASSERT_EQ(7u, t->columnCount()); auto tmp_fd = new std::vector<field_t>{1}; auto res = PointerCalculator::create(t, nullptr, tmp_fd); ASSERT_EQ(1u, res->partitionCount()); ASSERT_EQ(1u, res->partitionWidth(0)); }
TEST_F(LayouterOpsTest, layouting_table_op_basic) { auto table = Loader::shortcuts::load("test/tables/partitions.tbl"); ASSERT_EQ(table->partitionCount(), 3u); LayoutTable op("a|b|c|d\nINTEGER|INTEGER|INTEGER|INTEGER\n0_C|0_C|1_C|1_C"); op.addInput(table); auto result = op.execute()->getResultTable(); ASSERT_EQ(result->partitionCount(), 2u); }
TEST_F(LayouterOpsTest, layouting_table_op_reordering) { auto table = Loader::shortcuts::load("test/tables/partitions.tbl"); ASSERT_EQ(table->partitionCount(), 3u); LayoutTable op("a|c|b|d\nINTEGER|INTEGER|INTEGER|INTEGER\n0_C|0_C|1_C|1_C"); op.addInput(table); auto result = op.execute()->getResultTable(); ASSERT_EQ(result->partitionCount(), 2u); ASSERT_EQ(result->metadataAt(1)->getName(), "c"); ASSERT_EQ(result->getValue<hyrise_int_t>(1, 0), 3); }
TEST_F(TableTests, copy_structure_replacement) { auto input = Loader::shortcuts::load("test/lin_xxs.tbl", Loader::params().setReturnsMutableVerticalTable(true)); ASSERT_EQ(3u, input->partitionCount()); auto order_indifferent = [](DataType dt) { return makeDictionary<OrderIndifferentDictionary>(dt); }; auto order_preserving = [](DataType dt) { return makeDictionary<OrderPreservingDictionary>(dt); }; auto b = [](std::size_t cols) { return std::make_shared<FixedLengthVector<value_id_t>>(cols, 0); }; hyrise::storage::atable_ptr_t copy = input->copy_structure(order_preserving, b); ASSERT_TRUE(std::dynamic_pointer_cast<OrderPreservingDictionary<hyrise_int_t>>(copy->dictionaryAt(0,0)) != nullptr); hyrise::storage::atable_ptr_t copy2 = input->copy_structure(order_indifferent, b); ASSERT_TRUE(std::dynamic_pointer_cast<OrderIndifferentDictionary<hyrise_int_t>>(copy2->dictionaryAt(0,0)) != nullptr); }