org.modeshape.jcr.query.engine.process

## Class HashJoinSequence

- java.lang.Object
- - org.modeshape.jcr.query.NodeSequence
  - - org.modeshape.jcr.query.engine.process.DelegatingSequence
    - - org.modeshape.jcr.query.engine.process.BufferingSequence
      - - org.modeshape.jcr.query.engine.process.JoinSequence
        - - org.modeshape.jcr.query.engine.process.HashJoinSequence

-     @NotThreadSafe
      public class HashJoinSequence
      extends JoinSequence

  A `NodeSequence` implementation that performs an equijoin of two delegate sequences. The hash-join algorithm loads all values on the right side into a buffer that hashes the right join condition value of each row. Then, it iterates through all tuples on the left side and finds which of the values on the right have a matching join condition value.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `HashJoinSequence.HashCrossJoinBatch` A batch that contains rows that will have no left value and a right value.
    `protected class` | `HashJoinSequence.HashCrossJoinBatchFactory`
    `protected class` | `HashJoinSequence.HashJoinBatch` A batch that contains rows that will have a left value and a right value.
    `protected class` | `HashJoinSequence.HashJoinBatchFactory`
    `protected class` | `HashJoinSequence.HashJoinRangeBatch` A batch that contains rows that will have a left value and a right value.
    `protected class` | `HashJoinSequence.HashJoinRangeBatchFactory`
    `protected class` | `HashJoinSequence.RightRowsBatch` A batch that contains rows that will have no left value and a right value.

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.query.engine.process.JoinSequence

      `JoinSequence.BatchFactory, JoinSequence.EmptyBatchFactory, JoinSequence.LeftOnlyBatch, JoinSequence.LeftOnlyBatchFactory, JoinSequence.Range<K>, JoinSequence.RangeProducer<K>, JoinSequence.RightOnlyBatch, JoinSequence.RightOnlyBatchFactory`

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.query.NodeSequence

      `NodeSequence.AlternateSizeBatch, NodeSequence.Batch, NodeSequence.LimitBatch, NodeSequence.MultiWidthBatch, NodeSequence.Restartable, NodeSequence.RowAccessor, NodeSequence.RowFilter, NodeSequence.SingleWidthBatch`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JoinSequence.RangeProducer<Object>` | `rangeProducer`
    `protected BufferManager.DistinctBuffer<Object>` | `rightMatchedRowKeys`
    `protected BufferManager.DistinctBuffer<BufferedRows.BufferedRow>` | `rightRowsWithNullKey`

    - ### Fields inherited from class org.modeshape.jcr.query.engine.process.JoinSequence

      `batchSize, currentLeft, joinType, left, leftExtractor, leftWidth, totalWidth`

    - ### Fields inherited from class org.modeshape.jcr.query.engine.process.BufferingSequence

      `buffer, cache, extractor, logger, remainingRowCount, rowFactory, trace, width, workspaceName`

    - ### Fields inherited from class org.modeshape.jcr.query.engine.process.DelegatingSequence

      `delegate`

    - ### Fields inherited from class org.modeshape.jcr.query.NodeSequence

      `LOGGER, NO_PASS_ROW_FILTER, PASS_ROW_FILTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashJoinSequence(String workspaceName, NodeSequence left, NodeSequence right, RowExtractors.ExtractFromRow leftExtractor, RowExtractors.ExtractFromRow rightExtractor, JoinType joinType, BufferManager bufferMgr, CachedNodeSupplier nodeCache, JoinSequence.RangeProducer<?> rangeProducer, boolean pack, boolean useHeap)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Iterator<BufferedRows.BufferedRow>` | `allRightRows()`
    `void` | `close()` Signal that this node sequence is no longer needed.
    `protected JoinSequence.BatchFactory` | `initialize()` Called once when the implementation is to create a `JoinSequence.BatchFactory` for all batches returned by this join sequence.
    `String` | `toString()`

    - ### Methods inherited from class org.modeshape.jcr.query.engine.process.JoinSequence

      `findNextNonEmptyLeftBatch, isEmpty, nextBatch, useAllLeftRowsWhenNoMatchingRightRows, useAllRightRowsWhenNoLeftRows, useNonMatchingRightRows, width`

    - ### Methods inherited from class org.modeshape.jcr.query.engine.process.BufferingSequence

      `batchFrom, createRow, loadAll, rowCount`

    - ### Methods inherited from class org.modeshape.jcr.query.engine.process.DelegatingSequence

      `getRowCount`

    - ### Methods inherited from class org.modeshape.jcr.query.NodeSequence

      `append, batchFilteredWith, batchOf, batchOf, batchOf, batchOfKeys, batchOfKeys, batchOfKeys, batchOfKeys, batchWithCount, copy, emptyBatch, emptySequence, filter, keyFor, limit, limit, merging, requireBoth, requireEither, skip, withBatch, withBatches, withBatches, withNode, withNodeKeys, withNodeKeys, withNodeKeys, withNodeKeys, withNodes, withNodes`

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

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

- - ### Field Detail

    - #### rightMatchedRowKeys

          protected final BufferManager.DistinctBuffer<Object> rightMatchedRowKeys

    - #### rightRowsWithNullKey

          protected final BufferManager.DistinctBuffer<BufferedRows.BufferedRow> rightRowsWithNullKey

    - #### rangeProducer

          protected final JoinSequence.RangeProducer<Object> rangeProducer

  - ### Constructor Detail

    - #### HashJoinSequence

          public HashJoinSequence(String workspaceName,
                          NodeSequence left,
                          NodeSequence right,
                          RowExtractors.ExtractFromRow leftExtractor,
                          RowExtractors.ExtractFromRow rightExtractor,
                          JoinType joinType,
                          BufferManager bufferMgr,
                          CachedNodeSupplier nodeCache,
                          JoinSequence.RangeProducer<?> rangeProducer,
                          boolean pack,
                          boolean useHeap)

  - ### Method Detail

    - #### initialize

          protected JoinSequence.BatchFactory initialize()

      Description copied from class: `JoinSequence`
      Called once when the implementation is to create a `JoinSequence.BatchFactory` for all batches returned by this join sequence. This is called only when we know that there are at least some rows on the left side.
      Specified by:
        `initialize` in class `JoinSequence`
      Returns:
        the batch factory that should be used to obtain the batches; never null

    - #### allRightRows

          protected Iterator<BufferedRows.BufferedRow> allRightRows()

    - #### close

          public void close()

      Description copied from class: `NodeSequence`
      Signal that this node sequence is no longer needed.
      Overrides:
        `close` in class `JoinSequence`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.