public class TsFileWriter extends Object implements AutoCloseable
close() method to flush the last data outside and close the normal outputStream and error
outputStream.| Modifier and Type | Field and Description |
|---|---|
protected static TSFileConfig |
config |
protected Schema |
schema
schema of this TsFile.
|
| Modifier | Constructor and Description |
|---|---|
|
TsFileWriter(File file)
init this TsFileWriter.
|
|
TsFileWriter(File file,
Schema schema)
init this TsFileWriter.
|
|
TsFileWriter(File file,
Schema schema,
TSFileConfig conf)
init this TsFileWriter.
|
|
TsFileWriter(TsFileIOWriter fileWriter)
init this TsFileWriter.
|
protected |
TsFileWriter(TsFileIOWriter fileWriter,
Schema schema,
TSFileConfig conf)
init this TsFileWriter.
|
|
TsFileWriter(TsFileOutput output,
Schema schema)
init this TsFileWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
calling this method to write the last data remaining in memory and close the normal and error
OutputStream.
|
boolean |
flushAllChunkGroups()
flush the data in all series writers of all chunk group writers and their page writers to
outputStream.
|
TsFileIOWriter |
getIOWriter()
this function is only for Test.
|
void |
registerAlignedTimeseries(Path devicePath,
List<MeasurementSchema> measurementSchemas)
Register aligned timeseries.
|
void |
registerDevice(String deviceId,
String templateName)
This method is used to register all timeseries in the specified template under the specified
device.
|
void |
registerSchemaTemplate(String templateName,
Map<String,MeasurementSchema> template,
boolean isAligned) |
void |
registerTimeseries(Path devicePath,
List<MeasurementSchema> measurementSchemas)
Register nonAligned timeseries by groups.
|
void |
registerTimeseries(Path devicePath,
MeasurementSchema measurementSchema)
Register nonAligned timeseries by single.
|
boolean |
write(Tablet tablet)
write a tablet
|
boolean |
write(TSRecord record)
write a record in type of T.
|
boolean |
writeAligned(Tablet tablet) |
boolean |
writeAligned(TSRecord record) |
protected static final TSFileConfig config
protected final Schema schema
public TsFileWriter(File file) throws IOException
file - the File to be written by this TsFileWriterIOExceptionpublic TsFileWriter(TsFileIOWriter fileWriter) throws IOException
fileWriter - the io writer of this TsFileIOExceptionpublic TsFileWriter(File file, Schema schema) throws IOException
file - the File to be written by this TsFileWriterschema - the schema of this TsFileIOExceptionpublic TsFileWriter(TsFileOutput output, Schema schema) throws IOException
output - the TsFileOutput of the file to be written by this TsFileWriterschema - the schema of this TsFileIOExceptionpublic TsFileWriter(File file, Schema schema, TSFileConfig conf) throws IOException
file - the File to be written by this TsFileWriterschema - the schema of this TsFileconf - the configuration of this TsFileIOExceptionprotected TsFileWriter(TsFileIOWriter fileWriter, Schema schema, TSFileConfig conf) throws IOException
fileWriter - the io writer of this TsFileschema - the schema of this TsFileconf - the configuration of this TsFileIOExceptionpublic void registerSchemaTemplate(String templateName, Map<String,MeasurementSchema> template, boolean isAligned)
public void registerDevice(String deviceId, String templateName) throws WriteProcessException
deviceId - templateName - WriteProcessExceptionpublic void registerTimeseries(Path devicePath, MeasurementSchema measurementSchema) throws WriteProcessException
devicePath - measurementSchema - WriteProcessExceptionpublic void registerTimeseries(Path devicePath, List<MeasurementSchema> measurementSchemas)
devicePath - measurementSchemas - public void registerAlignedTimeseries(Path devicePath, List<MeasurementSchema> measurementSchemas) throws WriteProcessException
devicePath - measurementSchemas - WriteProcessExceptionpublic boolean write(TSRecord record) throws IOException, WriteProcessException
record - - record responding a data lineIOException - exception in IOWriteProcessException - exception in write processpublic boolean writeAligned(TSRecord record) throws IOException, WriteProcessException
IOExceptionWriteProcessExceptionpublic boolean write(Tablet tablet) throws IOException, WriteProcessException
tablet - - multiple time series of one device that share a time columnIOException - exception in IOWriteProcessException - exception in write processpublic boolean writeAligned(Tablet tablet) throws IOException, WriteProcessException
IOExceptionWriteProcessExceptionpublic boolean flushAllChunkGroups()
throws IOException
IOException - exception in IOpublic void close()
throws IOException
close in interface AutoCloseableIOException - exception in IOpublic TsFileIOWriter getIOWriter()
Copyright © 2022 The Apache Software Foundation. All rights reserved.