fanhualta commented on a change in pull request #736: Refactor TsFile URL: https://github.com/apache/incubator-iotdb/pull/736#discussion_r377527825
########## File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/writer/TsFileIOWriter.java ########## @@ -202,13 +204,19 @@ public void writeChunk(Chunk chunk, ChunkMetaData chunkMetadata) throws IOExcept * end chunk and write some log. */ public void endCurrentChunk() { - currentChunkGroupMetaData.addTimeSeriesChunkMetaData(currentChunkMetaData); + chunkMetaDataList.add(currentChunkMetaData); + Path path = new Path(deviceId, currentChunkMetaData.getMeasurementUid()); + List<ChunkMetaData> chunkMetaDataListOfOnePath = timeseriesMetadataMap.getOrDefault(path, + new ArrayList<ChunkMetaData>()); + chunkMetaDataListOfOnePath.add(currentChunkMetaData); + timeseriesMetadataMap.put(path, chunkMetaDataListOfOnePath); Review comment: Please use the following codes instead to reduce the operation and improve the efficiency. ``` timeseriesMetadataMap.computeIfAbsent(path, k -> new ArrayList<>()).add(currentChunkMetaData); ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services