2828import org .apache .tsfile .file .metadata .TimeseriesMetadata ;
2929import org .apache .tsfile .read .common .Path ;
3030import org .apache .tsfile .read .reader .LocalTsFileInput ;
31+ import org .apache .tsfile .read .reader .TsFileInput ;
3132import org .apache .tsfile .utils .Pair ;
3233import org .apache .tsfile .utils .ReadWriteIOUtils ;
3334
@@ -51,8 +52,7 @@ public class DiskTSMIterator extends TSMIterator {
5152 private static final Logger LOG = LoggerFactory .getLogger (DiskTSMIterator .class );
5253
5354 private LinkedList <Long > endPosForEachDevice ;
54- private File cmtFile ;
55- private LocalTsFileInput input ;
55+ protected TsFileInput input ;
5656 private long fileLength = 0 ;
5757 private long currentPos = 0 ;
5858 private long nextEndPosForDevice = 0 ;
@@ -65,7 +65,6 @@ protected DiskTSMIterator(
6565 LinkedList <Long > endPosForEachDevice )
6666 throws IOException {
6767 super (chunkGroupMetadataList );
68- this .cmtFile = cmtFile ;
6968 this .endPosForEachDevice = endPosForEachDevice ;
7069 this .input = new LocalTsFileInput (cmtFile .toPath ());
7170 this .fileLength = cmtFile .length ();
@@ -78,22 +77,24 @@ public boolean hasNext() {
7877 }
7978
8079 @ Override
81- public Pair <Path , TimeseriesMetadata > next () {
80+ public Pair <Path , TimeseriesMetadata > next () throws IOException {
8281 try {
8382 if (remainsInFile ) {
8483 // deserialize from file
85- return getTimeSerisMetadataFromFile ();
84+ return getTimeSeriesMetadataFromFile ();
8685 } else {
8786 // get from memory iterator
8887 return super .next ();
8988 }
9089 } catch (IOException e ) {
91- LOG .error ("Meets IOException when reading timeseries metadata from disk" , e );
92- return null ;
90+ if (!Thread .currentThread ().isInterrupted ()) {
91+ LOG .error ("Meets IOException when reading timeseries metadata from disk" , e );
92+ }
93+ throw e ;
9394 }
9495 }
9596
96- private Pair <Path , TimeseriesMetadata > getTimeSerisMetadataFromFile () throws IOException {
97+ private Pair <Path , TimeseriesMetadata > getTimeSeriesMetadataFromFile () throws IOException {
9798 if (currentPos == nextEndPosForDevice ) {
9899 // deserialize the current device name
99100 currentDevice = Deserializer .DEFAULT_DESERIALIZER .deserializeFrom (input .wrapAsInputStream ());
0 commit comments