@Test public void testMRCompilerErr() throws Exception { planTester.buildPlan("a = load 'input';"); LogicalPlan lp = planTester.buildPlan("b = filter a by $0 > 5;"); PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc); pp.remove(pp.getRoots().get(0)); try { Util.buildMRPlan(new PhysicalPlan(), pc); fail("Expected failure."); } catch (MRCompilerException mrce) { assertTrue(mrce.getErrorCode() == 2053); } }
/** * Test to ensure that the order by with parallel followed by a limit, i.e., top k always produces * the correct number of map reduce jobs */ @Test public void testNumReducersInLimitWithParallel() throws Exception { planTester.buildPlan("a = load 'input';"); planTester.buildPlan("b = order a by $0 parallel 2;"); planTester.buildPlan("c = limit b 10;"); LogicalPlan lp = planTester.buildPlan("store c into '/tmp';"); PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc); MROperPlan mrPlan = Util.buildMRPlan(pp, pc); MapReduceOper mrOper = mrPlan.getRoots().get(0); int count = 1; while (mrPlan.getSuccessors(mrOper) != null) { mrOper = mrPlan.getSuccessors(mrOper).get(0); ++count; } assertTrue(count == 4); }
@Test public void testMRCompilerErr1() throws Exception { PhysicalPlan pp = new PhysicalPlan(); PhysicalPlan ldFil1 = GenPhyOp.loadedFilter(); pp.merge(ldFil1); POSplit op = GenPhyOp.topSplitOp(); pp.addAsLeaf(op); try { Util.buildMRPlan(pp, pc); fail("Expected failure."); } catch (MRCompilerException mrce) { assertTrue(mrce.getErrorCode() == 2025); } }