shuwenwei commented on code in PR #12744:
URL: https://github.com/apache/iotdb/pull/12744#discussion_r1680806101
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/TsFileSplitter.java:
##########
@@ -318,6 +145,234 @@ public void splitTsFileByDataPartition() throws
IOException, IllegalStateExcepti
}
}
+ private void processTimeChunkOrNonAlignedChunk(TsFileSequenceReader reader,
byte marker)
+ throws IOException {
+ long chunkOffset = reader.position();
+ timeChunkIndexOfCurrentValueColumn = pageIndex2TimesList.size();
+ consumeAllAlignedChunkData(chunkOffset, pageIndex2ChunkData);
+ handleModification(offset2Deletions, chunkOffset);
+
+ ChunkHeader header = reader.readChunkHeader(marker);
+ String measurementId = header.getMeasurementID();
+ if (header.getDataSize() == 0) {
+ throw new TsFileRuntimeException(
+ String.format(
+ "Empty Nonaligned Chunk or Time Chunk with offset %d in TsFile
%s.",
+ chunkOffset, tsFile.getPath()));
+ }
+
+ isAligned =
+ ((header.getChunkType() & TsFileConstant.TIME_COLUMN_MASK)
+ == TsFileConstant.TIME_COLUMN_MASK);
+ IChunkMetadata chunkMetadata = offset2ChunkMetadata.get(chunkOffset -
Byte.BYTES);
+ // When loading TsFile with Chunk in data zone but no matched ChunkMetadata
+ // at the end of file, this Chunk needs to be skipped.
+ if (chunkMetadata == null) {
+ reader.readChunk(-1, header.getDataSize());
+ return;
+ }
+ TTimePartitionSlot timePartitionSlot =
+ TimePartitionUtils.getTimePartitionSlot(chunkMetadata.getStartTime());
+ ChunkData chunkData =
+ ChunkData.createChunkData(
+ isAligned, ((PlainDeviceID) curDevice).toStringID(), header,
timePartitionSlot);
+
+ if (!needDecodeChunk(chunkMetadata)) {
+ chunkData.setNotDecode();
+ chunkData.writeEntireChunk(reader.readChunk(-1, header.getDataSize()),
chunkMetadata);
+ if (isAligned) {
+ isTimeChunkNeedDecode = false;
+ pageIndex2ChunkData
+ .computeIfAbsent(1, o -> new ArrayList<>())
+ .add((AlignedChunkData) chunkData);
Review Comment:
The pageIndex2ChunkData is a map, and it use '1' as first element.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]