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

Method testGroupBy

test/org/apache/pig/test/TestEmptyInputDir.java:68–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66 }
67
68 @Test
69 public void testGroupBy() throws Exception {
70 PrintWriter w = new PrintWriter(new FileWriter(PIG_FILE));
71 w.println("A = load '" + EMPTY_DIR + "';");
72 w.println("B = group A by $0;");
73 w.println("store B into '" + OUTPUT_FILE + "';");
74 w.close();
75
76 try {
77 String[] args = { "-x", cluster.getExecType().name(), PIG_FILE, };
78 PigStats stats = PigRunner.run(args, null);
79
80 assertTrue(stats.isSuccessful());
81
82 // This assert fails on 205 due to MAPREDUCE-3606
83 if (Util.isMapredExecType(cluster.getExecType())
84 && !Util.isHadoop205() && !Util.isHadoop1_x()) {
85 MRJobStats js = (MRJobStats) stats.getJobGraph().getSources().get(0);
86 assertEquals(0, js.getNumberMaps());
87 }
88
89 //Spark doesn't create an empty result file part-*, only a _SUCCESS file if input dir was empty
90 Assume.assumeTrue("Skip this test for Spark. See PIG-5140", !Util.isSparkExecType(cluster.getExecType()));
91 assertEmptyOutputFile();
92 } finally {
93 new File(PIG_FILE).delete();
94 Util.deleteFile(cluster, OUTPUT_FILE);
95 }
96 }
97
98 @Test
99 public void testSkewedJoin() throws Exception {

Callers

nothing calls this directly

Calls 15

runMethod · 0.95
isSuccessfulMethod · 0.95
isMapredExecTypeMethod · 0.95
isHadoop205Method · 0.95
isHadoop1_xMethod · 0.95
getJobGraphMethod · 0.95
getNumberMapsMethod · 0.95
isSparkExecTypeMethod · 0.95
assertEmptyOutputFileMethod · 0.95
deleteFileMethod · 0.95
closeMethod · 0.65
nameMethod · 0.65

Tested by

no test coverage detected