Class ArrayListSegment<RowType>
- java.lang.Object
-
- org.apache.druid.segment.RowBasedSegment<RowType>
-
- org.apache.druid.segment.ArrayListSegment<RowType>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Segment
public class ArrayListSegment<RowType> extends RowBasedSegment<RowType>
ASegmentthat is based on a stream of objects.
-
-
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> Tas(Class<T> clazz)Request an implementation of a particular interface.voidclose()-
Methods inherited from class org.apache.druid.segment.RowBasedSegment
asCursorFactory, asQueryableIndex, getDataInterval, getId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.Segment
asStorageAdapter, asString, isTombstone
-
-
-
-
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 byRowBasedCursorFactory.makeCursorHolder(CursorBuildSpec)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
RowBasedSegment.asCursorFactory(). Note that theColumnSelectorFactoryimplementation returned by this segment's cursor factory 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 byRowBasedSegment.getId()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
-
as
@Nullable public <T> T as(Class<T> clazz)
Description copied from interface:SegmentRequest an implementation of a particular interface.If the passed-in interface is
QueryableIndexorCursorFactory, then this method behaves identically toSegment.asQueryableIndex()orSegment.asCursorFactory(). 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 than
QueryableIndexorCursorFactoryare limited to using those classes within the extension. This means that one extension cannot rely on the `Segment.as` behavior of another extension.- Type Parameters:
T- desired interface- Parameters:
clazz- desired interface- Returns:
- instance of clazz, or null if the interface is not supported by this segment, one of the following:
-
CursorFactory, to make cursors to run queries. Never null. -
QueryableIndex, index object, if this is a memory-mapped regular segment. -
IndexedTable, table object, if this is a joinable indexed table. -
TimeBoundaryInspector, inspector for min/max timestamps, if supported by this segment. -
PhysicalSegmentInspector, inspector for physical segment details, if supported by this segment. -
MaxIngestedEventTimeInspector, inspector forDataSourceMetadataResultValue.getMaxIngestedEventTime() -
TopNOptimizationInspector, inspector containing information for topN specific optimizations -
CloseableShapeshifter, stepping stone toRowsAndColumns. -
BypassRestrictedSegment, a policy-aware segment, converted from a policy-enforced segment.
-
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classRowBasedSegment<RowType>
-
-