Class SegmentMetadataImpl
- java.lang.Object
-
- org.apache.pinot.segment.spi.index.metadata.SegmentMetadataImpl
-
- All Implemented Interfaces:
SegmentMetadata
public class SegmentMetadataImpl extends Object implements SegmentMetadata
-
-
Constructor Summary
Constructors Constructor Description SegmentMetadataImpl(File indexDir)For segments on disk.SegmentMetadataImpl(InputStream metadataPropertiesInputStream, InputStream creationMetaInputStream)For segments that can only provide the inputstream to the metadataSegmentMetadataImpl(String rawTableName, String segmentName, Schema schema, long creationTime)For REALTIME consuming segments.
-
Method Summary
Modifier and Type Method Description Map<String,ColumnMetadata>getColumnMetadataMap()StringgetCrc()StringgetCreatorName()Map<String,String>getCustomMap()StringgetEndOffset()longgetEndTime()longgetIndexCreationTime()FilegetIndexDir()longgetLastIndexedTimestamp()Return the last time a record was indexed in this segment.longgetLatestIngestionTimestamp()Return the latest ingestion timestamp associated with the records indexed in this segment.StringgetName()SchemagetSchema()StringgetStartOffset()List<StarTreeV2Metadata>getStarTreeV2MetadataList()longgetStartTime()StringgetTableName()Returns the raw table name (without the type suffix).StringgetTimeColumn()org.joda.time.DurationgetTimeGranularity()org.joda.time.IntervalgetTimeInterval()TimeUnitgetTimeUnit()intgetTotalDocs()SegmentVersiongetVersion()voidremoveColumn(String column)Removes a column from the segment metadata.com.fasterxml.jackson.databind.JsonNodetoJson(Set<String> columnFilter)Converts segment metadata to json.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.segment.spi.SegmentMetadata
getAllColumns, getColumnMetadataFor, isMutableSegment
-
-
-
-
Constructor Detail
-
SegmentMetadataImpl
public SegmentMetadataImpl(InputStream metadataPropertiesInputStream, InputStream creationMetaInputStream) throws IOException
For segments that can only provide the inputstream to the metadata- Throws:
IOException
-
SegmentMetadataImpl
public SegmentMetadataImpl(File indexDir) throws IOException
For segments on disk.Index directory passed in should be top level segment directory.
If segment metadata file exists in multiple segment version, load the one in highest segment version.
- Throws:
IOException
-
-
Method Detail
-
getTableName
public String getTableName()
Description copied from interface:SegmentMetadataReturns the raw table name (without the type suffix).- Specified by:
getTableNamein interfaceSegmentMetadata
-
getName
public String getName()
- Specified by:
getNamein interfaceSegmentMetadata
-
getTimeColumn
public String getTimeColumn()
- Specified by:
getTimeColumnin interfaceSegmentMetadata
-
getStartTime
public long getStartTime()
- Specified by:
getStartTimein interfaceSegmentMetadata
-
getEndTime
public long getEndTime()
- Specified by:
getEndTimein interfaceSegmentMetadata
-
getTimeUnit
public TimeUnit getTimeUnit()
- Specified by:
getTimeUnitin interfaceSegmentMetadata
-
getTimeGranularity
public org.joda.time.Duration getTimeGranularity()
- Specified by:
getTimeGranularityin interfaceSegmentMetadata
-
getTimeInterval
public org.joda.time.Interval getTimeInterval()
- Specified by:
getTimeIntervalin interfaceSegmentMetadata
-
getCrc
public String getCrc()
- Specified by:
getCrcin interfaceSegmentMetadata
-
getVersion
public SegmentVersion getVersion()
- Specified by:
getVersionin interfaceSegmentMetadata
-
getSchema
public Schema getSchema()
- Specified by:
getSchemain interfaceSegmentMetadata
-
getTotalDocs
public int getTotalDocs()
- Specified by:
getTotalDocsin interfaceSegmentMetadata
-
getIndexDir
public File getIndexDir()
- Specified by:
getIndexDirin interfaceSegmentMetadata
-
getCreatorName
@Nullable public String getCreatorName()
- Specified by:
getCreatorNamein interfaceSegmentMetadata
-
getIndexCreationTime
public long getIndexCreationTime()
- Specified by:
getIndexCreationTimein interfaceSegmentMetadata
-
getLastIndexedTimestamp
public long getLastIndexedTimestamp()
Description copied from interface:SegmentMetadataReturn the last time a record was indexed in this segment. Applicable for MutableSegments.- Specified by:
getLastIndexedTimestampin interfaceSegmentMetadata- Returns:
- time when the last record was indexed
-
getLatestIngestionTimestamp
public long getLatestIngestionTimestamp()
Description copied from interface:SegmentMetadataReturn the latest ingestion timestamp associated with the records indexed in this segment. Applicable for MutableSegments.- Specified by:
getLatestIngestionTimestampin interfaceSegmentMetadata- Returns:
- latest timestamp associated with indexed records
Long.MIN_VALUEif the stream doesn't provide a timestamp
-
getStarTreeV2MetadataList
public List<StarTreeV2Metadata> getStarTreeV2MetadataList()
- Specified by:
getStarTreeV2MetadataListin interfaceSegmentMetadata
-
getCustomMap
public Map<String,String> getCustomMap()
- Specified by:
getCustomMapin interfaceSegmentMetadata
-
getStartOffset
public String getStartOffset()
- Specified by:
getStartOffsetin interfaceSegmentMetadata
-
getEndOffset
public String getEndOffset()
- Specified by:
getEndOffsetin interfaceSegmentMetadata
-
getColumnMetadataMap
public Map<String,ColumnMetadata> getColumnMetadataMap()
- Specified by:
getColumnMetadataMapin interfaceSegmentMetadata
-
removeColumn
public void removeColumn(String column)
Description copied from interface:SegmentMetadataRemoves a column from the segment metadata.- Specified by:
removeColumnin interfaceSegmentMetadata
-
toJson
public com.fasterxml.jackson.databind.JsonNode toJson(@Nullable Set<String> columnFilter)Description copied from interface:SegmentMetadataConverts segment metadata to json.- Specified by:
toJsonin interfaceSegmentMetadata- Parameters:
columnFilter- list only the columns in the set. Lists all the columns if the parameter value is null.- Returns:
- json representation of segment metadata.
-
-