Exemplo n.º 1
0
TEST_F(LoaderTests, wrong_inputs_should_fail) {
  CSVInput input("somefile");
  Loader::params p;
  p.setInput(input);
  ASSERT_THROW( {
      Loader::load(p);
    }, Loader::Error);
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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));
}
Exemplo n.º 6
0
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;
};