TEST_F(LoaderTests, wrong_inputs_should_fail) { CSVInput input("somefile"); Loader::params p; p.setInput(input); ASSERT_THROW( { Loader::load(p); }, Loader::Error);
void StorageManager::loadTableFile(std::string name, std::string fileName) { CSVInput input(makePath(fileName)); CSVHeader header(makePath(fileName)); Loader::params p; p.setInput(input); p.setHeader(header); addStorageTable(name, p); }
std::shared_ptr<storage::AbstractTable> Loader::shortcuts::loadRaw(const std::string& file) { RawTableLoader input(file); CSVHeader header(file); Loader::params p; p.setInput(input); p.setHeader(header); p.setReturnsMutableVerticalTable(false); return Loader::load(p); }
Loader::params *Loader::params::clone() const { Loader::params *p = new Loader::params(); if (Input != nullptr) p->setInput(*Input); if (Header != nullptr) p->setHeader(*Header); p->setBasePath(BasePath); p->setFactory(Factory); p->setInsertOnly(InsertOnly); p->setReturnsMutableVerticalTable(ReturnsMutableVerticalTable); p->setModifiableMutableVerticalTable(ModifiableMutableVerticalTable); p->setReferenceTable(ReferenceTable); p->setCompressed(Compressed); return p; }
TEST_F(StringLoaderTests, load_test_typesafe) { hyrise::storage::atable_ptr_t t = Loader::load( Loader::params() .setHeader(StringHeader("employee_id|employee_company_id|employee_name\n" "INTEGER|INTEGER|STRING\n" "0_C | 0_C | 0_C")) .setInput(CSVInput("test/tables/employees.data")) ); EmptyInput input; StringHeader header("employee_id|employee_company_id|employee_name\n" "INTEGER|INTEGER|INTEGER\n" "0_C | 0_C | 0_C"); Loader::params p; p.setInput(input).setHeader(header).setReturnsMutableVerticalTable(true).setReferenceTable(t); auto res = Loader::load(p); ASSERT_EQ(t->typeOfColumn(2), res->typeOfColumn(2)); }
std::shared_ptr<storage::Store> Loader::shortcuts::loadMainDelta(const std::string& mainfilepath, const std::string& deltafilepath, Loader::params p) { std::vector<std::string> filenames; filenames.push_back(mainfilepath); filenames.push_back(deltafilepath); std::vector<std::shared_ptr<storage::AbstractTable>> tables; for (int i = 0; i < 2; ++i) { CSVInput input(filenames[i]); CSVHeader header(filenames[i]); p.setInput(input); p.setHeader(header); p.setReturnsMutableVerticalTable(true); std::shared_ptr<storage::AbstractTable> table = load(p); tables.push_back(table); } auto s = std::make_shared<storage::Store>(tables[0]); s->setDelta(tables[1]); return s; };