@Test
public void testRestrictedColumnNamesWhitelist() throws Exception {
pigServer = new PigServer(LOCAL);
Data data = resetData(pigServer);
Set<Tuple> tuples = Sets.newHashSet(tuple(1),tuple(2),tuple(3));
data.set("foo",
"x:int",
tuples
);
pigServer.registerQuery("a = load 'foo' using mock.Storage();");
pigServer.registerQuery("a = foreach a generate x as rank;");
pigServer.registerQuery("a = foreach a generate rank as cube;");
pigServer.registerQuery("a = foreach a generate cube as y;");
pigServer.registerQuery("rank = a;");
pigServer.registerQuery("cube = rank;");
pigServer.registerQuery("rank = cube;");
pigServer.registerQuery("cube = foreach rank generate y as cube;");
pigServer.registerQuery("store cube into 'baz' using mock.Storage();");
List<Tuple> tuples2 = data.get("baz");
assertEquals(tuples.size(), tuples2.size());
for (Tuple t : tuples2) {
tuples.remove(t);
}
assertTrue(tuples.isEmpty());