diff --git a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/Binary.java b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/Binary.java index efe5070a..42d50d66 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/Binary.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/Binary.java @@ -21,7 +21,7 @@ public class Binary implements Comparable, Serializable { /** * if the bytes v is modified, the modification is visable to this binary. - * @param v + * @param v value */ public Binary(byte[] v) { this.values = v; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteForEncodingUtils.java b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteForEncodingUtils.java index c919c3ae..4f49177c 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteForEncodingUtils.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteForEncodingUtils.java @@ -130,7 +130,7 @@ public static void writeUnsignedVarInt(int value, OutputStream out) throws IOExc * * * @param value value to write into stream - * @param buffer where to store the result. buffer.remaining() needs to >= 32. + * @param buffer where to store the result. buffer.remaining() needs to larger than or equal to 32. * Notice: (1) this function does not check buffer's remaining(). * (2) the position will be updated. * @return the number of bytes that the value consume. diff --git a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteIOUtils.java b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteIOUtils.java index a4034078..36514e3f 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteIOUtils.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/common/utils/ReadWriteIOUtils.java @@ -255,6 +255,10 @@ public static String readStringFromDirectByteBuffer(ByteBuffer buffer) throws Ch /** * unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream. + * @param inputStream input stream + * @param length read length + * @return read Bytes + * @throws IOException IOException */ public static byte[] readBytes(InputStream inputStream, int length) throws IOException { byte[] bytes=new byte[length]; @@ -268,6 +272,9 @@ public static byte[] readBytes(InputStream inputStream, int length) throws IOExc /** * unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream. + * @param inputStream input stream + * @return read Bytes + * @throws IOException IOException */ public static byte[] readBytesWithSelfDescriptionLength(InputStream inputStream) throws IOException { int length=readInt(inputStream); @@ -326,11 +333,6 @@ public static int readAsPossible(FileChannel channel, ByteBuffer buffer, int len return length; } - - - /** - * List - */ public static List readIntegerList(InputStream inputStream) throws IOException { int size = readInt(inputStream); if(size <= 0)return null; @@ -341,6 +343,7 @@ public static List readIntegerList(InputStream inputStream) throws IOEx return list; } + public static List readIntegerList(ByteBuffer buffer) throws IOException { int size = readInt(buffer); if(size <= 0)return null; @@ -371,9 +374,12 @@ public static List readStringList(ByteBuffer buffer) throws IOException return list; } - /** - * CompressionType + * write Compression + * @param compressionType Compression Type + * @param outputStream outputStream + * @return bytes length + * @throws IOException IOException */ public static int write(CompressionType compressionType, OutputStream outputStream) throws IOException { short n = compressionType.serialize(); @@ -394,9 +400,6 @@ public static CompressionType readCompressionType(ByteBuffer buffer) { } - /** - * TSDataType - */ public static int write(TSDataType dataType, OutputStream outputStream) throws IOException { short n = dataType.serialize(); return write(n, outputStream); @@ -416,9 +419,6 @@ public static TSDataType readDataType(ByteBuffer buffer) { } - /** - * TSEncoding - */ public static int write(TSEncoding encoding, OutputStream outputStream) throws IOException { short n = encoding.serialize(); return write(n, outputStream); @@ -438,9 +438,6 @@ public static TSEncoding readEncoding(ByteBuffer buffer) { } - /** - * TSFreqType - */ public static int write(TSFreqType freqType, OutputStream outputStream) throws IOException { short n = freqType.serialize(); return write(n, outputStream); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/compress/Compressor.java b/src/main/java/cn/edu/tsinghua/tsfile/compress/Compressor.java index c01ca355..39251251 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/compress/Compressor.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/compress/Compressor.java @@ -42,12 +42,12 @@ public static Compressor getCompressor(CompressionType name) { /** * - * @param data - * @param offset - * @param length - * @param compressed + * @param data MUST be byte[] + * @param offset offset of data + * @param length length of data + * @param compressed MUST be byte[] * @return byte length of compressed data. - * @throws IOException + * @throws IOException IOException */ public abstract int compress(byte[] data, int offset, int length, byte[] compressed) throws IOException; @@ -56,7 +56,7 @@ public static Compressor getCompressor(CompressionType name) { * @param data MUST be DirectByteBuffer for Snappy. * @param compressed MUST be DirectByteBuffer for Snappy. * @return byte length of compressed data. - * @throws IOException + * @throws IOException IOException */ public abstract int compress(ByteBuffer data, ByteBuffer compressed) throws IOException; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/compress/UnCompressor.java b/src/main/java/cn/edu/tsinghua/tsfile/compress/UnCompressor.java index 209497e6..2fb315e1 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/compress/UnCompressor.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/compress/UnCompressor.java @@ -38,8 +38,8 @@ public static UnCompressor getUnCompressor(CompressionType name) { /** * * @param buffer MUST be DirectByteBuffer - * @return - * @throws IOException + * @return Uncompressed length + * @throws IOException IOException */ public abstract int getUncompressedLength(ByteBuffer buffer) throws IOException; @@ -52,12 +52,13 @@ public static UnCompressor getUnCompressor(CompressionType name) { /** * - * @param byteArray - * @param offset - * @param length - * @param output - * @param outOffset + * @param byteArray to be uncompressed bytes + * @param offset offset + * @param length length + * @param output MUST be byte[] + * @param outOffset output offset * @return the valid length of the output array + * @throws IOException IOException */ public abstract int uncompress(byte[] byteArray, int offset, int length, byte[] output, int outOffset) throws IOException ; @@ -65,7 +66,8 @@ public static UnCompressor getUnCompressor(CompressionType name) { * if the data is large, using this function is better. * @param compressed MUST be DirectByteBuffer * @param uncompressed MUST be DirectByteBuffer - * @return + * @return the valid length + * @throws IOException IOException */ public abstract int uncompress(ByteBuffer compressed, ByteBuffer uncompressed) throws IOException ; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/file/footer/RowGroupFooter.java b/src/main/java/cn/edu/tsinghua/tsfile/file/footer/RowGroupFooter.java index 87cde980..15ef6a83 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/file/footer/RowGroupFooter.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/file/footer/RowGroupFooter.java @@ -61,10 +61,10 @@ public int serializeTo(OutputStream outputStream) throws IOException { } /** - * @param inputStream + * @param inputStream input stream * @param markerRead Whether the marker of the RowGroupFooter is read ahead. - * @return - * @throws IOException + * @return deserialized RowGroupFooter + * @throws IOException IOException */ public static RowGroupFooter deserializeFrom(InputStream inputStream, boolean markerRead) throws IOException { if (!markerRead) { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/file/header/ChunkHeader.java b/src/main/java/cn/edu/tsinghua/tsfile/file/header/ChunkHeader.java index 7824124b..9a8ae21f 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/file/header/ChunkHeader.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/file/header/ChunkHeader.java @@ -97,10 +97,10 @@ public int serializeTo(ByteBuffer buffer) { } /** - * @param inputStream + * @param inputStream input stream * @param markerRead Whether the marker of the ChunkHeader has been read - * @return - * @throws IOException + * @return deserialized ChunkHeader + * @throws IOException IOException */ public static ChunkHeader deserializeFrom(InputStream inputStream, boolean markerRead) throws IOException { if (!markerRead) { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/TsFileMetaData.java b/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/TsFileMetaData.java index fdc52ea3..3f9f4212 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/TsFileMetaData.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/TsFileMetaData.java @@ -39,6 +39,8 @@ public TsFileMetaData() { } /** + * + * @param deviceMap - device map (String, TsDeviceMetadata) * @param measurementSchema - time series info list * @param currentVersion - current version */ diff --git a/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/statistics/Statistics.java b/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/statistics/Statistics.java index 4e31753a..ff210f5b 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/statistics/Statistics.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/file/metadata/statistics/Statistics.java @@ -170,7 +170,7 @@ public void reset() { * boolean - 1
* No - 0
* binary - -1 which means uncertainty - * + * */ abstract public int sizeOfDatum(); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/TsFileSequenceReader.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/TsFileSequenceReader.java index ff4c0c17..81d40f3c 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/TsFileSequenceReader.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/TsFileSequenceReader.java @@ -37,10 +37,8 @@ public TsFileSequenceReader(String file) throws IOException { } /** - * After open the file, the reader position is at the end of the magic string in the header. - * - * @return - * @throws IOException + * After open the file, the reader position is at the end of the magic string in the header. + * @throws IOException IOException */ private void open() throws IOException { channel = FileChannel.open(path, StandardOpenOption.READ); @@ -55,8 +53,8 @@ private void open() throws IOException { /** * this function does not modify the position of the file reader. * - * @return - * @throws IOException + * @return magic string bytes array in string format + * @throws IOException IOException */ public String readTailMagic() throws IOException { long totalSize = channel.size(); @@ -69,8 +67,8 @@ public String readTailMagic() throws IOException { /** * this function does not modify the position of the file reader. * - * @return - * @throws IOException + * @return magic string bytes array in string format + * @throws IOException IOException */ public String readHeadMagic() throws IOException { ByteBuffer magicStringBytes = ByteBuffer.allocate(TSFileConfig.MAGIC_STRING.length()); @@ -82,8 +80,8 @@ public String readHeadMagic() throws IOException { /** * this function does not modify the position of the file reader. * - * @return - * @throws IOException + * @return deserialized TsFile metadata + * @throws IOException IOException */ public TsFileMetaData readFileMetadata() throws IOException { ByteBuffer buffer = ByteBuffer.allocate(fileMetadtaSize); @@ -104,8 +102,8 @@ public RowGroupFooter readRowGroupFooter() throws IOException { * After reading the footer of a RowGroup, call this method to set the file pointer to the start of the data of this * RowGroup if you want to read its data next. * - * @param footer - * @throws IOException + * @param footer row group footer + * @throws IOException IOException */ public void prepareReadRowGroup(RowGroupFooter footer) throws IOException { channel.position(channel.position() - footer.getDataSize() - footer.getSerializedSize()); @@ -119,8 +117,8 @@ public ChunkHeader readChunkHeader() throws IOException { * notice, this function will modify channel's position. * * @param offset the file offset of this chunk's header - * @return - * @throws IOException + * @return deserialized chunk header + * @throws IOException IOException */ public ChunkHeader readChunkHeader(long offset) throws IOException { channel.position(offset); @@ -130,9 +128,9 @@ public ChunkHeader readChunkHeader(long offset) throws IOException { /** * notice, the position of the channel MUST be at the end of this header. * - * @param header + * @param header chunk header * @return the pages of this chunk - * @throws IOException + * @throws IOException IOException */ public ByteBuffer readChunk(ChunkHeader header) throws IOException { ByteBuffer buffer = ByteBuffer.allocate(header.getDataSize()); @@ -144,9 +142,9 @@ public ByteBuffer readChunk(ChunkHeader header) throws IOException { /** * notice, this function will modify channel's position. * - * @param position - * @return - * @throws IOException + * @param position read chunk header position + * @return chunk and header in ByteBuffer format + * @throws IOException IOException */ public ByteBuffer readChunkAndHeader(long position) throws IOException { ChunkHeader header = readChunkHeader(position); @@ -158,13 +156,13 @@ public ByteBuffer readChunkAndHeader(long position) throws IOException { } /** - * notice, the function will midify channel's position. + * notice, the function will modify channel's position. * - * @param position - * @param length - * @param output - * @return - * @throws IOException + * @param position channel start position + * @param length read length of raw ByteBuffer + * @param output output in ByteBuffer format + * @return read length + * @throws IOException IOException */ public int readRaw(long position, int length, ByteBuffer output) throws IOException { channel.position(position); @@ -174,9 +172,10 @@ public int readRaw(long position, int length, ByteBuffer output) throws IOExcept /** * notice, this function will modify channel's position. * - * @param header + * @param header chunk header + * @param positionOfChunkHeader position of chunk header * @return the pages of this chunk - * @throws IOException + * @throws IOException IOException */ public ByteBuffer readChunk(ChunkHeader header, long positionOfChunkHeader) throws IOException { channel.position(positionOfChunkHeader); @@ -190,9 +189,10 @@ public PageHeader readPageHeader(TSDataType type) throws IOException { /** * notice, this function will modify channel's position. * + * @param type time series data type * @param offset the file offset of this page header's header - * @return - * @throws IOException + * @return page header + * @throws IOException IOException */ public PageHeader readPageHeader(TSDataType type, long offset) throws IOException { channel.position(offset); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/controller/SeriesChunkLoader.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/controller/SeriesChunkLoader.java index 6708f581..24350e17 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/controller/SeriesChunkLoader.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/controller/SeriesChunkLoader.java @@ -12,6 +12,9 @@ public interface SeriesChunkLoader { /** * read all content of any chunk + * @param chunkMetaData chunk meta data + * @return SeriesChunk + * @throws IOException IOException */ SeriesChunk getMemSeriesChunk(ChunkMetaData chunkMetaData) throws IOException; } diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/RowRecord.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/RowRecord.java index 1562b647..c2ccc48f 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/RowRecord.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/RowRecord.java @@ -23,7 +23,7 @@ private RowRecord() { /** * init this.fields and set time stamp - * @param timestamp + * @param timestamp timestamp */ public RowRecord(long timestamp) { this(); @@ -31,9 +31,9 @@ public RowRecord(long timestamp) { } /** - * add one - * @param path - * @param tsPrimitiveType + * add one (path, field) tuple to fields map which contains all value fields of the record + * @param path a series in delta system + * @param tsPrimitiveType time series primitive type */ public void putField(Path path, TsPrimitiveType tsPrimitiveType) { fields.put(path, tsPrimitiveType); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/TsPrimitiveType.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/TsPrimitiveType.java index ea84a2e2..31861d35 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/TsPrimitiveType.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/datatype/TsPrimitiveType.java @@ -13,7 +13,7 @@ public abstract class TsPrimitiveType implements Serializable { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public boolean getBoolean() { throw new UnsupportedOperationException("getBoolean() is not supported for current sub-class"); @@ -21,7 +21,7 @@ public boolean getBoolean() { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public int getInt() { throw new UnsupportedOperationException("getInt() is not supported for current sub-class"); @@ -29,7 +29,7 @@ public int getInt() { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public long getLong() { throw new UnsupportedOperationException("getLong() is not supported for current sub-class"); @@ -37,7 +37,7 @@ public long getLong() { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public float getFloat() { throw new UnsupportedOperationException("getFloat() is not supported for current sub-class"); @@ -45,7 +45,7 @@ public float getFloat() { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public double getDouble() { throw new UnsupportedOperationException("getDouble() is not supported for current sub-class"); @@ -53,7 +53,7 @@ public double getDouble() { /** * implemented in subclasses - * @return + * @return currently only throw an exception */ public Binary getBinary() { throw new UnsupportedOperationException("getBinary() is not supported for current sub-class"); @@ -69,13 +69,13 @@ public Binary getBinary() { /** * get value in String format - * @return + * @return value in string format */ public abstract String getStringValue(); /** * get corresponding data type of subclasses - * @return + * @return corresponding data type of subclasses */ public abstract TSDataType getDataType(); @@ -94,7 +94,7 @@ public static class TsBoolean extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be boolean */ public TsBoolean(boolean value) { this.value = value; @@ -132,7 +132,7 @@ public static class TsInt extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be int */ public TsInt(int value) { this.value = value; @@ -170,7 +170,7 @@ public static class TsLong extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be long */ public TsLong(long value) { this.value = value; @@ -208,7 +208,7 @@ public static class TsFloat extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be float */ public TsFloat(float value) { this.value = value; @@ -246,7 +246,7 @@ public static class TsDouble extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be double */ public TsDouble(double value) { this.value = value; @@ -284,7 +284,7 @@ public static class TsBinary extends TsPrimitiveType { /** * init value - * @param value + * @param value MUST be Binary */ public TsBinary(Binary value) { this.value = value; @@ -318,8 +318,8 @@ public TSDataType getDataType() { /** * get corresponding subclass of input data type and set its value - * @param dataType - * @param v + * @param dataType data type + * @param v value * @return corresponding implementation of {@code TsPrimitiveType} */ public static TsPrimitiveType getByType(TSDataType dataType, Object v) { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/QueryDataSet.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/QueryDataSet.java index 0f5f900e..0068666f 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/QueryDataSet.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/QueryDataSet.java @@ -11,16 +11,16 @@ public interface QueryDataSet { /** * check if unread data still exists - * @return - * @throws IOException + * @return whether the QueryDataSet has the next data + * @throws IOException IOException */ boolean hasNext() throws IOException; /** * get the next unread data * another data will be returned when calling this method next time - * @return - * @throws IOException + * @return the next RowRecord + * @throws IOException IOException */ RowRecord next() throws IOException; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/timegenerator/node/AndNode.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/timegenerator/node/AndNode.java index a431e2a8..3a365253 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/timegenerator/node/AndNode.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/query/timegenerator/node/AndNode.java @@ -51,10 +51,8 @@ public boolean hasNext() throws IOException { } /** - * If there is no value in current Node, -1 will be returned if {@code next()} is invoked - * - * @return - * @throws IOException + * @return If there is no value in current Node, -1 will be returned if {@code next()} is invoked + * @throws IOException IOException */ @Override public long next() throws IOException { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReader.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReader.java index c33cc3ee..bc62a73a 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReader.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReader.java @@ -10,17 +10,22 @@ public interface SeriesReader { /** - * if there is a next time-value pair + * + * @return if there is a next time-value pair + * @throws IOException IOException */ boolean hasNext() throws IOException; /** + * * @return next time value pair + * @throws IOException IOException */ TimeValuePair next() throws IOException; /** * skip the current time value pair, just call next() + * @throws IOException IOException */ void skipCurrentTimeValuePair() throws IOException; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReaderByTimeStamp.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReaderByTimeStamp.java index e7f8316c..07183716 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReaderByTimeStamp.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/SeriesReaderByTimeStamp.java @@ -6,9 +6,10 @@ public interface SeriesReaderByTimeStamp extends SeriesReader { /** - * @param timestamp + * + * @param timestamp timestamp * @return If there is no TimeValuePair whose timestamp equals to given timestamp, then return null. - * @throws IOException + * @throws IOException IOException */ TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFile.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFile.java index 150dfd8b..de1d48d3 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFile.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFile.java @@ -42,8 +42,8 @@ public SeriesReaderFromSingleFile(TsFileSequenceReader fileReader, /** * Using this constructor cannot close corresponding FileStream - * @param seriesChunkLoader - * @param chunkMetaDataList + * @param seriesChunkLoader series chunk loader + * @param chunkMetaDataList chunk metadata list */ public SeriesReaderFromSingleFile(SeriesChunkLoader seriesChunkLoader, List chunkMetaDataList) { this.seriesChunkLoader = seriesChunkLoader; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFileByTimestampImpl.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFileByTimestampImpl.java index 5f60b9de..9b38cf09 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFileByTimestampImpl.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/read/reader/impl/SeriesReaderFromSingleFileByTimestampImpl.java @@ -88,9 +88,9 @@ public TimeValuePair next() throws IOException { } /** - * @param timestamp + * @param timestamp timestamp * @return If there is no TimeValuePair whose timestamp equals to given timestamp, then return null. - * @throws IOException + * @throws IOException IOException */ @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/utils/cache/LRUCache.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/utils/cache/LRUCache.java index 8adf0656..fd7e33c0 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/utils/cache/LRUCache.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/utils/cache/LRUCache.java @@ -57,8 +57,8 @@ private void removeFirstObject() throws CacheException { /** * Do something before remove object from cache. - * - * @param object + * @param object removed object + * @throws CacheException CacheException */ public abstract void beforeRemove(T object) throws CacheException; diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/TsFileWriter.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/TsFileWriter.java index 8bb79e09..6820902c 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/TsFileWriter.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/TsFileWriter.java @@ -62,7 +62,7 @@ public class TsFileWriter { * init this TsFileWriter * * @param file the File to be written by this TsFileWriter - * @throws IOException + * @throws IOException IOException */ public TsFileWriter(File file) throws IOException { this(new TsFileIOWriter(file), new FileSchema(), TSFileDescriptor.getInstance().getConfig()); @@ -73,7 +73,7 @@ public TsFileWriter(File file) throws IOException { * * @param file the File to be written by this TsFileWriter * @param schema the schema of this TsFile - * @throws IOException + * @throws IOException IOException */ public TsFileWriter(File file, FileSchema schema) throws IOException { this(new TsFileIOWriter(file), schema, TSFileDescriptor.getInstance().getConfig()); @@ -84,7 +84,7 @@ public TsFileWriter(File file, FileSchema schema) throws IOException { * * @param file the File to be written by this TsFileWriter * @param conf the configuration of this TsFile - * @throws IOException + * @throws IOException IOException */ public TsFileWriter(File file, TSFileConfig conf) throws IOException { this(new TsFileIOWriter(file), new FileSchema(), conf); @@ -96,7 +96,7 @@ public TsFileWriter(File file, TSFileConfig conf) throws IOException { * @param file the File to be written by this TsFileWriter * @param schema the schema of this TsFile * @param conf the configuration of this TsFile - * @throws IOException + * @throws IOException IOException */ public TsFileWriter(File file, FileSchema schema, TSFileConfig conf) throws IOException { @@ -119,6 +119,8 @@ protected TsFileWriter(TsFileIOWriter tsfileWriter, FileSchema schema, TSFileCon /** * add a MeasurementSchema to this TsFile + * @param measurementSchema measurement schema + * @throws WriteProcessException WriteProcessException */ public void addMeasurement(MeasurementSchema measurementSchema) throws WriteProcessException { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/desc/MeasurementSchema.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/desc/MeasurementSchema.java index e723aeb5..23ed8344 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/desc/MeasurementSchema.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/desc/MeasurementSchema.java @@ -48,6 +48,9 @@ public MeasurementSchema() {} /** * set properties as an empty Map + * @param measurementId measurement Id + * @param type data type + * @param encoding enum encoding type */ public MeasurementSchema(String measurementId, TSDataType type, TSEncoding encoding) { this(measurementId, type, encoding, CompressionType.valueOf(TSFileDescriptor.getInstance().getConfig().compressor), Collections.emptyMap()); @@ -58,12 +61,13 @@ public MeasurementSchema(String measurementId, TSDataType type, TSEncoding encod /** * - * @param measurementId - * @param type - * @param encoding - * @param props information in encoding method. - * For RLE, Encoder.MAX_POINT_NUMBER - * For PLAIN, Encoder.MAX_STRING_LENGTH + * @param measurementId measurement Id + * @param type data type + * @param encoding enum encoding type + * @param compressionType compression type + * @param props information in encoding method. + * For RLE, Encoder.MAX_POINT_NUMBER + * For PLAIN, Encoder.MAX_STRING_LENGTH */ public MeasurementSchema(String measurementId, TSDataType type, TSEncoding encoding, CompressionType compressionType, Map props) { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/io/TsFileIOWriter.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/io/TsFileIOWriter.java index f85cd535..d7148a1b 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/io/TsFileIOWriter.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/io/TsFileIOWriter.java @@ -72,10 +72,11 @@ private void startFile() throws IOException { /** * start a {@linkplain ChunkGroupMetaData ChunkGroupMetaData}. - * * @param deviceId delta object id - * @param dataSize the serialized size of all chunks + * @param dataSize the serialized size of all chunks + * @param numberOfChunks number of chunks * @return the serialized size of RowGroupFooter + * @throws IOException IOException */ public RowGroupFooter startFlushRowGroup(String deviceId, long dataSize, int numberOfChunks) throws IOException { LOG.debug("start row group:{}, file position {}", deviceId, out.getChannel().position()); @@ -87,14 +88,15 @@ public RowGroupFooter startFlushRowGroup(String deviceId, long dataSize, int num /** * start a {@linkplain ChunkMetaData ChunkMetaData}. - * - * @param descriptor - measurement of this time series - * @param compressionCodecName - compression name of this time series - * @param tsDataType - data type - * @param statistics - statistic of the whole series - * @param maxTime - maximum timestamp of the whole series in this stage - * @param minTime - minimum timestamp of the whole series in this stage - * @param datasize - the serialized size of all pages + * @param descriptor - measurement of this time series + * @param compressionCodecName - compression name of this time series + * @param tsDataType - data type + * @param encodingType - encoding type + * @param statistics - statistic of the whole series + * @param maxTime - maximum timestamp of the whole series in this stage + * @param minTime - minimum timestamp of the whole series in this stage + * @param datasize - the serialized size of all pages + * @param numOfPages - number of pages * @return the serialized size of CHunkHeader * @throws IOException if I/O error occurs */ diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/BooleanDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/BooleanDataPoint.java index a13dc167..3854670b 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/BooleanDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/BooleanDataPoint.java @@ -20,6 +20,8 @@ public class BooleanDataPoint extends DataPoint { /** * constructor of BooleanDataPoint, the value type will be set automatically + * @param measurementId measurement ID (sensor name) + * @param v value */ public BooleanDataPoint(String measurementId, boolean v) { super(TSDataType.BOOLEAN, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/DoubleDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/DoubleDataPoint.java index d112305d..9e09c6ee 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/DoubleDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/DoubleDataPoint.java @@ -20,6 +20,8 @@ public class DoubleDataPoint extends DataPoint { /** * constructor of DoubleDataPoint, the value type will be set automatically + * @param measurementId measurement id + * @param v value */ public DoubleDataPoint(String measurementId, double v) { super(TSDataType.DOUBLE, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/FloatDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/FloatDataPoint.java index 92188a94..c1874a09 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/FloatDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/FloatDataPoint.java @@ -20,6 +20,8 @@ public class FloatDataPoint extends DataPoint { /** * constructor of FloatDataPoint, the value type will be set automatically + * @param measurementId measurement Id + * @param v value */ public FloatDataPoint(String measurementId, float v) { super(TSDataType.FLOAT, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/IntDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/IntDataPoint.java index 5f45b7af..17abba33 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/IntDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/IntDataPoint.java @@ -20,6 +20,8 @@ public class IntDataPoint extends DataPoint { /** * constructor of IntDataPoint, the value type will be set automatically + * @param measurementId measurement Id + * @param v value */ public IntDataPoint(String measurementId, int v) { super(TSDataType.INT32, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/LongDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/LongDataPoint.java index 00e8d08b..420f406e 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/LongDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/LongDataPoint.java @@ -20,6 +20,9 @@ public class LongDataPoint extends DataPoint { /** * constructor of LongDataPoint, the value type will be set automatically + * + * @param measurementId measurement Id + * @param v value */ public LongDataPoint(String measurementId, long v) { super(TSDataType.INT64, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/StringDataPoint.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/StringDataPoint.java index 2c3b7764..cf5d2d06 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/StringDataPoint.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/record/datapoint/StringDataPoint.java @@ -21,6 +21,8 @@ public class StringDataPoint extends DataPoint { /** * constructor of StringDataPoint, the value type will be set automatically + * @param measurementId measurement Id + * @param v value */ public StringDataPoint(String measurementId, Binary v) { super(TSDataType.TEXT, measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/FileSchema.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/FileSchema.java index 680cf52b..aefe3238 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/FileSchema.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/FileSchema.java @@ -63,6 +63,7 @@ public FileSchema() { * }; * * @param jsonSchema file schema in json format + * @throws InvalidJsonSchemaException invalid JSON schema */ @Deprecated public FileSchema(JSONObject jsonSchema) throws InvalidJsonSchemaException { @@ -71,6 +72,7 @@ public FileSchema(JSONObject jsonSchema) throws InvalidJsonSchemaException { /** * init additionalProperties and register measurements + * @param measurements (measurements id, measurement schema) map */ public FileSchema(Map measurements) { this(); @@ -87,14 +89,13 @@ public TSDataType getMeasurementDataTypes(String measurementUID) { } - public Map getAllMeasurementSchema() { return measurementSchema; } - /** * register a MeasurementSchema + * @param descriptor measurement schema descriptor */ public void registerMeasurement(MeasurementSchema descriptor) { // add to measurementSchema as @@ -103,6 +104,7 @@ public void registerMeasurement(MeasurementSchema descriptor) { /** * register all MeasurementSchema in input map + * @param measurements measurements name and schema map */ private void registerMeasurements(Map measurements) { measurements.forEach((id, md) -> registerMeasurement(md)); @@ -110,6 +112,8 @@ private void registerMeasurements(Map measurements) { /** * check is this schema contains input measurementID + * @param measurementId measurement ID + * @return if measurementSchema has the measurement ID */ public boolean hasMeasurement(String measurementId) { return measurementSchema.containsKey(measurementId); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/SchemaBuilder.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/SchemaBuilder.java index 22b56e27..3cd302e7 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/SchemaBuilder.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/schema/SchemaBuilder.java @@ -26,6 +26,7 @@ public SchemaBuilder() { /** * add one series to TsFile schema * + * @param type compression type * @param measurementId (not null) id of the series * @param dataType (not null) series data type * @param tsEncoding (not null) encoding method you specified diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/ChunkBuffer.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/ChunkBuffer.java index 90317725..6ca06295 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/ChunkBuffer.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/ChunkBuffer.java @@ -63,7 +63,7 @@ public void setNumOfPages(int numOfPages) { * @param maxTimestamp - timestamp maximum in given data * @param minTimestamp - timestamp minimum in given data * @return byte size of the page header and uncompressed data in the page body. - * @throws PageException + * @throws PageException PageException */ public int writePageHeaderAndDataIntoBuff(ByteBuffer data, int valueCount, Statistics statistics, long maxTimestamp, long minTimestamp) throws PageException { diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/IChunkWriter.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/IChunkWriter.java index 2a779e5b..1dc3763a 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/IChunkWriter.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/IChunkWriter.java @@ -15,57 +15,81 @@ public interface IChunkWriter { /** * write a time value pair + * @param time data timestamp + * @param value MUST be int + * @throws IOException IOException */ void write(long time, int value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be long + * @throws IOException IOException */ void write(long time, long value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be boolean + * @throws IOException IOException */ void write(long time, boolean value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be float + * @throws IOException IOException */ void write(long time, float value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be double + * @throws IOException IOException */ void write(long time, double value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be BigDecimal + * @throws IOException IOException */ void write(long time, BigDecimal value) throws IOException; /** * write a time value pair + * @param time data timestamp + * @param value MUST be Binary + * @throws IOException IOException */ void write(long time, Binary value) throws IOException; /** * flush data to TsFileIOWriter + * @param tsfileWriter Must be TsFileIOWriter + * @throws IOException IOException */ void writeToFileWriter(TsFileIOWriter tsfileWriter) throws IOException; /** * estimate memory used size of this series + * @return estimated max series memory size */ long estimateMaxSeriesMemSize(); /** * return the serialized size of the chunk header + all pages + * @return current chunk size */ long getCurrentChunkSize(); /** * prepare to flush data into file. - * */ void preFlush(); diff --git a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/PageWriter.java b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/PageWriter.java index 59d4bea9..6173a395 100644 --- a/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/PageWriter.java +++ b/src/main/java/cn/edu/tsinghua/tsfile/timeseries/write/series/PageWriter.java @@ -30,6 +30,9 @@ public PageWriter() { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be boolean + * @throws IOException IOException */ public void write(long time, boolean value) throws IOException { timeEncoder.encode(time, timeOut); @@ -38,6 +41,9 @@ public void write(long time, boolean value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be short + * @throws IOException IOException */ public void write(long time, short value) throws IOException { timeEncoder.encode(time, timeOut); @@ -46,6 +52,9 @@ public void write(long time, short value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be int + * @throws IOException IOException */ public void write(long time, int value) throws IOException { timeEncoder.encode(time, timeOut); @@ -54,6 +63,9 @@ public void write(long time, int value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be long + * @throws IOException IOException */ public void write(long time, long value) throws IOException { timeEncoder.encode(time, timeOut); @@ -62,6 +74,9 @@ public void write(long time, long value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be float + * @throws IOException IOException */ public void write(long time, float value) throws IOException { timeEncoder.encode(time, timeOut); @@ -70,6 +85,9 @@ public void write(long time, float value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be double + * @throws IOException IOException */ public void write(long time, double value) throws IOException { timeEncoder.encode(time, timeOut); @@ -78,6 +96,9 @@ public void write(long time, double value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be BigDecimal + * @throws IOException IOException */ public void write(long time, BigDecimal value) throws IOException { timeEncoder.encode(time, timeOut); @@ -86,6 +107,9 @@ public void write(long time, BigDecimal value) throws IOException { /** * write a time value pair into encoder + * @param time data timestamp + * @param value MUST be Binary + * @throws IOException IOException */ public void write(long time, Binary value) throws IOException { timeEncoder.encode(time, timeOut); @@ -94,17 +118,18 @@ public void write(long time, Binary value) throws IOException { /** * flush all data remained in encoders. + * @throws IOException IOException */ private void prepareEndWriteOnePage() throws IOException { timeEncoder.flush(timeOut); valueEncoder.flush(valueOut); } - /** * getUncompressedBytes return data what it has been written in form of size of time list, time list, value list * * @return a new readable ByteBuffer whose position is 0. + * @throws IOException IOException */ public ByteBuffer getUncompressedBytes() throws IOException { prepareEndWriteOnePage();