private void storeTableContents(String resource, Path path) throws IOException { String csvTable = JavaResourceUtil.readTextFromResource(resource); String fixedCsvTable = fixExtraColumn(csvTable); FileUtil.writeTextToFile(fixedCsvTable, path); }
private TpchTestBase() throws IOException { names = new String[] {"customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier", "small_supplier", "empty_orders"}; paths = new String[names.length]; for (int i = 0; i < names.length; i++) { nameMap.put(names[i], i); } tpch = new TPCH(); tpch.loadSchemas(); tpch.loadQueries(); schemas = new Schema[names.length]; for (int i = 0; i < names.length; i++) { schemas[i] = tpch.getSchema(names[i]); } // create a temporal table File tpchTablesDir = new File(new File(CommonTestingUtil.getTestDir().toUri()), "tpch"); for (int i = 0; i < names.length; i++) { String str = JavaResourceUtil.readTextFromResource("tpch/" + names[i] + ".tbl"); Path tablePath = new Path(new Path(tpchTablesDir.toURI()), names[i] + ".tbl"); FileUtil.writeTextToFile(str, tablePath); paths[i] = tablePath.toString(); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }