MCPcopy Create free account
hub / github.com/apache/pig / testBzipStoreInMultiQuery2

Method testBzipStoreInMultiQuery2

test/org/apache/pig/test/TestBZip.java:537–572  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

createInputFileMethod · 0.95
getPigContextMethod · 0.95
getPropertiesMethod · 0.95
setBatchOnMethod · 0.95
registerQueryMethod · 0.95
executeBatchMethod · 0.95
toConfigurationMethod · 0.95
deleteFileMethod · 0.95
setPropertyMethod · 0.65
getMethod · 0.65
getExecTypeMethod · 0.45

Tested by

no test coverage detected