Class ArrayListSegment<RowType>
- java.lang.Object
-
- org.apache.druid.segment.ArrayListSegment<RowType>
-
-
Constructor Summary
Constructors Constructor Description ArrayListSegment(SegmentId segmentId, ArrayList<RowType> rows, RowAdapter<RowType> rowAdapter, RowSignature rowSignature)
Create a list-based segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(Class<T> clazz)
Request an implementation of a particular interface.QueryableIndex
asQueryableIndex()
StorageAdapter
asStorageAdapter()
void
close()
org.joda.time.Interval
getDataInterval()
SegmentId
getId()
-
-
-
Constructor Detail
-
ArrayListSegment
public ArrayListSegment(SegmentId segmentId, ArrayList<RowType> rows, RowAdapter<RowType> rowAdapter, RowSignature rowSignature)
Create a list-based segment.The provided List must be in time-order according to the provided
RowAdapter.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 of
asStorageAdapter()
. Note that theColumnSelectorFactory
implementation 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()
rows
- 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:
getDataInterval
in interfaceSegment
-
asQueryableIndex
@Nullable public QueryableIndex asQueryableIndex()
- Specified by:
asQueryableIndex
in interfaceSegment
-
asStorageAdapter
@Nonnull public StorageAdapter asStorageAdapter()
- Specified by:
asStorageAdapter
in interfaceSegment
-
as
@Nullable public <T> T as(Class<T> clazz)
Description copied from interface:Segment
Request an implementation of a particular interface. If the passed-in interface isQueryableIndex
orStorageAdapter
, then this method behaves identically toSegment.asQueryableIndex()
orSegment.asStorageAdapter()
. Other interfaces are only expected to be requested by callers that have specific knowledge of extra features provided by specific segment types. For example, an extension might provide a custom Segment type that can offer both StorageAdapter and some new interface. That extension can also offer a Query that uses that new interface. Implementations which accept classes other thanQueryableIndex
orStorageAdapter
are limited to using those classes within the extension. This means that one extension cannot rely on the `Segment.as` behavior of another extension.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-