()
| 71 | } |
| 72 | |
| 73 | @Test |
| 74 | public void testTwoMapFlatten() throws Exception { |
| 75 | Storage.Data data = Storage.resetData(pig); |
| 76 | data.set("input", |
| 77 | Storage.tuple( |
| 78 | Storage.map("a","b", |
| 79 | "c","d"), |
| 80 | Storage.map("1","2", |
| 81 | "3","4") |
| 82 | ) |
| 83 | ); |
| 84 | pig.setBatchOn(); |
| 85 | pig.registerQuery("A = load 'input' using mock.Storage() as (map1:map [chararray], map2:map [chararray]);"); |
| 86 | pig.registerQuery("B = foreach A GENERATE FLATTEN(map1), FLATTEN(map2);"); |
| 87 | pig.registerQuery("store B into 'output' using mock.Storage();"); |
| 88 | List<ExecJob> execJobs = pig.executeBatch(); |
| 89 | for( ExecJob execJob : execJobs ) { |
| 90 | assertTrue(execJob.getStatus() == ExecJob.JOB_STATUS.COMPLETED ); |
| 91 | } |
| 92 | Schema expectedSch = Utils.getSchemaFromString("map1::key: chararray,map1::value: chararray,map2::key: chararray,map2::value: chararray"); |
| 93 | assertEquals(expectedSch, data.getSchema("output")); |
| 94 | List<Tuple> actualResults = data.get("output"); |
| 95 | List<Tuple> expectedResults = Util.getTuplesFromConstantTupleStrings( |
| 96 | new String[] { |
| 97 | "('a', 'b', '1', '2')", "('a', 'b', '3', '4')", "('c', 'd', '1', '2')", "('c', 'd', '3', '4')" }); |
| 98 | Util.checkQueryOutputsAfterSort(actualResults.iterator(), expectedResults); |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected