TEST_F(JoinTests, hash_join_exchange_rates_multiple_columns) { hyrise::storage::c_atable_ptr_t table1 = Loader::shortcuts::load("test/join_transactions.tbl"); hyrise::storage::c_atable_ptr_t table2 = Loader::shortcuts::load("test/join_exchange.tbl"); EqualsExpression<std::string> *expr4 = new EqualsExpression<std::string>(table2, 2, "USD"); auto scan = std::make_shared<SimpleTableScan>(); scan->addInput(table2); scan->setProducesPositions(true); scan->setPredicate(expr4); const auto& filtered_rates = scan->execute()->getResultTable(); auto hashBuild1 = std::make_shared<hyrise::access::HashBuild>(); hashBuild1->addInput(filtered_rates); hashBuild1->addField(0); hashBuild1->addField(1); hashBuild1->setKey("join"); auto hashedFilteredRates1 = hashBuild1->execute()->getResultHashTable(); auto hashJoinProbe = std::make_shared<hyrise::access::HashJoinProbe>(); hashJoinProbe->addInput(table1); hashJoinProbe->addField(0); hashJoinProbe->addField(1); hashJoinProbe->addInputHash(hashedFilteredRates1); auto result = hashJoinProbe->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/join_exchange_rates.tbl"); ASSERT_TRUE(result->contentEquals(reference)); }
TEST_F(JoinTests, join_exchange_rates) { hyrise::storage::c_atable_ptr_t table1 = Loader::shortcuts::load("test/join_transactions.tbl"); hyrise::storage::c_atable_ptr_t table2 = Loader::shortcuts::load("test/join_exchange.tbl"); EqualsExpression<std::string> *expr4 = new EqualsExpression<std::string>(table2, 2, "USD"); auto scan = std::make_shared<SimpleTableScan>(); scan->addInput(table2); scan->setProducesPositions(true); scan->setPredicate(expr4); const auto& filtered_rates = scan->execute()->getResultTable(); auto join = std::make_shared<hyrise::access::JoinScan>(hyrise::access::JoinType::EQUI); join->addInput(table1); join->addInput(filtered_rates); join->addCombiningClause(AND); join->addJoinClause<int>(0, 0, 1, 0); join->addJoinClause<std::string>(0, 1, 1, 1); const auto& out = join->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/join_exchange_rates.tbl"); ASSERT_TRUE(out->contentEquals(reference)); }
void Instruction::putExtraSources(int s, Value *values[3]) { if (values[0]) setIndirect(s, 0, values[0]); if (values[1]) setIndirect(s, 1, values[1]); if (values[2]) setPredicate(cc, values[2]); }
void SimplePipeliningTableScan::setupPlanOperation() { // check if any input tables are available. if (input.sizeOf<storage::AbstractTable>() == 0) { _tbl = nullptr; return; } setPredicate(buildExpression(_predicates)); _comparator->walk(input.getTables()); _tbl = input.getTable(0); }
void ActionEditor::setActionToEdit( ActionItem * item ) { activeItem = item; // Set all the text appropriately ui.IbActionIcon->setIcon( item->icon() ); ui.LeActionFriendlyName->setText( item->name() ); ui.LeActionCommand->setText(item->exec()); setPredicate( item->predicate() ); setWindowTitle(i18n("Editing Action '%1'", item->name()) ); // Set a friendly i18n caption }
TEST_F(SelectTests, select_between) { hyrise::storage::c_atable_ptr_t t = Loader::shortcuts::load("test/groupby_xs.tbl"); auto stc = std::make_shared<SimpleTableScan>(); BetweenExpression<hyrise_int_t> *between = new BetweenExpression<hyrise_int_t>(t, t->numberOfColumn("month"), 2, 4); stc->addInput(t); stc->setPredicate(between); const auto& result = stc->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/select_between.tbl"); ASSERT_TRUE(result->contentEquals(reference)); }
TEST_F(SelectTests, simple_select_2) { hyrise::storage::c_atable_ptr_t t = Loader::shortcuts::load("test/groupby_xs.tbl"); auto *expr5 = new LessThanExpression<hyrise_int_t>(t, 0, 2010); auto scan = std::make_shared<SimpleTableScan>(); scan->addInput(t); scan->setPredicate(expr5); scan->setProducesPositions(true); const auto& out = scan->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/simple_select_2.tbl"); ASSERT_TRUE(out->contentEquals(reference)); }
void Instruction::takeExtraSources(int s, Value *values[3]) { values[0] = getIndirect(s, 0); if (values[0]) setIndirect(s, 0, NULL); values[1] = getIndirect(s, 1); if (values[1]) setIndirect(s, 1, NULL); values[2] = getPredicate(); if (values[2]) setPredicate(cc, NULL); }
TEST_F(SelectTests, simple_select) { hyrise::storage::c_atable_ptr_t t = Loader::shortcuts::load("test/groupby_xs.tbl"); EqualsExpression<hyrise_int_t> *expr1 = new EqualsExpression<hyrise_int_t>(t, 0, 2009); EqualsExpression<hyrise_int_t> *expr2 = new EqualsExpression<hyrise_int_t>(t, 1, 1); CompoundExpression *expr3 = new CompoundExpression(expr1, expr2, OR); CompoundExpression *expr4 = new CompoundExpression(NOT); expr4->lhs = expr3; auto scan = std::make_shared<SimpleTableScan>(); scan->addInput(t); scan->setPredicate(expr4); scan->setProducesPositions(true); const auto& out = scan->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/simple_select_1.tbl"); ASSERT_TRUE(out->contentEquals(reference)); }
TEST_F(SelectTests, simple_select_3) { hyrise::storage::c_atable_ptr_t t = Loader::shortcuts::load("test/groupby_xs.tbl"); GreaterThanExpression<hyrise_int_t> *expr6 = new GreaterThanExpression<hyrise_int_t>(t, 0, 2009); GreaterThanExpression<hyrise_int_t> *expr8 = new GreaterThanExpression<hyrise_int_t>(t, 0, 2008); CompoundExpression *expr7 = new CompoundExpression(NOT); expr7->lhs = expr6; CompoundExpression *expr9 = new CompoundExpression(expr8, expr7, AND); auto scan = std::make_shared<SimpleTableScan>(); scan->addInput(t); scan->setPredicate(expr9); scan->setProducesPositions(true); const auto& out = scan->execute()->getResultTable(); const auto& reference = Loader::shortcuts::load("test/reference/simple_select_3.tbl"); ASSERT_TRUE(out->contentEquals(reference)); }