You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/03/23 00:48:02 UTC
[iotdb] branch master updated: [IOTDB-2776] Improve the TsFileWriter's method: write(Tablet tablet) (#5310)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 717bab3 [IOTDB-2776] Improve the TsFileWriter's method: write(Tablet tablet) (#5310)
717bab3 is described below
commit 717bab3ba39a63501b54a9b34768c1d2d4f2301f
Author: JiaXin Zhang <37...@users.noreply.github.com>
AuthorDate: Wed Mar 23 08:47:03 2022 +0800
[IOTDB-2776] Improve the TsFileWriter's method: write(Tablet tablet) (#5310)
---
.../chunk/NonAlignedChunkGroupWriterImpl.java | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/NonAlignedChunkGroupWriterImpl.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/NonAlignedChunkGroupWriterImpl.java
index f806327..4d207c9 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/NonAlignedChunkGroupWriterImpl.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/NonAlignedChunkGroupWriterImpl.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.tsfile.write.chunk;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.utils.Binary;
import org.apache.iotdb.tsfile.write.record.Tablet;
import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
@@ -88,22 +89,23 @@ public class NonAlignedChunkGroupWriterImpl implements IChunkGroupWriter {
@Override
public int write(Tablet tablet) throws WriteProcessException {
- int pointCount = 0;
+ int maxPointCount = 0, pointCount;
List<MeasurementSchema> timeseries = tablet.getSchemas();
- for (int row = 0; row < tablet.rowSize; row++) {
- long time = tablet.timestamps[row];
- boolean hasOneColumnWritten = false;
- for (int column = 0; column < timeseries.size(); column++) {
+ for (int column = 0; column < timeseries.size(); column++) {
+ String measurementId = timeseries.get(column).getMeasurementId();
+ TSDataType tsDataType = timeseries.get(column).getType();
+ pointCount = 0;
+ for (int row = 0; row < tablet.rowSize; row++) {
// check isNull in tablet
if (tablet.bitMaps != null
&& tablet.bitMaps[column] != null
&& tablet.bitMaps[column].isMarked(row)) {
continue;
}
- String measurementId = timeseries.get(column).getMeasurementId();
+ long time = tablet.timestamps[row];
checkIsHistoryData(measurementId, time);
- hasOneColumnWritten = true;
- switch (timeseries.get(column).getType()) {
+ pointCount++;
+ switch (tsDataType) {
case INT32:
chunkWriters.get(measurementId).write(time, ((int[]) tablet.values[column])[row]);
break;
@@ -124,15 +126,13 @@ public class NonAlignedChunkGroupWriterImpl implements IChunkGroupWriter {
break;
default:
throw new UnSupportedDataTypeException(
- String.format("Data type %s is not supported.", timeseries.get(column).getType()));
+ String.format("Data type %s is not supported.", tsDataType));
}
lastTimeMap.put(measurementId, time);
}
- if (hasOneColumnWritten) {
- pointCount++;
- }
+ maxPointCount = Math.max(pointCount, maxPointCount);
}
- return pointCount;
+ return maxPointCount;
}
@Override