Class LocalColumnLocation
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,StringUtils.StringKeyedObject,ColumnLocation,DeephavenFormatColumnLocation,NamedImplementation
Implements filesystem layout for Iris DB filesystem-backed columns, relative to a LocalTableLocation.
Header format explanations: (all sizes/offsets are in bytes)
Variables:
- m = serialized metadata object size
- d = data start position
- m_h = min(d - 8, m) = size of the serialized metadata object prefix stored in the primary file's header region
- m_o = m - m_h = size of the serialized metadata object suffix stored in an overflow file (usually 0)
- e = end of file
Format for data and symbol offset files (by byte range):
- [0 - 3]: serialized metadata object size (m)
- [4 - 7]: data start position (d)
- [8 - m_h): serialized metadata object prefix
- [m_h - d): unused space
- [d - e): binary column data
Note that m and d are written in big-endian byte order. The high bit of m denotes the byte order of all subsequent data in the file, with 0 denoting big-endian byte order and 1 denoting little-endian byte order. The higher 14 bits of d should also be considered reserved - the current maximum value used is 128K (1 << 17).
Typically, the metadata object for a data file is just the partitionKeysToRange map (a Map<TYPE, int[]>) or null if the column location is not grouped. For a symbol offset file, the metadata object is typically null.
Legacy column locations may have data and symbol offset files that instead contain an instance of a DiskMappedDataColumn subclass, which in turn may contain a valid partitionKeysToRange map. ColumnFileHeaderObjectInputStream handles translation in this case.
-
Constructor Summary
ConstructorsConstructorDescriptionLocalColumnLocation(LocalTableLocation tableLocation, String name) Construct a new LocalColumnLocation for the specified LocalTableLocation and column name. -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteOrderdecodeByteOrder(long encodedHeaderPrefix) Decode the byte order from a header prefix (represented as a long).static intdecodeDataStartPosition(long encodedHeaderPrefix) Decode the data start position from a header prefix (represented as a long).static intdecodeMetadataSize(long encodedHeaderPrefix) Decode the metadata size from a header prefix (represented as a long).static ColumnFileTypeDetailsdetailsFor(ColumnFileType type) final ByteOrderRead the ByteOrder for this location from the file header.static longencodeHeaderPrefix(ByteOrder byteOrder, int metadataSize, int dataStartPosition) Encode the two fields in the header prefix into a single long.booleanexists()Check for existence of this ColumnLocation.final ByteOrderGet theByteOrderused by allFileDataBufferStores associated with this column location.getColumnFile(ColumnFileType columnFileType) getColumnFileBufferStore(ColumnFileType columnFileType) Get theFileDataBufferStorefor buffers from this column location for the specifiedColumnFileType.getColumnFileDataAccessor(ColumnFileType columnFileType) intgetColumnFileDataStartPosition(ColumnFileType columnFileType) getColumnFileName(ColumnFileType columnFileType) <METADATA_TYPE>
METADATA_TYPEstatic <METADATA_TYPE>
METADATA_TYPEgetMetadata(String description, int columnVersion, Function<ColumnFileTypeDetails, ColumnFileState> stateLookup) static booleanhasHeader(ColumnFileType type, int columnVersion) voidinitializeColumnFile(ColumnFileType columnFileType) booleanCheck if the symbol table file exists.Methods inherited from class com.illumon.iris.db.v2.locations.AbstractColumnLocation
getName, getTableLocation, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.locations.ColumnLocation
append, cast, getFormat, getName, getStringRepresentation, getTableLocation, toStringHelperMethods inherited from interface com.illumon.iris.db.v2.locations.DeephavenFormatColumnLocation
makeColumnRegionByte, makeColumnRegionChar, makeColumnRegionDouble, makeColumnRegionFloat, makeColumnRegionInt, makeColumnRegionLong, makeColumnRegionObject, makeColumnRegionShortMethods inherited from interface com.illumon.util.type.NamedImplementation
getImplementationName
-
Constructor Details
-
LocalColumnLocation
Construct a new LocalColumnLocation for the specified LocalTableLocation and column name.- Parameters:
tableLocation- The table location enclosing this column locationname- The name of the column
-
-
Method Details
-
hasHeader
-
detailsFor
-
encodeHeaderPrefix
@InternalUseOnly public static long encodeHeaderPrefix(@NotNull ByteOrder byteOrder, int metadataSize, int dataStartPosition) Encode the two fields in the header prefix into a single long.- Parameters:
byteOrder- The byte ordermetadataSize- The metadata sizedataStartPosition- The data start position- Returns:
- The header prefix as a long
-
decodeByteOrder
Decode the byte order from a header prefix (represented as a long).- Parameters:
encodedHeaderPrefix- The header prefix- Returns:
- The byte order
-
decodeMetadataSize
Decode the metadata size from a header prefix (represented as a long).- Parameters:
encodedHeaderPrefix- The header prefix- Returns:
- The metadata size
-
decodeDataStartPosition
Decode the data start position from a header prefix (represented as a long).- Parameters:
encodedHeaderPrefix- The header prefix- Returns:
- The data start position
-
exists
public boolean exists()Description copied from interface:ColumnLocationCheck for existence of this ColumnLocation.- Specified by:
existsin interfaceColumnLocation- Returns:
- True iff the ColumnLocation actually exists
-
getByteOrder
Description copied from interface:DeephavenFormatColumnLocationGet theByteOrderused by allFileDataBufferStores associated with this column location. Invoking this method is an error for any column location ifColumnLocation.exists()has not been invoked and returned true.- Specified by:
getByteOrderin interfaceDeephavenFormatColumnLocation- Returns:
- The
ByteOrder
-
determineHeaderByteOrder
Read the ByteOrder for this location from the file header. This is only valid forV1column formats- Returns:
- the byte order
-
getMetadata
@Nullable public <METADATA_TYPE> METADATA_TYPE getMetadata() -
getMetadata
public static <METADATA_TYPE> METADATA_TYPE getMetadata(@NotNull String description, int columnVersion, @NotNull Function<ColumnFileTypeDetails, ColumnFileState> stateLookup) -
getColumnFileDataStartPosition
-
initializeColumnFile
-
getColumnFileName
-
getColumnFile
-
getColumnFileDataAccessor
-
getColumnFileBufferStore
@NotNull public FileDataBufferStore getColumnFileBufferStore(@NotNull ColumnFileType columnFileType) Description copied from interface:DeephavenFormatColumnLocationGet theFileDataBufferStorefor buffers from this column location for the specifiedColumnFileType.- Specified by:
getColumnFileBufferStorein interfaceDeephavenFormatColumnLocation- Parameters:
columnFileType- TheColumnFileType- Returns:
- The buffer store for the specified column file type for this column location
-
symbolFileExists
public boolean symbolFileExists()Description copied from interface:DeephavenFormatColumnLocationCheck if the symbol table file exists.- Specified by:
symbolFileExistsin interfaceDeephavenFormatColumnLocation- Returns:
- true if the symbol data file exists.
-