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

Method testTwoMapFlatten

test/org/apache/pig/test/TestFlatten.java:73–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 15

resetDataMethod · 0.95
tupleMethod · 0.95
mapMethod · 0.95
getSchemaFromStringMethod · 0.95
setMethod · 0.65
getStatusMethod · 0.65
getSchemaMethod · 0.65
getMethod · 0.65
iteratorMethod · 0.65
setBatchOnMethod · 0.45

Tested by

no test coverage detected