in java/tsfile/src/main/java/org/apache/tsfile/write/chunk/NonAlignedChunkGroupWriterImpl.java [110:179]
public int write(Tablet tablet, int startRowIndex, int endRowIndex)
throws WriteProcessException, IOException {
int maxPointCount = 0, pointCount;
List<IMeasurementSchema> timeseries = tablet.getSchemas();
for (int column = 0; column < tablet.getSchemas().size(); column++) {
if (tablet.getColumnTypes() != null
&& tablet.getColumnTypes().get(column) != ColumnCategory.FIELD) {
continue;
}
String measurementId = timeseries.get(column).getMeasurementName();
TSDataType tsDataType = timeseries.get(column).getType();
pointCount = 0;
for (int row = startRowIndex; row < endRowIndex; row++) {
// check isNull in tablet
if (tablet.getBitMaps() != null
&& tablet.getBitMaps()[column] != null
&& tablet.getBitMaps()[column].isMarked(row)) {
continue;
}
long time = tablet.getTimestamps()[row];
checkIsHistoryData(measurementId, time);
pointCount++;
switch (tsDataType) {
case INT32:
chunkWriters.get(measurementId).write(time, ((int[]) tablet.getValues()[column])[row]);
break;
case DATE:
chunkWriters
.get(measurementId)
.write(
time,
DateUtils.parseDateExpressionToInt(
((LocalDate[]) tablet.getValues()[column])[row]));
break;
case INT64:
case TIMESTAMP:
chunkWriters.get(measurementId).write(time, ((long[]) tablet.getValues()[column])[row]);
break;
case FLOAT:
chunkWriters
.get(measurementId)
.write(time, ((float[]) tablet.getValues()[column])[row]);
break;
case DOUBLE:
chunkWriters
.get(measurementId)
.write(time, ((double[]) tablet.getValues()[column])[row]);
break;
case BOOLEAN:
chunkWriters
.get(measurementId)
.write(time, ((boolean[]) tablet.getValues()[column])[row]);
break;
case TEXT:
case BLOB:
case STRING:
chunkWriters
.get(measurementId)
.write(time, ((Binary[]) tablet.getValues()[column])[row]);
break;
default:
throw new UnSupportedDataTypeException(
String.format("Data type %s is not supported.", tsDataType));
}
lastTimeMap.put(measurementId, time);
}
maxPointCount = Math.max(pointCount, maxPointCount);
}
return maxPointCount;
}