Example #1
0
  public BNLJoinExec(
      final TaskAttemptContext context,
      final JoinNode join,
      final PhysicalExec outer,
      PhysicalExec inner) {
    super(
        context,
        SchemaUtil.merge(outer.getSchema(), inner.getSchema()),
        SchemaUtil.merge(outer.getSchema(), inner.getSchema()),
        outer,
        inner);
    this.joinQual = join.getJoinQual();
    this.qualCtx = this.joinQual.newContext();
    this.outerTupleSlots = new ArrayList<Tuple>(TUPLE_SLOT_SIZE);
    this.innerTupleSlots = new ArrayList<Tuple>(TUPLE_SLOT_SIZE);
    this.outerIterator = outerTupleSlots.iterator();
    this.innerIterator = innerTupleSlots.iterator();
    this.innerEnd = false;
    this.outerEnd = false;

    // for projection
    targetIds = RowStoreUtil.getTargetIds(inSchema, outSchema);

    // for join
    frameTuple = new FrameTuple();
    outputTuple = new VTuple(outSchema.getColumnNum());
  }
Example #2
0
  public MergeJoinExec(
      TaskAttemptContext context,
      JoinNode plan,
      PhysicalExec outer,
      PhysicalExec inner,
      SortSpec[] outerSortKey,
      SortSpec[] innerSortKey) {
    super(context, plan.getInSchema(), plan.getOutSchema(), outer, inner);
    Preconditions.checkArgument(
        plan.hasJoinQual(),
        "Sort-merge join is only used for the equi-join, " + "but there is no join condition");
    this.joinNode = plan;
    this.joinQual = plan.getJoinQual();
    this.qualCtx = this.joinQual.newContext();

    this.outerTupleSlots = new ArrayList<Tuple>(INITIAL_TUPLE_SLOT);
    this.innerTupleSlots = new ArrayList<Tuple>(INITIAL_TUPLE_SLOT);
    SortSpec[][] sortSpecs = new SortSpec[2][];
    sortSpecs[0] = outerSortKey;
    sortSpecs[1] = innerSortKey;

    this.joincomparator = new JoinTupleComparator(outer.getSchema(), inner.getSchema(), sortSpecs);
    this.tupleComparator =
        PlannerUtil.getComparatorsFromJoinQual(
            plan.getJoinQual(), outer.getSchema(), inner.getSchema());
    this.outerIterator = outerTupleSlots.iterator();
    this.innerIterator = innerTupleSlots.iterator();

    // for projection
    this.projector = new Projector(inSchema, outSchema, plan.getTargets());
    this.evalContexts = projector.renew();

    // for join
    frameTuple = new FrameTuple();
    outTuple = new VTuple(outSchema.getColumnNum());
  }
Example #3
0
 public UnionExec(TaskAttemptContext context, PhysicalExec outer, PhysicalExec inner) {
   super(context, outer.getSchema(), inner.getSchema(), outer, inner);
   if (!outer.getSchema().equals(inner.getSchema())) {
     throw new InvalidQueryException("The both schemas are not same");
   }
 }