org.eclipse.rdf4j.query.algebra.evaluation.iterator

## Class HashJoinIteration

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
  - - org.eclipse.rdf4j.common.iteration.LookAheadIteration<BindingSet,QueryEvaluationException>
    - - org.eclipse.rdf4j.query.algebra.evaluation.iterator.HashJoinIteration

- All Implemented Interfaces:
    AutoCloseable, CloseableIteration<BindingSet,QueryEvaluationException>, Iteration<BindingSet,QueryEvaluationException>
  Direct Known Subclasses:
    LimitedSizeHashJoinIteration

      public class HashJoinIteration
      extends LookAheadIteration<BindingSet,QueryEvaluationException>

  Generic hash join implementation suitable for use by Sail implementations.
  Author:
    MJAHale

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String[]` | `joinAttributes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashJoinIteration(EvaluationStrategy strategy, CloseableIteration<BindingSet,QueryEvaluationException> leftIter, Set<String> leftBindingNames, CloseableIteration<BindingSet,QueryEvaluationException> rightIter, Set<String> rightBindingNames, boolean leftJoin)`
    `HashJoinIteration(EvaluationStrategy strategy, Join join, BindingSet bindings)`
    `HashJoinIteration(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings)`
    `HashJoinIteration(EvaluationStrategy strategy, TupleExpr left, TupleExpr right, BindingSet bindings, boolean leftJoin)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected <E> void` | `add(Collection<E> col, E value)`
    `protected <E> void` | `addAll(Collection<E> col, List<E> values)`
    `protected <E> void` | `closeHashValue(Iterator<E> iter)` Utility methods to clear-up in case not using in-memory hash table.
    `protected void` | `disposeCache(Iterator<BindingSet> iter)` Utility methods to clear-up in case not using in-memory cache.
    `protected void` | `disposeHashTable(Map<BindingSetHashKey,List<BindingSet>> map)` Utility methods to clear-up in case not using in-memory hash table.
    `protected BindingSet` | `getNextElement()` Gets the next element.
    `protected void` | `handleClose()` Called by `AbstractCloseableIteration.close()` when it is called for the first time.
    `protected Map<BindingSetHashKey,List<BindingSet>>` | `makeHashTable(int initialSize)` Utility methods to make it easier to inserted custom store dependent maps
    `protected List<BindingSet>` | `makeHashValue(int currentMaxListSize)` Utility methods to make it easier to inserted custom store dependent list
    `protected Collection<BindingSet>` | `makeIterationCache(CloseableIteration<BindingSet,QueryEvaluationException> iter)` Utility methods to make it easier to inserted custom store dependent list
    `protected <E> E` | `nextFromCache(Iterator<E> iter)`
    `protected void` | `putHashTableEntry(Map<BindingSetHashKey,List<BindingSet>> nextHashTable, BindingSetHashKey hashKey, List<BindingSet> hashValue, boolean newEntry)`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration

      `hasNext, next, remove`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

      `close, isClosed`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

      `stream`

- - ### Field Detail

    - #### joinAttributes

          protected final String[] joinAttributes

  - ### Constructor Detail

    - #### HashJoinIteration

          public HashJoinIteration(EvaluationStrategy strategy,
                                   Join join,
                                   BindingSet bindings)
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### HashJoinIteration

          public HashJoinIteration(EvaluationStrategy strategy,
                                   LeftJoin join,
                                   BindingSet bindings)
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### HashJoinIteration

          public HashJoinIteration(EvaluationStrategy strategy,
                                   TupleExpr left,
                                   TupleExpr right,
                                   BindingSet bindings,
                                   boolean leftJoin)
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### HashJoinIteration

          public HashJoinIteration(EvaluationStrategy strategy,
                                   CloseableIteration<BindingSet,QueryEvaluationException> leftIter,
                                   Set<String> leftBindingNames,
                                   CloseableIteration<BindingSet,QueryEvaluationException> rightIter,
                                   Set<String> rightBindingNames,
                                   boolean leftJoin)
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

  - ### Method Detail

    - #### getNextElement

          protected BindingSet getNextElement()
                                       throws QueryEvaluationException

      Description copied from class: `LookAheadIteration`
      Gets the next element. Subclasses should implement this method so that it returns the next element.
      Specified by:
        `getNextElement` in class `LookAheadIteration<BindingSet,QueryEvaluationException>`
      Returns:
        The next element, or `null` if no more elements are available.
      Throws:
        `QueryEvaluationException`

    - #### handleClose

          protected void handleClose()
                              throws QueryEvaluationException

      Description copied from class: `AbstractCloseableIteration`
      Called by `AbstractCloseableIteration.close()` when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
      Overrides:
        `handleClose` in class `LookAheadIteration<BindingSet,QueryEvaluationException>`
      Throws:
        `QueryEvaluationException`

    - #### putHashTableEntry

          protected void putHashTableEntry(Map<BindingSetHashKey,List<BindingSet>> nextHashTable,
                                           BindingSetHashKey hashKey,
                                           List<BindingSet> hashValue,
                                           boolean newEntry)
                                    throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### makeIterationCache

          protected Collection<BindingSet> makeIterationCache(CloseableIteration<BindingSet,QueryEvaluationException> iter)

      Utility methods to make it easier to inserted custom store dependent list
      Returns:
        list

    - #### makeHashTable

          protected Map<BindingSetHashKey,List<BindingSet>> makeHashTable(int initialSize)

      Utility methods to make it easier to inserted custom store dependent maps
      Returns:
        map

    - #### makeHashValue

          protected List<BindingSet> makeHashValue(int currentMaxListSize)

      Utility methods to make it easier to inserted custom store dependent list
      Returns:
        list

    - #### disposeCache

          protected void disposeCache(Iterator<BindingSet> iter)

      Utility methods to clear-up in case not using in-memory cache.

    - #### disposeHashTable

          protected void disposeHashTable(Map<BindingSetHashKey,List<BindingSet>> map)

      Utility methods to clear-up in case not using in-memory hash table.

    - #### closeHashValue

          protected <E> void closeHashValue(Iterator<E> iter)

      Utility methods to clear-up in case not using in-memory hash table.

    - #### nextFromCache

          protected <E> E nextFromCache(Iterator<E> iter)

    - #### add

          protected <E> void add(Collection<E> col,
                                 E value)
                          throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### addAll

          protected <E> void addAll(Collection<E> col,
                                    List<E> values)
                             throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.