Package org.apache.druid.timeline
Class DataSegment
java.lang.Object
org.apache.druid.timeline.DataSegment
- All Implemented Interfaces:
Comparable<DataSegment>,Overshadowable<DataSegment>
public class DataSegment
extends Object
implements Comparable<DataSegment>, Overshadowable<DataSegment>
Metadata of Druid's data segment. An immutable object.
DataSegment's equality (equals(java.lang.Object)/hashCode()) and compareTo(org.apache.druid.timeline.DataSegment) methods consider only the
SegmentId of the segment.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classThis class is needed for optional injection of pruneLoadSpec and pruneLastCompactionState, see github.com/google/guice/wiki/FrequentlyAskedQuestions#how-can-i-inject-optional-parameters-into-a-constructor -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataSegment(String dataSource, org.joda.time.Interval interval, String version, Map<String, Object> loadSpec, List<String> dimensions, List<String> metrics, List<String> projections, ShardSpec shardSpec, CompactionState lastCompactionState, Integer binaryVersion, long size, Integer totalRows, String indexingStateFingerprint, DataSegment.PruneSpecsHolder pruneSpecsHolder) DataSegment(String dataSource, org.joda.time.Interval interval, String version, Map<String, Object> loadSpec, List<String> dimensions, List<String> metrics, ShardSpec shardSpec, Integer binaryVersion, long size) Deprecated.DataSegment(String dataSource, org.joda.time.Interval interval, String version, Map<String, Object> loadSpec, List<String> dimensions, List<String> metrics, ShardSpec shardSpec, CompactionState lastCompactionState, Integer binaryVersion, long size) Deprecated.usebuilder(SegmentId)orbuilder(DataSegment)instead. -
Method Summary
Modifier and TypeMethodDescriptionstatic DataSegment.Builderbuilder()Deprecated.usebuilder(SegmentId)orbuilder(DataSegment)instead.static DataSegment.Builderbuilder(DataSegment segment) static DataSegment.Builderbuilder(DataSegment.Builder segmentBuilder) static DataSegment.BuilderintcompareTo(DataSegment dataSegment) booleanshortReturn the size of atomicUpdateGroup.Get dataSourceintSee doc ofOvershadowable.getStartRootPartitionId().getId()Get the inexing state fingerprint associated with this segment.org.joda.time.IntervalshortlonggetSize()intAll overshadowables have root partition range.booleanhasData()inthashCode()booleanbooleanovershadows(DataSegment other) Returns true if this overshadowable overshadows the other.static com.google.common.collect.Interner<String>toString()withBinaryVersion(int binaryVersion) withDimensions(List<String> dimensions) withIndexingStateFingerprint(String indexingStateFingerprint) withLastCompactionState(CompactionState compactionState) withLoadSpec(Map<String, Object> loadSpec) withMetrics(List<String> metrics) withProjections(List<String> projections) withShardSpec(ShardSpec newSpec) withSize(long size) withVersion(String version) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.timeline.Overshadowable
containsRootPartition
-
Field Details
-
TOMBSTONE_LOADSPEC_TYPE
- See Also:
-
-
Constructor Details
-
DataSegment
@Deprecated public DataSegment(String dataSource, org.joda.time.Interval interval, String version, Map<String, Object> loadSpec, List<String> dimensions, List<String> metrics, ShardSpec shardSpec, Integer binaryVersion, long size) Deprecated.usebuilder(SegmentId)orbuilder(DataSegment)instead. -
DataSegment
@Deprecated public DataSegment(String dataSource, org.joda.time.Interval interval, String version, Map<String, Object> loadSpec, List<String> dimensions, List<String> metrics, ShardSpec shardSpec, @Nullable CompactionState lastCompactionState, Integer binaryVersion, long size) Deprecated.usebuilder(SegmentId)orbuilder(DataSegment)instead. -
DataSegment
public DataSegment(String dataSource, org.joda.time.Interval interval, String version, @Nullable Map<String, Object> loadSpec, @Nullable List<String> dimensions, @Nullable List<String> metrics, @Nullable List<String> projections, @Nullable ShardSpec shardSpec, @Nullable CompactionState lastCompactionState, Integer binaryVersion, long size, Integer totalRows, String indexingStateFingerprint, DataSegment.PruneSpecsHolder pruneSpecsHolder)
-
-
Method Details
-
stringInterner
-
getDataSource
Get dataSource- Returns:
- the dataSource
-
getInterval
public org.joda.time.Interval getInterval() -
getLoadSpec
-
getVersion
- Specified by:
getVersionin interfaceOvershadowable<DataSegment>
-
getDimensions
-
getMetrics
-
getProjections
-
getShardSpec
-
getLastCompactionState
-
getBinaryVersion
-
getSize
public long getSize() -
getTotalRows
-
getId
-
isTombstone
public boolean isTombstone() -
getIndexingStateFingerprint
Get the inexing state fingerprint associated with this segment.A null fingerprint indicates that this segment either has not been compacted, or was compacted before compaction fingerprinting existed. In the latter case, the segment would have a non-null
lastCompactionState. -
overshadows
Description copied from interface:OvershadowableReturns true if this overshadowable overshadows the other.- Specified by:
overshadowsin interfaceOvershadowable<DataSegment>
-
getStartRootPartitionId
public int getStartRootPartitionId()Description copied from interface:OvershadowableAll overshadowables have root partition range. First-generation overshadowables have (partitionId, partitionId + 1) as their root partition range. Non-first-generation overshadowables are the overshadowables that overwrite first or non-first generation overshadowables, and they have the merged root partition range of all overwritten first-generation overshadowables. Note that first-generation overshadowables can be overwritten by a single non-first-generation overshadowable if they have consecutive partitionId. Non-first-generation overshadowables can be overwritten by another if their root partition ranges are consecutive.- Specified by:
getStartRootPartitionIdin interfaceOvershadowable<DataSegment>
-
getEndRootPartitionId
public int getEndRootPartitionId()Description copied from interface:OvershadowableSee doc ofOvershadowable.getStartRootPartitionId().- Specified by:
getEndRootPartitionIdin interfaceOvershadowable<DataSegment>
-
getMinorVersion
public short getMinorVersion()- Specified by:
getMinorVersionin interfaceOvershadowable<DataSegment>
-
getAtomicUpdateGroupSize
public short getAtomicUpdateGroupSize()Description copied from interface:OvershadowableReturn the size of atomicUpdateGroup. An atomicUpdateGroup is a set of segments which should be updated all together atomically inVersionedIntervalTimeline.- Specified by:
getAtomicUpdateGroupSizein interfaceOvershadowable<DataSegment>
-
toDescriptor
-
withLoadSpec
-
withDimensions
-
withMetrics
-
withProjections
-
withShardSpec
-
withSize
-
withVersion
-
withBinaryVersion
-
withLastCompactionState
-
withIndexingStateFingerprint
-
toBuilder
-
compareTo
- Specified by:
compareToin interfaceComparable<DataSegment>
-
equals
-
hashCode
public int hashCode() -
toString
-
builder
Deprecated.usebuilder(SegmentId)orbuilder(DataSegment)instead. -
builder
-
builder
-
builder
-
hasData
public boolean hasData()- Specified by:
hasDatain interfaceOvershadowable<DataSegment>
-
builder(SegmentId)orbuilder(DataSegment)instead.