Interface DimensionMerger

    • Method Detail

      • convertSortedSegmentRowValuesToMergedRowValues

        ColumnValueSelector convertSortedSegmentRowValuesToMergedRowValues​(int segmentIndex,
                                                                           ColumnValueSelector source)
        Creates a value selector, which converts values with per-segment, _sorted order_ (see DimensionIndexer.convertUnsortedValuesToSorted(org.apache.druid.segment.ColumnValueSelector)) encoding from the given selector to their equivalent representation in the merged set of rows. This method is used by the index merging process to build the merged sequence of rows. The implementing class is expected to use the merged value metadata constructed during writeMergedValueDictionary(List), if applicable. For example, an implementation of this function for a dictionary-encoded String column would convert the segment-specific, sorted order dictionary values within the row to the common merged dictionary values determined during writeMergedValueDictionary(List).
        Parameters:
        segmentIndex - indicates which segment the row originated from, in the order established in writeMergedValueDictionary(List)
        source - the selector from which to take values to convert
        Returns:
        a selector with converted values
      • processMergedRow

        void processMergedRow​(ColumnValueSelector selector)
                       throws IOException
        Process a column value(s) (potentially multi-value) of a row from the given selector and update the DimensionMerger's internal state. After constructing a merged sequence of rows across segments, the index merging process will iterate through these rows and on each iteration, for each column, pass the column value selector to the corresponding DimensionMerger. This allows each DimensionMerger to build its internal view of the sequence of merged rows, to be written out to a segment later.
        Throws:
        IOException
      • writeIndexes

        void writeIndexes​(@Nullable
                          List<IntBuffer> segmentRowNumConversions)
                   throws IOException
        Internally construct any index structures relevant to this DimensionMerger. After receiving the sequence of merged rows via iterated processMergedRow(org.apache.druid.segment.ColumnValueSelector) calls, the DimensionMerger can now build any index structures it needs. For example, a dictionary encoded String implementation would create its bitmap indexes for the merged segment during this step. The index merger will provide a list of row number conversion IntBuffer objects. Each IntBuffer is associated with one of the segments being merged; the position of the IntBuffer in the list corresponds to the position of segment adapters within the input list of writeMergedValueDictionary(List). For example, suppose there are two segments A and B. Row 24 from segment A maps to row 99 in the merged sequence of rows, The IntBuffer for segment A would have a mapping of 24 -> 99.
        Parameters:
        segmentRowNumConversions - A list of row number conversion IntBuffer objects.
        Throws:
        IOException
      • hasOnlyNulls

        boolean hasOnlyNulls()
        Returns true if this dimension has no data besides nulls. See NullColumnPartSerde for how null-only columns are stored in the segment.