Class Sink
- java.lang.Object
-
- org.apache.druid.segment.realtime.plumber.Sink
-
- All Implemented Interfaces:
Iterable<FireHydrant>,org.apache.druid.timeline.Overshadowable<Sink>
public class Sink extends Object implements Iterable<FireHydrant>, org.apache.druid.timeline.Overshadowable<Sink>
-
-
Constructor Summary
Constructors Constructor Description Sink(org.joda.time.Interval interval, DataSchema schema, org.apache.druid.timeline.partition.ShardSpec shardSpec, String version, org.apache.druid.segment.incremental.AppendableIndexSpec appendableIndexSpec, int maxRowsInMemory, long maxBytesInMemory, boolean useMaxMemoryEstimates, String dedupColumn)Sink(org.joda.time.Interval interval, DataSchema schema, org.apache.druid.timeline.partition.ShardSpec shardSpec, String version, org.apache.druid.segment.incremental.AppendableIndexSpec appendableIndexSpec, int maxRowsInMemory, long maxBytesInMemory, boolean useMaxMemoryEstimates, String dedupColumn, List<FireHydrant> hydrants)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<SinkSegmentReference>acquireSegmentReferences(Function<org.apache.druid.segment.SegmentReference,org.apache.druid.segment.SegmentReference> segmentMapFn, boolean skipIncrementalSegment)Acquire references to allFireHydrantthat represent this sink.org.apache.druid.segment.incremental.IncrementalIndexAddResultadd(org.apache.druid.data.input.InputRow row, boolean skipMaxRowsInMemoryCheck)booleancanAppendRow()voidclearDedupCache()booleanfinished()booleanfinishWriting()Marks sink as 'finished', preventing further writes.shortgetAtomicUpdateGroupSize()longgetBytesInMemory()FireHydrantgetCurrHydrant()intgetEndRootPartitionId()org.joda.time.IntervalgetInterval()shortgetMinorVersion()intgetNumRows()intgetNumRowsInMemory()org.apache.druid.timeline.DataSegmentgetSegment()org.apache.druid.segment.column.RowSignaturegetSignature()Get column information from all theFireHydrant's.intgetStartRootPartitionId()StringgetVersion()booleanisEmpty()booleanisWritable()Iterator<FireHydrant>iterator()booleanovershadows(Sink other)FireHydrantswap()If currHydrant is A, creates a new index B, sets currHydrant to B and returns A.booleanswappable()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Sink
public Sink(org.joda.time.Interval interval, DataSchema schema, org.apache.druid.timeline.partition.ShardSpec shardSpec, String version, org.apache.druid.segment.incremental.AppendableIndexSpec appendableIndexSpec, int maxRowsInMemory, long maxBytesInMemory, boolean useMaxMemoryEstimates, String dedupColumn)
-
Sink
public Sink(org.joda.time.Interval interval, DataSchema schema, org.apache.druid.timeline.partition.ShardSpec shardSpec, String version, org.apache.druid.segment.incremental.AppendableIndexSpec appendableIndexSpec, int maxRowsInMemory, long maxBytesInMemory, boolean useMaxMemoryEstimates, String dedupColumn, List<FireHydrant> hydrants)
-
-
Method Detail
-
clearDedupCache
public void clearDedupCache()
-
getInterval
public org.joda.time.Interval getInterval()
-
getCurrHydrant
public FireHydrant getCurrHydrant()
-
add
public org.apache.druid.segment.incremental.IncrementalIndexAddResult add(org.apache.druid.data.input.InputRow row, boolean skipMaxRowsInMemoryCheck) throws org.apache.druid.segment.incremental.IndexSizeExceededException- Throws:
org.apache.druid.segment.incremental.IndexSizeExceededException
-
canAppendRow
public boolean canAppendRow()
-
isEmpty
public boolean isEmpty()
-
isWritable
public boolean isWritable()
-
swap
public FireHydrant swap()
If currHydrant is A, creates a new index B, sets currHydrant to B and returns A.- Returns:
- the current index after swapping in a new one
-
swappable
public boolean swappable()
-
finished
public boolean finished()
-
finishWriting
public boolean finishWriting()
Marks sink as 'finished', preventing further writes.- Returns:
- 'true' if sink was sucessfully finished, 'false' if sink was already finished
-
getSegment
public org.apache.druid.timeline.DataSegment getSegment()
-
getNumRows
public int getNumRows()
-
getNumRowsInMemory
public int getNumRowsInMemory()
-
getBytesInMemory
public long getBytesInMemory()
-
acquireSegmentReferences
@Nullable public List<SinkSegmentReference> acquireSegmentReferences(Function<org.apache.druid.segment.SegmentReference,org.apache.druid.segment.SegmentReference> segmentMapFn, boolean skipIncrementalSegment)
Acquire references to allFireHydrantthat represent this sink. Returns null if they cannot all be acquired, possibly because they were closed (swapped to null) concurrently with this method being called.- Parameters:
segmentMapFn- fromDataSource.createSegmentMapFunction(Query, AtomicLong)skipIncrementalSegment- whether in-memoryIncrementalIndexsegments should be skipped
-
getSignature
public org.apache.druid.segment.column.RowSignature getSignature()
Get column information from all theFireHydrant's.
-
iterator
public Iterator<FireHydrant> iterator()
- Specified by:
iteratorin interfaceIterable<FireHydrant>
-
overshadows
public boolean overshadows(Sink other)
- Specified by:
overshadowsin interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
getStartRootPartitionId
public int getStartRootPartitionId()
- Specified by:
getStartRootPartitionIdin interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
getEndRootPartitionId
public int getEndRootPartitionId()
- Specified by:
getEndRootPartitionIdin interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
getVersion
public String getVersion()
- Specified by:
getVersionin interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
getMinorVersion
public short getMinorVersion()
- Specified by:
getMinorVersionin interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
getAtomicUpdateGroupSize
public short getAtomicUpdateGroupSize()
- Specified by:
getAtomicUpdateGroupSizein interfaceorg.apache.druid.timeline.Overshadowable<Sink>
-
-