()
| 336 | } |
| 337 | |
| 338 | @Test |
| 339 | public void runLoopTest() throws Exception { |
| 340 | String[] script = { |
| 341 | "#!/usr/bin/python", |
| 342 | "from org.apache.pig.scripting import *", |
| 343 | "Pig.fs(\"rmr simple_out\")", |
| 344 | "Pig.fs(\"rmr simple_out2\")", |
| 345 | "input = 'simple_table_4'", |
| 346 | "P = Pig.compile(\"mypipeline\", \"\"\"a = load '$input';store a into '$output';\"\"\")", |
| 347 | "for x in [\"simple_out\", \"simple_out2\"]:", |
| 348 | "\tQ = P.bind({'input':input, 'output':x}).run()" |
| 349 | }; |
| 350 | String[] input = { |
| 351 | "1\t3", |
| 352 | "2\t4", |
| 353 | "3\t5" |
| 354 | }; |
| 355 | |
| 356 | Util.createInputFile(cluster, "simple_table_4", input); |
| 357 | |
| 358 | PigStats mainStats = runPigRunner("runLoopTest", script); |
| 359 | |
| 360 | Map<String, List<PigStats>> statsMap = mainStats.getAllStats(); |
| 361 | assertEquals(1, statsMap.size()); |
| 362 | assertEquals("mypipeline", statsMap.keySet().iterator().next()); |
| 363 | List<PigStats> lst = statsMap.get("mypipeline"); |
| 364 | assertEquals(2, lst.size()); |
| 365 | for (PigStats stats : lst) { |
| 366 | assertTrue("job should succeed", stats.isSuccessful()); |
| 367 | assertEquals(1, stats.getNumberJobs()); |
| 368 | assertEquals(12, stats.getBytesWritten()); |
| 369 | assertEquals(3, stats.getRecordWritten()); |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | @Test |
| 374 | public void bindLocalVariableTest() throws Exception { |
nothing calls this directly
no test coverage detected