Package org.apache.druid.segment
Class RowBasedSegment<RowType>
- java.lang.Object
-
- org.apache.druid.segment.RowBasedSegment<RowType>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Segment
- Direct Known Subclasses:
LookupSegment
public class RowBasedSegment<RowType> extends Object implements Segment
ASegmentthat is based on a stream of objects.
-
-
Constructor Summary
Constructors Constructor Description RowBasedSegment(SegmentId segmentId, Sequence<RowType> rowSequence, RowAdapter<RowType> rowAdapter, RowSignature rowSignature)Create a row-based segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryableIndexasQueryableIndex()StorageAdapterasStorageAdapter()voidclose()org.joda.time.IntervalgetDataInterval()SegmentIdgetId()
-
-
-
Constructor Detail
-
RowBasedSegment
public RowBasedSegment(SegmentId segmentId, Sequence<RowType> rowSequence, RowAdapter<RowType> rowAdapter, RowSignature rowSignature)
Create a row-based segment. The provided "rowIterable" must be in time-order according to the providedRowAdapter.timestampFunction(). The cursor returned byRowBasedStorageAdapter.makeCursors(org.apache.druid.query.filter.Filter, org.joda.time.Interval, org.apache.druid.segment.VirtualColumns, org.apache.druid.java.util.common.granularity.Granularity, boolean, org.apache.druid.query.QueryMetrics<?>)makes no attempt to verify this, and callers will expect it. The provided "rowSignature" will be used for reporting available columns and their capabilities to users ofasStorageAdapter(). Note that theColumnSelectorFactoryimplementation returned by this segment's storage adapter will allow creation of selectors on any field, using theRowAdapter.columnFunction(java.lang.String)for that field, even if it doesn't appear in "rowSignature".- Parameters:
segmentId- segment identifier; will be returned bygetId()rowSequence- objects that comprise this segment. Must be re-iterable if support forCursor.reset()is required. Otherwise, does not need to be re-iterable.rowAdapter- adapter used for reading these objectsrowSignature- signature of the columns in these objects
-
-
Method Detail
-
getDataInterval
@Nonnull public org.joda.time.Interval getDataInterval()
- Specified by:
getDataIntervalin interfaceSegment
-
asQueryableIndex
@Nullable public QueryableIndex asQueryableIndex()
- Specified by:
asQueryableIndexin interfaceSegment
-
asStorageAdapter
@Nonnull public StorageAdapter asStorageAdapter()
- Specified by:
asStorageAdapterin interfaceSegment
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-