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

Method testEmptyFileCounter2

test/org/apache/pig/test/TestPigRunner.java:961–998  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

959 }
960
961 @Test //PIG-1893
962 public void testEmptyFileCounter2() throws Exception {
963
964 PrintWriter w1 = new PrintWriter(new FileWriter(PIG_FILE));
965 w1.println("A = load '" + INPUT_FILE + "' as (a0:int, a1:int, a2:int);");
966 w1.println("B = filter A by a0 < 0;");
967 w1.println("store A into '" + OUTPUT_FILE + "';");
968 w1.println("store B into 'output2';");
969 w1.close();
970
971 try {
972 String[] args = { "-x", execType, PIG_FILE };
973 PigStats stats = PigRunner.run(args, new TestNotificationListener(execType));
974
975 assertTrue(stats.isSuccessful());
976 //In spark mode, one POStore will generate a spark action(spark job).
977 //In this case, the sparkplan has 1 sparkOperator(after multiquery optimization) but has 2 POStores
978 //which generate 2 spark actions(spark jobs).
979 if (execType.equals("spark")) {
980 assertEquals(2, stats.getNumberJobs());
981 } else {
982 assertEquals(1, stats.getNumberJobs());
983 }
984 List<OutputStats> outputs = stats.getOutputStats();
985 assertEquals(2, outputs.size());
986 for (OutputStats outstats : outputs) {
987 if (outstats.getLocation().endsWith("output2")) {
988 assertEquals(0, outstats.getNumberRecords());
989 } else {
990 assertEquals(5, outstats.getNumberRecords());
991 }
992 }
993 } finally {
994 new File(PIG_FILE).delete();
995 Util.deleteFile(cluster, OUTPUT_FILE);
996 Util.deleteFile(cluster, "output2");
997 }
998 }
999
1000 @Test // PIG-2208: Restrict number of PIG generated Haddop counters
1001 public void testDisablePigCounters() throws Exception {

Callers

nothing calls this directly

Calls 12

runMethod · 0.95
isSuccessfulMethod · 0.95
getNumberJobsMethod · 0.95
getOutputStatsMethod · 0.95
deleteFileMethod · 0.95
closeMethod · 0.65
sizeMethod · 0.65
deleteMethod · 0.65
equalsMethod · 0.45
assertEqualsMethod · 0.45
getLocationMethod · 0.45
getNumberRecordsMethod · 0.45

Tested by

no test coverage detected