()
| 535 | } |
| 536 | |
| 537 | @Test |
| 538 | public void testBzipStoreInMultiQuery2() throws Exception { |
| 539 | String[] inputData = new String[] { |
| 540 | "1\t2\r3\t4" |
| 541 | }; |
| 542 | |
| 543 | String inputFileName = "input2.txt"; |
| 544 | Util.createInputFile(cluster, inputFileName, inputData); |
| 545 | |
| 546 | try { |
| 547 | PigServer pig = new PigServer(cluster.getExecType(), properties); |
| 548 | PigContext pigContext = pig.getPigContext(); |
| 549 | pigContext.getProperties().setProperty( "output.compression.enabled", "true" ); |
| 550 | pigContext.getProperties().setProperty( "output.compression.codec", "org.apache.hadoop.io.compress.BZip2Codec" ); |
| 551 | |
| 552 | pig.setBatchOn(); |
| 553 | pig.registerQuery("a = load '" + inputFileName + "';"); |
| 554 | pig.registerQuery("store a into 'output2.bz2';"); |
| 555 | pig.registerQuery("store a into 'output2';"); |
| 556 | pig.executeBatch(); |
| 557 | |
| 558 | FileSystem fs = FileSystem.get(ConfigurationUtil.toConfiguration( |
| 559 | pig.getPigContext().getProperties())); |
| 560 | FileStatus[] outputFiles = fs.listStatus(new Path("output2"), |
| 561 | Util.getSuccessMarkerPathFilter()); |
| 562 | assertTrue(outputFiles[0].getLen() > 0); |
| 563 | |
| 564 | outputFiles = fs.listStatus(new Path("output2.bz2"), |
| 565 | Util.getSuccessMarkerPathFilter()); |
| 566 | assertTrue(outputFiles[0].getLen() > 0); |
| 567 | } finally { |
| 568 | Util.deleteFile(cluster,"input2.txt"); |
| 569 | Util.deleteFile(cluster,"output2.bz2"); |
| 570 | Util.deleteFile(cluster,"output2"); |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | /** |
| 575 | * Tests that Pig's Bzip2TextInputFormat throws an IOException when the input files to be loaded are actually |
nothing calls this directly
no test coverage detected