Package org.apache.druid.segment.file
Class SegmentFileBuilderV10
java.lang.Object
org.apache.druid.segment.file.SegmentFileBuilderV10
- All Implemented Interfaces:
Closeable,AutoCloseable,SegmentFileBuilder
SegmentFileBuilder for V10 format segments. Right now, this uses a FileSmoosher underneath to build
V9 smoosh files and collect the metadata about the offsets in those containers, and then appends them into the V10
consolidated segment file after the header and SegmentFileMetadata is written.
V10 file format: | version (byte) | meta compression (byte) | meta length (int) | meta json | container 0 | ... | container n |
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()cleanup any open resources in the event of an exception while building the segment filesvoidAdd aFileto the segment file as the specified namevoidadd(String name, ByteBuffer bufferToAdd) Add aByteBufferto a segment file as the specified namevoidaddBitmapEncoding(BitmapSerdeFactory bitmapEncoding) voidaddColumn(String name, ColumnDescriptor columnDescriptor) Add a column to the metadata of this segment filevoidaddInterval(String interval) voidaddProjections(List<ProjectionMetadata> projections) addWithChannel(String name, long size) Creates aSegmentFileChannelto write data to the segment file as the specified name.voidclose()Close the segment file builder, writing the file(s) to the destinationstatic SegmentFileBuilderV10static SegmentFileBuilderV10create(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, File baseDir, CompressionStrategy metaCompression) getExternalBuilder(String externalFile) Allow adding data to an 'external' segment container file which will be built in the same directory as this segment file.
-
Method Details
-
create
public static SegmentFileBuilderV10 create(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, File baseDir) -
create
public static SegmentFileBuilderV10 create(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, File baseDir, CompressionStrategy metaCompression) -
add
Description copied from interface:SegmentFileBuilderAdd aFileto the segment file as the specified name- Specified by:
addin interfaceSegmentFileBuilder- Throws:
IOException
-
add
Description copied from interface:SegmentFileBuilderAdd aByteBufferto a segment file as the specified name- Specified by:
addin interfaceSegmentFileBuilder- Throws:
IOException
-
addWithChannel
Description copied from interface:SegmentFileBuilderCreates aSegmentFileChannelto write data to the segment file as the specified name. Callers must be sure to write the amount of data specified by the size parameter.- Specified by:
addWithChannelin interfaceSegmentFileBuilder- Throws:
IOException
-
getExternalBuilder
Description copied from interface:SegmentFileBuilderAllow adding data to an 'external' segment container file which will be built in the same directory as this segment file. Legacy implementations of this method just return the same builder since they do not support this concept. This allows column implementations to use these methods, but also still work with older segment formats (assuming the older format otherwise supports the contents).- Specified by:
getExternalBuilderin interfaceSegmentFileBuilder
-
addColumn
Description copied from interface:SegmentFileBuilderAdd a column to the metadata of this segment file- Specified by:
addColumnin interfaceSegmentFileBuilder
-
addInterval
-
addBitmapEncoding
-
addProjections
-
abort
public void abort()Description copied from interface:SegmentFileBuildercleanup any open resources in the event of an exception while building the segment files- Specified by:
abortin interfaceSegmentFileBuilder
-
close
Description copied from interface:SegmentFileBuilderClose the segment file builder, writing the file(s) to the destination- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSegmentFileBuilder- Throws:
IOException
-