}
@Test
public void testSchemaResetterExec() throws IOException {
PigServer pigServer = new PigServer(LOCAL);
Data data = Storage.resetData(pigServer);
data.set("input",
tuple(tuple("1", "2")),
tuple(tuple("2", "3")),
tuple(tuple("2", "4")));
pigServer.registerQuery(
"A = LOAD 'input' USING mock.Storage() AS (group:tuple(uid, dst_id));" +
"edges_both = FOREACH A GENERATE" +
" group.uid AS src_id," +
" group.dst_id AS dst_id;" +
"both_counts = GROUP edges_both BY src_id;" +
"both_counts = FOREACH both_counts GENERATE" +
" group AS src_id, SIZE(edges_both) AS size_both;" +
"edges_bq = FOREACH A GENERATE" +
" group.uid AS src_id," +
" group.dst_id AS dst_id;" +
"bq_counts = GROUP edges_bq BY src_id;" +
"bq_counts = FOREACH bq_counts GENERATE" +
" group AS src_id, SIZE(edges_bq) AS size_bq;" +
"per_user_set_sizes = JOIN bq_counts BY src_id LEFT OUTER, both_counts BY src_id;" +
"store per_user_set_sizes into 'output' USING mock.Storage();");
List<Tuple> list = data.get("output");
Collections.sort(list);
assertEquals("list: "+list, 2, list.size());
assertEquals("(1,1,1,1)", list.get(0).toString());
assertEquals("(2,2,2,2)", list.get(1).toString());
}