Skip to content

Commit b081963

Browse files
committed
Fix code structure
1 parent 51f68be commit b081963

7 files changed

Lines changed: 13 additions & 60 deletions

File tree

iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,12 +1774,7 @@ private boolean filterNullValueAndMeasurement(
17741774
return false;
17751775
}
17761776

1777-
/**
1778-
* Filter the null object of list。
1779-
*
1780-
* @param prefixPaths devices path。
1781-
* @return true:all values of valuesList are null;false:Not all values of valuesList are null.
1782-
*/
1777+
/** Filter the null object of list。 */
17831778
private void filterNullValueAndMeasurementWithStringType(
17841779
List<String> prefixPaths,
17851780
List<Long> times,

iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/RleColumnDecoder.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,20 @@ public RleColumnDecoder(TSDataType dataType) {
4141
public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
4242
switch (dataType) {
4343
case BOOLEAN:
44-
return decoder.readBoolean(buffer);
44+
return decodeBooleanColumn(buffer, columnEntry, rowCount);
4545
case INT32:
4646
case DATE:
47-
return decoder.readInt(buffer);
47+
return decodeIntColumn(buffer, columnEntry, rowCount);
4848
case INT64:
4949
case TIMESTAMP:
50-
return decoder.readLong(buffer);
50+
return decodeLongColumn(buffer, columnEntry, rowCount);
5151
case FLOAT:
52-
return decoder.readFloat(buffer);
52+
return decodeFloatColumn(buffer, columnEntry, rowCount);
5353
case DOUBLE:
54-
return decoder.readDouble(buffer);
54+
return decodeDoubleColumn(buffer, columnEntry, rowCount);
5555
case TEXT:
5656
case STRING:
5757
case BLOB:
58-
return decoder.readBinary(buffer);
5958
default:
6059
throw new UnsupportedOperationException("PLAIN doesn't support data type: " + dataType);
6160
}

iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/decoder/ZigzagColumnDecoder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public Object decode(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
5454

5555
@Override
5656
public boolean[] decodeBooleanColumn(ByteBuffer buffer, ColumnEntry columnEntry, int rowCount) {
57-
throw new TsFileDecodingException(
58-
String.format("Zigzag doesn't support data type: " + dataType));
57+
throw new TsFileDecodingException("Zigzag doesn't support data type: " + dataType);
5958
}
6059

6160
@Override

iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/ColumnEncoder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public interface ColumnEncoder {
5454
* number of entries.
5555
*
5656
* @param len the length of arrayList
57-
* @return
5857
*/
5958
default int getUncompressedDataSize(int len, Binary[] values, TSDataType dataType) {
6059
int unCompressedSize = 0;

iotdb-client/session/src/main/java/org/apache/iotdb/session/rpccompress/encoder/PlainColumnEncoder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public PlainColumnEncoder(TSDataType dataType) {
4949
/**
5050
* Encodes a column of data using the PLAIN encoding algorithm.
5151
*
52-
* @param values
53-
* @param out
52+
* @param values values the input boolean array to be encoded
53+
* @param out out the output stream to write the encoded binary data
5454
*/
5555
@Override
5656
public void encode(boolean[] values, ByteArrayOutputStream out) {
@@ -193,8 +193,8 @@ public void encode(Binary[] values, ByteArrayOutputStream out) {
193193
/**
194194
* Set column entry metadata
195195
*
196-
* @param compressedSize
197-
* @param unCompressedSize
196+
* @param compressedSize the size of the encoded data in bytes after compression
197+
* @param unCompressedSize the original size of the data in bytes before compression
198198
*/
199199
private void setColumnEntry(Integer compressedSize, Integer unCompressedSize) {
200200
columnEntry = new ColumnEntry(compressedSize, unCompressedSize, dataType, TSEncoding.PLAIN);

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/RPCServiceThriftHandlerMetrics.java

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,11 @@ public class RPCServiceThriftHandlerMetrics implements IMetricSet {
3737

3838
// region begin
3939
private Timer compressionRatioTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
40-
private Timer timeConsumedOfRPCTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
41-
private Timer encodeLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
4240
private Timer decodeLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
43-
private Timer compressLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
4441
private Timer decompressLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
4542

4643
// end
47-
44+
// 内存占用
4845
public RPCServiceThriftHandlerMetrics(AtomicLong thriftConnectionNumber) {
4946
this.thriftConnectionNumber = thriftConnectionNumber;
5047
}
@@ -53,22 +50,10 @@ public void recordCompressionRatioTimer(final long costTimeInNanos) {
5350
compressionRatioTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
5451
}
5552

56-
public void recordTimeConsumedOfRPC(final long costTimeInNanos) {
57-
timeConsumedOfRPCTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
58-
}
59-
60-
public void recordEncodeLatencyTimer(final long costTimeInNanos) {
61-
encodeLatencyTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
62-
}
63-
6453
public void recordDecodeLatencyTimer(final long costTimeInNanos) {
6554
decodeLatencyTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
6655
}
6756

68-
public void recordCompressLatencyTimer(final long costTimeInNanos) {
69-
compressLatencyTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
70-
}
71-
7257
public void recordDecompressLatencyTimer(final long costTimeInNanos) {
7358
decompressLatencyTimer.update(costTimeInNanos, TimeUnit.NANOSECONDS);
7459
}
@@ -94,34 +79,13 @@ private void bindToTimer(final AbstractMetricService metricService) {
9479
Tag.NAME.toString(),
9580
"compressionRatio");
9681

97-
timeConsumedOfRPCTimer =
98-
metricService.getOrCreateTimer(
99-
Metric.THRIFT_RPC_COMPRESS.toString(),
100-
MetricLevel.IMPORTANT,
101-
Tag.NAME.toString(),
102-
"timeConsumedOfRPC");
103-
104-
encodeLatencyTimer =
105-
metricService.getOrCreateTimer(
106-
Metric.THRIFT_RPC_COMPRESS.toString(),
107-
MetricLevel.IMPORTANT,
108-
Tag.NAME.toString(),
109-
"encodeLatency");
110-
11182
decodeLatencyTimer =
11283
metricService.getOrCreateTimer(
11384
Metric.THRIFT_RPC_COMPRESS.toString(),
11485
MetricLevel.IMPORTANT,
11586
Tag.NAME.toString(),
11687
"decodeLatency");
11788

118-
compressLatencyTimer =
119-
metricService.getOrCreateTimer(
120-
Metric.THRIFT_RPC_COMPRESS.toString(),
121-
MetricLevel.IMPORTANT,
122-
Tag.NAME.toString(),
123-
"compressLatency");
124-
12589
decompressLatencyTimer =
12690
metricService.getOrCreateTimer(
12791
Metric.THRIFT_RPC_COMPRESS.toString(),
@@ -139,10 +103,7 @@ public void unbindFrom(AbstractMetricService metricService) {
139103
"ClientRPC");
140104

141105
compressionRatioTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
142-
timeConsumedOfRPCTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
143-
encodeLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
144106
decodeLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
145-
compressLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
146107
decompressLatencyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
147108

148109
metricService.remove(

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public static InsertRowsOfOneDeviceStatement createStatement(TSInsertRecordsOfOn
549549
insertStatement.setDevicePath(DEVICE_PATH_CACHE.getPartialPath(req.prefixPath));
550550
List<InsertRowStatement> insertRowStatementList = new ArrayList<>();
551551
// req.timestamps sorted on session side
552-
if (req.timestamps.size() != 0) {
552+
if (!req.timestamps.isEmpty()) {
553553
TimestampPrecisionUtils.checkTimestampPrecision(
554554
req.timestamps.get(req.timestamps.size() - 1));
555555
}

0 commit comments

Comments
 (0)