Esempio n. 1
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;
      }
    }