Class SharedMinCompetitive

All Implemented Interfaces:
Closeable, AutoCloseable, RefCounted, Releasable

public class SharedMinCompetitive extends SideChannel
A thread safe, shared holder for the min competitive value from a set of TopNOperators.
  • Method Details

    • configs

    • offer

      public boolean offer(org.apache.lucene.util.BytesRef minCompetitive)
      Offer an update to the min competitive value.
      Parameters:
      minCompetitive - if it is accepted then the bytes are copied
      Returns:
      whether the update was accepted. false here means the minimum value in the local top n is greater than or equal to the minimum competitive value already recorded
    • markNoFurtherCandidates

      public void markNoFurtherCandidates()
      Signal that the source feeding this channel can stop entirely: no row it could still produce can be competitive. The generic TopNOperator calls this for a single-key NULLS FIRST sort once its top-K heap is saturated with nulls.
    • noFurtherCandidates

      public boolean noFurtherCandidates()
    • get

      @Nullable public Page get(BlockFactory blockFactory)
      Read the min competitive value. This will return null if there isn't yet a min competitive value. Otherwise, this will return a Page that contains single-position, single-valued Blocks.
    • minCompetitiveValue

      @Nullable public org.apache.lucene.util.BytesRef minCompetitiveValue()
      Decode the competitive bound of a single sort key into its raw BytesRef form, suitable for comparing directly against a format reader's column min/max statistics.

      Returns null when nothing has been offered yet, or when the most-competitive row's key is itself null — in that case there is no usable byte bound, because every non-null value may still be competitive (under NULLS LAST) and we must not skip any range.

      The returned BytesRef is an independent, read-only view over an immutable byte array that is never mutated in place. Callers may safely retain it after this method returns and across subsequent offer(org.apache.lucene.util.BytesRef) calls from other threads (a new offer publishes a fresh array and leaves earlier ones untouched), but must not mutate it: concurrent readers may view the same backing bytes.

      Only valid when this channel tracks exactly one key; a multi-key TopN does not expose a single comparable bound.

    • closeSideChannel

      protected void closeSideChannel()
      Specified by:
      closeSideChannel in class SideChannel