@Test public void testLimitAdjusterFuncShipped() throws Exception { String query = "a = load 'input';" + "b = order a by $0 parallel 2;" + "c = limit b 7;" + "store c into 'output' using " + PigStorageNoDefCtor.class.getName() + "('\t');"; PhysicalPlan pp = Util.buildPp(pigServerMR, query); MROperPlan mrPlan = Util.buildMRPlan(pp, pc); LimitAdjuster la = new LimitAdjuster(mrPlan, pc); la.visit(); la.adjust(); MapReduceOper mrOper = mrPlan.getRoots().get(0); int count = 1; while (mrPlan.getSuccessors(mrOper) != null) { mrOper = mrPlan.getSuccessors(mrOper).get(0); ++count; } assertEquals(4, count); MapReduceOper op = mrPlan.getLeaves().get(0); assertTrue(op.UDFs.contains(new FuncSpec(PigStorageNoDefCtor.class.getName()) + "('\t')")); }
@Test public void testCastFuncShipped() throws Exception { String query = "a = load 'input1' using " + PigStorageNoDefCtor.class.getName() + "('\t') as (a0, a1, a2);" + "b = group a by a0;" + "c = foreach b generate flatten(a);" + "d = order c by a0;" + "e = foreach d generate a1+a2;" + "store e into 'output';"; PhysicalPlan pp = Util.buildPp(pigServer, query); MROperPlan mp = Util.buildMRPlan(pp, pc); MapReduceOper op = mp.getLeaves().get(0); assertTrue(op.UDFs.contains(new FuncSpec(PigStorageNoDefCtor.class.getName()) + "('\t')")); }