This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/develop by this push:
new 54eabc58 Improved the style of some variables and docs
54eabc58 is described below
commit 54eabc58eaff4fd370ca8ec73d283f5759a6a729
Author: Caideyipi <[email protected]>
AuthorDate: Tue Apr 2 12:18:03 2024 +0800
Improved the style of some variables and docs
---
.../java/org/apache/tsfile/read/TsFileReader.java | 2 +-
.../apache/tsfile/read/TsFileSequenceReader.java | 2 +-
.../org/apache/tsfile/utils/ReadWriteIOUtils.java | 48 +++++++--------
.../org/apache/tsfile/write/record/Tablet.java | 70 +++++++++++-----------
4 files changed, 62 insertions(+), 60 deletions(-)
diff --git a/tsfile/src/main/java/org/apache/tsfile/read/TsFileReader.java
b/tsfile/src/main/java/org/apache/tsfile/read/TsFileReader.java
index 7a5e7ea8..a3cbf304 100644
--- a/tsfile/src/main/java/org/apache/tsfile/read/TsFileReader.java
+++ b/tsfile/src/main/java/org/apache/tsfile/read/TsFileReader.java
@@ -36,7 +36,7 @@ public class TsFileReader implements AutoCloseable {
private IChunkLoader chunkLoader;
private TsFileExecutor tsFileExecutor;
- /** constructor, create ReadOnlyTsFile with TsFileSequenceReader. */
+ /** Constructor, create ReadOnlyTsFile with {@link TsFileSequenceReader}. */
public TsFileReader(TsFileSequenceReader fileReader) throws IOException {
this.fileReader = fileReader;
this.metadataQuerier = new MetadataQuerierByFileImpl(fileReader);
diff --git
a/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java
b/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java
index 1ed00374..a15c9890 100644
--- a/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java
+++ b/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java
@@ -313,7 +313,7 @@ public class TsFileSequenceReader implements AutoCloseable {
}
/**
- * this function does not modify the position of the file reader.
+ * This function does not modify the position of the file reader.
*
* @throws IOException io error
*/
diff --git a/tsfile/src/main/java/org/apache/tsfile/utils/ReadWriteIOUtils.java
b/tsfile/src/main/java/org/apache/tsfile/utils/ReadWriteIOUtils.java
index 65b24466..6e55e760 100644
--- a/tsfile/src/main/java/org/apache/tsfile/utils/ReadWriteIOUtils.java
+++ b/tsfile/src/main/java/org/apache/tsfile/utils/ReadWriteIOUtils.java
@@ -106,7 +106,7 @@ public class ReadWriteIOUtils {
return null;
}
- /** read a Boolean from byteBuffer. */
+ /** Read a Boolean from byteBuffer. */
public static Boolean readBoolObject(InputStream inputStream) throws
IOException {
int flag = inputStream.read();
if (flag == 1) {
@@ -117,13 +117,13 @@ public class ReadWriteIOUtils {
return null;
}
- /** read a byte from byteBuffer. */
+ /** Read a byte from byteBuffer. */
public static byte readByte(ByteBuffer buffer) {
return buffer.get();
}
/**
- * read bytes array in given size
+ * Read bytes array in given size
*
* @param buffer buffer
* @param size size
@@ -316,7 +316,7 @@ public class ReadWriteIOUtils {
}
/**
- * write a float n to outputStream.
+ * Write a float n to outputStream.
*
* @return The number of bytes used to represent n.
*/
@@ -327,7 +327,7 @@ public class ReadWriteIOUtils {
}
/**
- * write a double n to outputStream.
+ * Write a double n to outputStream.
*
* @return The number of bytes used to represent n.
*/
@@ -367,7 +367,7 @@ public class ReadWriteIOUtils {
}
/**
- * write string to outputStream.
+ * Write string to outputStream.
*
* @return the length of string represented by byte[].
*/
@@ -386,7 +386,7 @@ public class ReadWriteIOUtils {
}
/**
- * write string to outputStream.
+ * Write string to outputStream.
*
* @return the length of string represented by byte[].
*/
@@ -520,12 +520,12 @@ public class ReadWriteIOUtils {
return BytesUtils.bytesToShort(bytes);
}
- /** read a short var from byteBuffer. */
+ /** Read a short var from byteBuffer. */
public static short readShort(ByteBuffer buffer) {
return buffer.getShort();
}
- /** read a float var from inputStream. */
+ /** Read a float var from inputStream. */
public static float readFloat(InputStream inputStream) throws IOException {
byte[] bytes = new byte[FLOAT_LEN];
int readLen = inputStream.read(bytes);
@@ -535,14 +535,14 @@ public class ReadWriteIOUtils {
return BytesUtils.bytesToFloat(bytes);
}
- /** read a float var from byteBuffer. */
+ /** Read a float var from byteBuffer. */
public static float readFloat(ByteBuffer byteBuffer) {
byte[] bytes = new byte[FLOAT_LEN];
byteBuffer.get(bytes);
return BytesUtils.bytesToFloat(bytes);
}
- /** read a double var from inputStream. */
+ /** Read a double var from inputStream. */
public static double readDouble(InputStream inputStream) throws IOException {
byte[] bytes = new byte[DOUBLE_LEN];
int readLen = inputStream.read(bytes);
@@ -552,14 +552,14 @@ public class ReadWriteIOUtils {
return BytesUtils.bytesToDouble(bytes);
}
- /** read a double var from byteBuffer. */
+ /** Read a double var from byteBuffer. */
public static double readDouble(ByteBuffer byteBuffer) {
byte[] bytes = new byte[DOUBLE_LEN];
byteBuffer.get(bytes);
return BytesUtils.bytesToDouble(bytes);
}
- /** read a int var from inputStream. */
+ /** Read an int var from inputStream. */
public static int readInt(InputStream inputStream) throws IOException {
byte[] bytes = new byte[INT_LEN];
int readLen = inputStream.read(bytes);
@@ -569,13 +569,13 @@ public class ReadWriteIOUtils {
return BytesUtils.bytesToInt(bytes);
}
- /** read a int var from byteBuffer. */
+ /** Read a int var from byteBuffer. */
public static int readInt(ByteBuffer buffer) {
return buffer.getInt();
}
/**
- * read an unsigned byte(0 ~ 255) as InputStream does.
+ * Read an unsigned byte(0 ~ 255) as InputStream does.
*
* @return the byte or -1(means there is no byte to read)
*/
@@ -586,7 +586,7 @@ public class ReadWriteIOUtils {
return buffer.get() & 0xFF;
}
- /** read a long var from inputStream. */
+ /** Read a long var from inputStream. */
public static long readLong(InputStream inputStream) throws IOException {
byte[] bytes = new byte[LONG_LEN];
int readLen = inputStream.read(bytes);
@@ -596,12 +596,12 @@ public class ReadWriteIOUtils {
return BytesUtils.bytesToLong(bytes);
}
- /** read a long var from byteBuffer. */
+ /** Read a long var from byteBuffer. */
public static long readLong(ByteBuffer buffer) {
return buffer.getLong();
}
- /** read string from inputStream. */
+ /** Read string from inputStream. */
public static String readString(InputStream inputStream) throws IOException {
int strLength = readInt(inputStream);
if (strLength <= 0) {
@@ -615,7 +615,7 @@ public class ReadWriteIOUtils {
return new String(bytes, 0, strLength);
}
- /** string length's type is varInt */
+ /** String length's type is varInt */
public static String readVarIntString(InputStream inputStream) throws
IOException {
int strLength = ReadWriteForEncodingUtils.readVarInt(inputStream);
if (strLength < 0) {
@@ -631,7 +631,7 @@ public class ReadWriteIOUtils {
return new String(bytes, 0, strLength);
}
- /** read string from byteBuffer. */
+ /** Read string from byteBuffer. */
public static String readString(ByteBuffer buffer) {
int strLength = readInt(buffer);
if (strLength < 0) {
@@ -644,7 +644,7 @@ public class ReadWriteIOUtils {
return new String(bytes, 0, strLength);
}
- /** string length's type is varInt */
+ /** String length's type is varInt */
public static String readVarIntString(ByteBuffer buffer) {
int strLength = ReadWriteForEncodingUtils.readVarInt(buffer);
if (strLength < 0) {
@@ -657,7 +657,7 @@ public class ReadWriteIOUtils {
return new String(bytes, 0, strLength);
}
- /** read string from byteBuffer with user define length. */
+ /** Read string from byteBuffer with user define length. */
public static String readStringWithLength(ByteBuffer buffer, int length) {
if (length < 0) {
return null;
@@ -929,7 +929,7 @@ public class ReadWriteIOUtils {
}
}
- // read long set with self define length
+ // Read long set with self define length
public static Set<Long> readLongSet(ByteBuffer buffer) {
int size = readInt(buffer);
if (size <= 0) {
@@ -1009,7 +1009,7 @@ public class ReadWriteIOUtils {
}
/**
- * to check whether the byte buffer is reach the magic string this method
doesn't change the
+ * To check whether the byte buffer is reach the magic string this method
doesn't change the
* position of the byte buffer
*
* @param byteBuffer byte buffer
diff --git a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java
b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java
index 6f19faa0..61ab2e41 100644
--- a/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java
+++ b/tsfile/src/main/java/org/apache/tsfile/write/record/Tablet.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.tsfile.write.record;
import org.apache.tsfile.common.conf.TSFileConfig;
@@ -52,45 +53,46 @@ public class Tablet {
private static final int DEFAULT_SIZE = 1024;
private static final String NOT_SUPPORT_DATATYPE = "Data type %s is not
supported.";
- /** deviceId of this tablet */
+ /** DeviceId of this {@link Tablet} */
public String deviceId;
- /** the list of measurement schemas for creating the tablet */
+ /** The list of {@link MeasurementSchema}s for creating the {@link Tablet} */
private List<MeasurementSchema> schemas;
- /** measurementId->indexOf(measurementSchema) */
+ /** MeasurementId->indexOf({@link MeasurementSchema}) */
private final Map<String, Integer> measurementIndex;
- /** timestamps in this tablet */
+ /** Timestamps in this {@link Tablet} */
public long[] timestamps;
- /** each object is a primitive type array, which represents values of one
measurement */
+ /** Each object is a primitive type array, which represents values of one
measurement */
public Object[] values;
- /** each bitmap represents the existence of each value in the current
column. */
+ /** Each {@link BitMap} represents the existence of each value in the
current column. */
public BitMap[] bitMaps;
- /** the number of rows to include in this tablet */
+ /** The number of rows to include in this {@link Tablet} */
public int rowSize;
- /** the maximum number of rows for this tablet */
+ /** The maximum number of rows for this {@link Tablet} */
private final int maxRowNumber;
/**
- * Return a tablet with default specified row number. This is the standard
constructor (all Tablet
- * should be the same size).
+ * Return a {@link Tablet} with default specified row number. This is the
standard constructor
+ * (all Tablet should be the same size).
*
* @param deviceId the name of the device specified to be written in
- * @param schemas the list of measurement schemas for creating the tablet,
only measurementId and
- * type take effects
+ * @param schemas the list of {@link MeasurementSchema}s for creating the
tablet, only
+ * measurementId and type take effects
*/
public Tablet(String deviceId, List<MeasurementSchema> schemas) {
this(deviceId, schemas, DEFAULT_SIZE);
}
/**
- * Return a tablet with the specified number of rows (maxBatchSize). Only
call this constructor
- * directly for testing purposes. Tablet should normally always be default
size.
+ * Return a {@link Tablet} with the specified number of rows (maxBatchSize).
Only call this
+ * constructor directly for testing purposes. {@link Tablet} should normally
always be default
+ * size.
*
* @param deviceId the name of the device specified to be written in
- * @param schemas the list of measurement schemas for creating the row
batch, only measurementId
- * and type take effects
+ * @param schemas the list of {@link MeasurementSchema}s for creating the
row batch, only
+ * measurementId and type take effects
* @param maxRowNumber the maximum number of rows for this tablet
*/
public Tablet(String deviceId, List<MeasurementSchema> schemas, int
maxRowNumber) {
@@ -106,16 +108,16 @@ public class Tablet {
}
/**
- * Return a tablet with specified timestamps and values. Only call this
constructor directly for
- * Trigger.
+ * Return a {@link Tablet} with specified timestamps and values. Only call
this constructor
+ * directly for Trigger.
*
* @param deviceId the name of the device specified to be written in
- * @param schemas the list of measurement schemas for creating the row
batch, only measurementId
- * and type take effects
+ * @param schemas the list of {@link MeasurementSchema}s for creating the
row batch, only
+ * measurementId and type take effects
* @param timestamps given timestamps
* @param values given values
- * @param bitMaps given bitmaps
- * @param maxRowNumber the maximum number of rows for this tablet
+ * @param bitMaps given {@link BitMap}s
+ * @param maxRowNumber the maximum number of rows for this {@link Tablet}
*/
public Tablet(
String deviceId,
@@ -173,14 +175,14 @@ public class Tablet {
TSDataType dataType, int rowIndex, int indexOfSchema, Object value) {
if (value == null) {
- // init the bitMap to mark null value
+ // Init the bitMap to mark null value
if (bitMaps == null) {
bitMaps = new BitMap[values.length];
}
if (bitMaps[indexOfSchema] == null) {
bitMaps[indexOfSchema] = new BitMap(maxRowNumber);
}
- // mark the null value position
+ // Mark the null value position
bitMaps[indexOfSchema].mark(rowIndex);
}
switch (dataType) {
@@ -302,7 +304,7 @@ public class Tablet {
return rowSize * 8;
}
- /** @return total bytes of values */
+ /** @return Total bytes of values */
public int getTotalValueOccupation() {
int valueOccupation = 0;
int columnIndex = 0;
@@ -310,10 +312,10 @@ public class Tablet {
valueOccupation += calOccupationOfOneColumn(schema.getType(),
columnIndex);
columnIndex++;
}
- // add bitmap size if the tablet has bitMaps
+ // Add bitmap size if the tablet has bitMaps
if (bitMaps != null) {
for (BitMap bitMap : bitMaps) {
- // marker byte
+ // Marker byte
valueOccupation++;
if (bitMap != null && !bitMap.isAllUnmarked()) {
valueOccupation += rowSize / Byte.SIZE + 1;
@@ -350,7 +352,7 @@ public class Tablet {
return valueOccupation;
}
- /** serialize Tablet */
+ /** Serialize {@link Tablet} */
public ByteBuffer serialize() throws IOException {
try (PublicBAOS byteArrayOutputStream = new PublicBAOS();
DataOutputStream outputStream = new
DataOutputStream(byteArrayOutputStream)) {
@@ -368,7 +370,7 @@ public class Tablet {
writeValues(stream);
}
- /** Serialize measurement schemas */
+ /** Serialize {@link MeasurementSchema}s */
private void writeMeasurementSchemas(DataOutputStream stream) throws
IOException {
ReadWriteIOUtils.write(BytesUtils.boolToByte(schemas != null), stream);
if (schemas != null) {
@@ -393,7 +395,7 @@ public class Tablet {
}
}
- /** Serialize bitmaps */
+ /** Serialize {@link BitMap}s */
private void writeBitMaps(DataOutputStream stream) throws IOException {
ReadWriteIOUtils.write(BytesUtils.boolToByte(bitMaps != null), stream);
if (bitMaps != null) {
@@ -607,13 +609,13 @@ public class Tablet {
}
/**
- * Note that the function will judge 2 tablets to be equal when their
contents are logically the
- * same. Namely, a tablet with bitmap "null" may be equal to another tablet
with 3 columns and
- * bitmap "[null, null, null]", and a tablet with rowSize 2 is judged
identical to other tablets
+ * Note that the function will judge 2 {@link Tablet}s to be equal when
their contents are logically the
+ * same. Namely, a {@link Tablet} with {@link BitMap} "null" may be equal to
another {@link Tablet} with 3 columns and
+ * {@link BitMap "[null, null, null]", and a {@link Tablet} with rowSize 2
is judged identical to other {@link Tablet}s
* regardless of any timeStamps with indexes larger than or equal to 2.
*
* @param o the tablet to compare
- * @return true if the tablets are logically equal
+ * @return {@code true} if the tablets are logically equal
*/
@Override
public boolean equals(Object o) {