Refactor the reader package for readability (#241)
* Refactor the reader package for readability The former code in the org.apache.iotdb.db.query.reader package is somewhat diffcult to read. Through this refactor, two main tasks are completed: * the three levels of readers are made explicit: chunkRelated < resoureRelated < seriesReader * the two interfaces for creating the unsequence readers in SeriesReaderFactoryImpl are removed. Instead, two classes UnseqResourceMergeReader and UnseqResourceReaderByTimestamp are used. This change brings two benefits: a) SeriesReaderFactoryImpl is thus focused purely on the creation of series readers and acts as a middleman between query executor and data reader.b) The classes for sequence and unsequence classes are symmetric finally. The future work includes further removing duplicated code and writing better annotations. * Deprecate the SeriesReaderFactoryImpl The former code creates the three series related readers ( SeriesReaderWithoutValueFilter, SeriesReaderWithValueFilter and SeriesReaderByTimestamp) by the help of SeriesReaderFactoryImpl. However, thanks to the latest refactor of the reader package, it becomes clear that the creation tasks can be handed over to the constructors of the three series reader classes respectively. This change brings about two benefits: 1) the role of the three series readers are more clear and controllable since now the inputs of their constructors are not pre-created readers but the raw resouces. 2) the SeriesReaderFactoryImpl now can be removed or changed to perform other tasks such as code deduplication. update * Add JAVA annotations and improve related tests. reformat license * fix the bug in getValueInTimestamp of SeqResourceReaderByTimestamp; further split the subpackage chunkRelated into two subpackages chunkRelated and fileRelated. * unsealed sequence TsFile's endTimeMap can also be used in constructNextReader of SeqResourceReaderByTimestamp to speed up * add resource filter step in the resource related reader construction process * add more annotations for isTsFileNotSatisfied and constructNextReader
Showing
想要评论请 注册 或 登录