@Test public final void testNLInnerJoin() throws IOException, PlanningException { FileFragment[] empFrags = StorageManager.splitNG(conf, "e", employee.getMeta(), employee.getPath(), Integer.MAX_VALUE); FileFragment[] peopleFrags = StorageManager.splitNG(conf, "p", people.getMeta(), people.getPath(), Integer.MAX_VALUE); FileFragment[] merged = TUtil.concat(empFrags, peopleFrags); Path workDir = CommonTestingUtil.getTestDir("target/test-data/testNLInnerJoin"); TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan), merged, workDir); ctx.setEnforcer(new Enforcer()); Expr context = analyzer.parse(QUERIES[1]); LogicalNode plan = planner.createPlan(context).getRootBlock().getRoot(); PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf, sm); PhysicalExec exec = phyPlanner.createPlan(ctx, plan); Tuple tuple; int i = 1; int count = 0; exec.init(); while ((tuple = exec.next()) != null) { count++; assertTrue(i == tuple.get(0).asInt4()); assertTrue(i == tuple.get(1).asInt4()); assertTrue(("dept_" + i).equals(tuple.get(2).asChars())); assertTrue(10 + i == tuple.get(3).asInt4()); i += 2; } exec.close(); assertEquals(50 / 2, count); }
public Tuple next() throws IOException { for (;;) { if (needNewOuter) { outerTuple = leftChild.next(); if (outerTuple == null) { return null; } needNewOuter = false; } innerTuple = rightChild.next(); if (innerTuple == null) { needNewOuter = true; rightChild.rescan(); continue; } frameTuple.set(outerTuple, innerTuple); if (joinQual != null) { if (joinQual.eval(inSchema, frameTuple).isTrue()) { projector.eval(frameTuple, outTuple); return outTuple; } } else { projector.eval(frameTuple, outTuple); return outTuple; } } }
NLJoinExec extends BinaryPhysicalExec { public Tuple next() throws IOException { for (;;) { if (needNewOuter) { outerTuple = leftChild.next(); if (outerTuple == null) { return null; } needNewOuter = false; } innerTuple = rightChild.next(); if (innerTuple == null) { needNewOuter = true; rightChild.rescan(); continue; } frameTuple.set(outerTuple, innerTuple); if (joinQual != null) { if (joinQual.eval(inSchema, frameTuple).isTrue()) { projector.eval(frameTuple, outTuple); return outTuple; } } else { projector.eval(frameTuple, outTuple); return outTuple; } } } }
NLJoinExec extends BinaryPhysicalExec { public Tuple next() throws IOException { for (;;) { if (needNewOuter) { outerTuple = leftChild.next(); if (outerTuple == null) { return null; } needNewOuter = false; } innerTuple = rightChild.next(); if (innerTuple == null) { needNewOuter = true; rightChild.rescan(); continue; } frameTuple.set(outerTuple, innerTuple); if (joinQual != null) { if (joinQual.eval(inSchema, frameTuple).isTrue()) { projector.eval(frameTuple, outTuple); return outTuple; } } else { projector.eval(frameTuple, outTuple); return outTuple; } } } NLJoinExec(TaskAttemptContext context, JoinNode plan, PhysicalExec outer,
      PhysicalExec inner); }
NLJoinExec extends BinaryPhysicalExec { public Tuple next() throws IOException { for (;;) { if (needNewOuter) { outerTuple = leftChild.next(); if (outerTuple == null) { return null; } needNewOuter = false; } innerTuple = rightChild.next(); if (innerTuple == null) { needNewOuter = true; rightChild.rescan(); continue; } frameTuple.set(outerTuple, innerTuple); if (joinQual != null) { if (joinQual.eval(inSchema, frameTuple).isTrue()) { projector.eval(frameTuple, outTuple); return outTuple; } } else { projector.eval(frameTuple, outTuple); return outTuple; } } } NLJoinExec(TaskAttemptContext context, JoinNode plan, PhysicalExec outer,
      PhysicalExec inner); JoinNode getPlan(); Tuple next(); @Override void rescan(); }
NLJoinExec extends BinaryPhysicalExec { public Tuple next() throws IOException { for (;;) { if (needNewOuter) { outerTuple = leftChild.next(); if (outerTuple == null) { return null; } needNewOuter = false; } innerTuple = rightChild.next(); if (innerTuple == null) { needNewOuter = true; rightChild.rescan(); continue; } frameTuple.set(outerTuple, innerTuple); if (joinQual != null) { if (joinQual.eval(inSchema, frameTuple).isTrue()) { projector.eval(frameTuple, outTuple); return outTuple; } } else { projector.eval(frameTuple, outTuple); return outTuple; } } } NLJoinExec(TaskAttemptContext context, JoinNode plan, PhysicalExec outer,
      PhysicalExec inner); JoinNode getPlan(); Tuple next(); @Override void rescan();  }