()
| 321 | br.close(); |
| 322 | } |
| 323 | @Test |
| 324 | public void testBinStorageGetSchema() throws IOException, ParserException { |
| 325 | String input[] = new String[] { "hello\t1\t10.1", "bye\t2\t20.2" }; |
| 326 | String inputFileName = "testGetSchema-input.txt"; |
| 327 | String outputFileName = "testGetSchema-output.txt"; |
| 328 | try { |
| 329 | Util.createInputFile(ps.getPigContext(), |
| 330 | inputFileName, input); |
| 331 | String query = "a = load '" + inputFileName + "' as (c:chararray, " + |
| 332 | "i:int,d:double);store a into '" + outputFileName + "' using " + |
| 333 | "BinStorage();"; |
| 334 | ps.setBatchOn(); |
| 335 | Util.registerMultiLineQuery(ps, query); |
| 336 | ps.executeBatch(); |
| 337 | ResourceSchema rs = new BinStorage().getSchema(outputFileName, |
| 338 | new Job(ConfigurationUtil.toConfiguration(ps.getPigContext(). |
| 339 | getProperties()))); |
| 340 | Schema expectedSchema = Utils.getSchemaFromString( |
| 341 | "c:chararray,i:int,d:double"); |
| 342 | assertTrue("Checking binstorage getSchema output", Schema.equals( |
| 343 | expectedSchema, Schema.getPigSchema(rs), true, true)); |
| 344 | } finally { |
| 345 | Util.deleteFile(ps.getPigContext(), inputFileName); |
| 346 | Util.deleteFile(ps.getPigContext(), outputFileName); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | @Test |
| 351 | public void testStoreRemoteRel() throws Exception { |
nothing calls this directly
no test coverage detected