int groups = 0;
for (int i : nums) {
if (i > 0) groups++;
}
PigServer pigServer = new PigServer(ExecType.MAPREDUCE,
cluster.getProperties());
pigServer.setBatchOn();
pigServer.registerQuery("a = load '" + file + "';");
pigServer.registerQuery("b = filter a by $0 >= 50;");
pigServer.registerQuery("c = group b by $0;");
pigServer.registerQuery("d = foreach c generate group;");
pigServer.registerQuery("e = filter a by $0 < 50;");
pigServer.registerQuery("f = group e by $0;");
pigServer.registerQuery("g = foreach f generate group;");
pigServer.registerQuery("store d into '/tmp/outout1';");
pigServer.registerQuery("store g into '/tmp/outout2';");
List<ExecJob> jobs = pigServer.executeBatch();
PigStats stats = jobs.get(0).getStatistics();
assertTrue(stats.getOutputLocations().size() == 2);
cluster.getFileSystem().delete(new Path(file), true);