예제 #1
0
  @Override
  protected PipelineOp newJoin(
      final BOp[] args,
      final int joinId,
      final IVariable<IV>[] joinVars,
      final Predicate<IV> predOp,
      final UUID queryId,
      final NV... annotations) {

    final Map<String, Object> tmp =
        NV.asMap(
            new NV(BOp.Annotations.EVALUATION_CONTEXT, BOpEvaluationContext.CONTROLLER), //
            new NV(Predicate.Annotations.BOP_ID, joinId), //
            new NV(PipelineJoin.Annotations.PREDICATE, predOp), //
            new NV(
                HTreeHashJoinAnnotations.RELATION_NAME,
                predOp.getRequiredProperty(Predicate.Annotations.RELATION_NAME)), //
            new NV(HashJoinAnnotations.JOIN_VARS, joinVars), //
            new NV(PipelineOp.Annotations.LAST_PASS, true), //
            new NV(PipelineOp.Annotations.MAX_PARALLEL, 1), //
            new NV(PipelineOp.Annotations.MAX_MEMORY, Bytes.megabyte), //
            new NV(
                NamedSetAnnotations.NAMED_SET_REF,
                NamedSolutionSetRefUtility.newInstance(queryId, getName(), joinVars)) //
            );

    if (predOp.isOptional()) {
      // Note: memory can not be constrained since predicate is optional.
      tmp.put(PipelineOp.Annotations.MAX_MEMORY, Long.MAX_VALUE);
    }

    if (annotations != null) {

      for (NV nv : annotations) {

        tmp.put(nv.getName(), nv.getValue());
      }
    }

    final PipelineOp joinOp = new HTreeHashJoinOp<IV>(args, tmp);

    return joinOp;
  }