コード例 #1
0
  /**
   * @param args
   * @param annotations
   */
  public HashJoinOp(final BOp[] args, final Map<String, Object> annotations) {

    super(args, annotations);

    /*
     * Validate common requirements for all concrete implementations of this
     * operator.
     */

    switch (getEvaluationContext()) {
      case CONTROLLER:
      case SHARDED:
      case HASHED:
        break;
      default:
        throw new UnsupportedOperationException(
            Annotations.EVALUATION_CONTEXT + "=" + getEvaluationContext());
    }

    // Predicate for the access path must be specified.
    getPredicate();

    getRequiredProperty(Annotations.NAMED_SET_REF);

    // Join variables must be specified.
    final IVariable<?>[] joinVars = (IVariable[]) getRequiredProperty(Annotations.JOIN_VARS);

    //        if (joinVars.length == 0)
    //            throw new IllegalArgumentException(Annotations.JOIN_VARS);

    for (IVariable<?> var : joinVars) {

      if (var == null) throw new IllegalArgumentException(Annotations.JOIN_VARS);
    }
  }
コード例 #2
0
    public ChunkTask(final BOpContext<IBindingSet> context, final HashJoinOp<E> op) {

      this.context = context;

      this.stats = (BaseJoinStats) context.getStats();

      this.pred = op.getPredicate();

      this.relation = context.getRelation(pred);

      this.sink = context.getSink();

      this.sink2 = context.getSink2();

      this.op = op;

      {

        /*
         * First, see if the map already exists.
         *
         * Note: Since the operator is not thread-safe, we do not need
         * to use a putIfAbsent pattern here.
         *
         * Note: Publishing the [state] as a query attribute provides
         * visibility into the hash join against the access path even
         * for implementations (such as the JVMHashJoinOp) where the
         * entire operation will occur within a single evaluation pass.
         */

        final INamedSolutionSetRef namedSetRef =
            (INamedSolutionSetRef) op.getRequiredProperty(Annotations.NAMED_SET_REF);

        // Lookup the attributes for the query on which we will hang the
        // solution set.
        final IQueryAttributes attrs = context.getQueryAttributes(namedSetRef.getQueryId());

        IHashJoinUtility state = (IHashJoinUtility) attrs.get(namedSetRef);

        if (state == null) {

          state =
              op.newState(
                  context,
                  namedSetRef,
                  op.isOptional() ? JoinTypeEnum.Optional : JoinTypeEnum.Normal);

          attrs.put(namedSetRef, state);
        }

        this.state = state;
      }
    }