Review Board 1.7.22


PIG-3066 Fix TestPigRunner in trunk

Review Request #8313 - Created Dec. 3, 2012 and submitted

Cheolsoo Park
PIg-3066
Reviewers
pig
sms
pig-git
TestPigRunner is broken in trunk. This is a regression from https://issues.apache.org/jira/browse/PIG-2924.

Please see for details: https://issues.apache.org/jira/browse/PIG-3066.
ant test -Dtestcase=TestPigRunner -Dhadoopversion=[20|23]

Diff revision 1 (Latest)

  1. test/org/apache/pig/test/TestPigRunner.java: Loading...
test/org/apache/pig/test/TestPigRunner.java
Revision 69cd242 New Change
[20] 255 lines
[+20] [+] public void simpleMultiQueryTest() throws Exception {
256
        try {
256
        try {
257
            String[] args = { PIG_FILE };
257
            String[] args = { PIG_FILE };
258
            PigStats stats = PigRunner.run(args, new TestNotificationListener());
258
            PigStats stats = PigRunner.run(args, new TestNotificationListener());
259
            assertTrue(stats.isSuccessful());
259
            assertTrue(stats.isSuccessful());
260
            assertTrue(stats.getJobGraph().size() == 1);
260
            assertTrue(stats.getJobGraph().size() == 1);
261
            assertEquals(5, stats.getRecordWritten());
261
            // Each output file should include the following:
262
            assertEquals(28, stats.getBytesWritten());
262
            // output:

    
   
263
            //   1\t2\t3\n

    
   
264
            //   3\t4\t5\n

    
   
265
            //   3\t7\t8\n

    
   
266
            // output2:

    
   
267
            //   5\t3\t4\n

    
   
268
            //   5\t6\t7\n

    
   
269
            final int numOfRecords = 5;

    
   
270
            final int numOfCharsPerRecord = 6;

    
   
271
            assertEquals(numOfRecords, stats.getRecordWritten());

    
   
272
            assertEquals(numOfRecords * numOfCharsPerRecord, stats.getBytesWritten());
263
            assertTrue(stats.getOutputNames().size() == 2);
273
            assertTrue(stats.getOutputNames().size() == 2);
264
            for (String fname : stats.getOutputNames()) {
274
            for (String fname : stats.getOutputNames()) {
265
                assertTrue(fname.equals(OUTPUT_FILE) || fname.equals(OUTPUT_FILE_2));
275
                assertTrue(fname.equals(OUTPUT_FILE) || fname.equals(OUTPUT_FILE_2));
266
                if (fname.equals(OUTPUT_FILE)) {
276
                if (fname.equals(OUTPUT_FILE)) {
267
                    assertEquals(3, stats.getNumberRecords(fname));
277
                    assertEquals(3, stats.getNumberRecords(fname));
[+20] [20] 27 lines
[+20] [+] public void simpleMultiQueryTest2() throws Exception {
295
        try {
305
        try {
296
            String[] args = { PIG_FILE };
306
            String[] args = { PIG_FILE };
297
            PigStats stats = PigRunner.run(args, new TestNotificationListener());
307
            PigStats stats = PigRunner.run(args, new TestNotificationListener());
298
            assertTrue(stats.isSuccessful());
308
            assertTrue(stats.isSuccessful());
299
            assertTrue(stats.getJobGraph().size() == 1);
309
            assertTrue(stats.getJobGraph().size() == 1);
300
            assertEquals(4, stats.getRecordWritten());           
310
            // Each output file should include the following:
301
            assertEquals(18, stats.getBytesWritten());
311
            // output:

    
   
312
            //   5\t3\t4\n

    
   
313
            //   5\t6\t7\n

    
   
314
            // output2:

    
   
315
            //   1\t1\n

    
   
316
            //   3\t2\n

    
   
317
            final int numOfRecords1 = 2;

    
   
318
            final int numOfRecords2 = 2;

    
   
319
            final int numOfCharsPerRecord1 = 6;

    
   
320
            final int numOfCharsPerRecord2 = 4;

    
   
321
            assertEquals(numOfRecords1 + numOfRecords2, stats.getRecordWritten());

    
   
322
            assertEquals((numOfRecords1 * numOfCharsPerRecord1) + (numOfRecords2 * numOfCharsPerRecord2),

    
   
323
                    stats.getBytesWritten());
302
            assertTrue(stats.getOutputNames().size() == 2);
324
            assertTrue(stats.getOutputNames().size() == 2);
303
            for (String fname : stats.getOutputNames()) {               
325
            for (String fname : stats.getOutputNames()) {               
304
                assertTrue(fname.equals(OUTPUT_FILE) || fname.equals(OUTPUT_FILE_2));
326
                assertTrue(fname.equals(OUTPUT_FILE) || fname.equals(OUTPUT_FILE_2));
305
                if (fname.equals(OUTPUT_FILE)) {
327
                if (fname.equals(OUTPUT_FILE)) {
306
                    assertEquals(2, stats.getNumberRecords(fname));
328
                    assertEquals(2, stats.getNumberRecords(fname));
[+20] [20] 684 lines
  1. test/org/apache/pig/test/TestPigRunner.java: Loading...