Class AbstractTSDBDocValuesConsumer

java.lang.Object
org.apache.lucene.codecs.DocValuesConsumer
org.elasticsearch.index.codec.tsdb.XDocValuesConsumer
org.elasticsearch.index.codec.tsdb.AbstractTSDBDocValuesConsumer
All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class AbstractTSDBDocValuesConsumer extends XDocValuesConsumer
Abstract base class for TSDB doc values consumers. Owns the shared wire-format logic for writing numeric, binary, sorted, sorted-numeric, and sorted-set doc values. Concrete subclasses provide the numeric encoding strategy via createNumericFieldWriter(NumericWriteContext).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Type tag written to meta for binary doc values fields.
     
    static final int
    Index block shift sentinel indicating ordinal range encoding.
    static final int
    Index block shift sentinel indicating a single ordinal (no index needed).
    static final byte
    Type tag written to meta for numeric doc values fields.
    protected final int
     
    static final byte
    Type tag written to meta for sorted doc values fields.
    static final byte
    Type tag written to meta for sorted-numeric doc values fields.
    static final byte
    Type tag written to meta for sorted-set doc values fields.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractTSDBDocValuesConsumer(org.apache.lucene.index.SegmentWriteState state, boolean enableOptimizedMerge, String dataCodec, String dataExtension, String metaCodec, String metaExtension, TSDBDocValuesFormatConfig formatConfig, DocOffsetsCodec.Encoder docOffsetsEncoder, SortedFieldObserverFactory sortedFieldObserverFactory)
    Construct a new consumer that writes doc values in the TSDB wire format.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBinaryField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer)
     
    void
    addNumericField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer)
     
    void
    addSortedField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer)
     
    void
    addSortedNumericField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer)
     
    void
    addSortedSetField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer)
     
    void
     
    protected abstract NumericFieldWriter
    Creates a numeric field writer for this segment.
    void
    mergeBinaryField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState)
     
    void
    mergeNumericField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState)
     
    void
    mergeSortedField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState)
     
    void
    mergeSortedNumericField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState)
     
    void
    mergeSortedSetField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState)
     

    Methods inherited from class org.elasticsearch.index.codec.tsdb.XDocValuesConsumer

    mergeBinaryField, mergeNumericField, mergeSortedField, mergeSortedNumericField, mergeSortedSetField

    Methods inherited from class org.apache.lucene.codecs.DocValuesConsumer

    createOrdinalMapForSortedDV, createOrdinalMapForSortedSetDV, getMergedBinaryDocValues, getMergedNumericDocValues, getMergedSortedNumericDocValues, getMergedSortedSetDocValues, getMergedSortedSetDocValues, isSingleValued, merge, mergeSortedValues, selectLeavesToMerge, singletonView

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NUMERIC

      public static final byte NUMERIC
      Type tag written to meta for numeric doc values fields.
      See Also:
    • BINARY

      public static final byte BINARY
      Type tag written to meta for binary doc values fields.
      See Also:
    • SORTED

      public static final byte SORTED
      Type tag written to meta for sorted doc values fields.
      See Also:
    • SORTED_SET

      public static final byte SORTED_SET
      Type tag written to meta for sorted-set doc values fields.
      See Also:
    • SORTED_NUMERIC

      public static final byte SORTED_NUMERIC
      Type tag written to meta for sorted-numeric doc values fields.
      See Also:
    • INDEX_SINGLE_ORDINAL

      public static final int INDEX_SINGLE_ORDINAL
      Index block shift sentinel indicating a single ordinal (no index needed).
      See Also:
    • INDEX_ORDINAL_RANGE

      public static final int INDEX_ORDINAL_RANGE
      Index block shift sentinel indicating ordinal range encoding.
      See Also:
    • numericBlockSize

      protected final int numericBlockSize
    • formatConfig

      protected final TSDBDocValuesFormatConfig formatConfig
  • Constructor Details

    • AbstractTSDBDocValuesConsumer

      protected AbstractTSDBDocValuesConsumer(org.apache.lucene.index.SegmentWriteState state, boolean enableOptimizedMerge, String dataCodec, String dataExtension, String metaCodec, String metaExtension, TSDBDocValuesFormatConfig formatConfig, DocOffsetsCodec.Encoder docOffsetsEncoder, SortedFieldObserverFactory sortedFieldObserverFactory) throws IOException
      Construct a new consumer that writes doc values in the TSDB wire format.
      Parameters:
      state - segment write state
      enableOptimizedMerge - whether optimized merge is enabled
      dataCodec - codec name for the data file header
      dataExtension - file extension for the data file
      metaCodec - codec name for the meta file header
      metaExtension - file extension for the meta file
      formatConfig - format-specific configuration for this codec version
      docOffsetsEncoder - encoder for doc offsets in compressed binary blocks
      sortedFieldObserverFactory - factory for creating observers during sorted field writes
      Throws:
      IOException
  • Method Details

    • createNumericFieldWriter

      protected abstract NumericFieldWriter createNumericFieldWriter(NumericWriteContext ctx)
      Creates a numeric field writer for this segment.

      Each codec version provides its own encoding strategy. The returned writer owns the full numeric field lifecycle: stats, ordinal detection, codec-specific metadata, block encoding, offsets, and DISI.

      Parameters:
      ctx - the shared write context for this segment
      Returns:
      a writer for numeric fields
      See Also:
    • addNumericField

      public void addNumericField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer) throws IOException
      Specified by:
      addNumericField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • mergeNumericField

      public void mergeNumericField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException
      Overrides:
      mergeNumericField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • mergeBinaryField

      public void mergeBinaryField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException
      Overrides:
      mergeBinaryField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • addBinaryField

      public void addBinaryField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer) throws IOException
      Specified by:
      addBinaryField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • addSortedField

      public void addSortedField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer) throws IOException
      Specified by:
      addSortedField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • mergeSortedField

      public void mergeSortedField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException
      Overrides:
      mergeSortedField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • addSortedNumericField

      public void addSortedNumericField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer) throws IOException
      Specified by:
      addSortedNumericField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • mergeSortedNumericField

      public void mergeSortedNumericField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException
      Overrides:
      mergeSortedNumericField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • mergeSortedSetField

      public void mergeSortedSetField(org.apache.lucene.index.FieldInfo mergeFieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException
      Overrides:
      mergeSortedSetField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • addSortedSetField

      public void addSortedSetField(org.apache.lucene.index.FieldInfo field, org.apache.lucene.codecs.DocValuesProducer valuesProducer) throws IOException
      Specified by:
      addSortedSetField in class org.apache.lucene.codecs.DocValuesConsumer
      Throws:
      IOException
    • close

      public void close() throws IOException
      Throws:
      IOException